I have a task which generates files in a two step process. I want to keep the files of the intermediate steps between task runs (incremental changes). However I don’t want to include them in any artifact. But still, I’d like to clean them when I run the clean rule for the given task. Is there a way to accomplish that?
What exactly do you mean by “a task which generates files in a two step process”?
If you want to model this as two separate tasks, and you want to have up-to-date checks for both of them, there is no way around declaring the outputs of both tasks (and the outputs of the first task will become inputs to the second task). Why are you trying to avoid this?
Ok. I did a bad job at explaining my question. Reset.
The last directory is marked as ‘@OutputDirectory’ and is part of the source set output. The middle directory is only task internal, but not temporary. It should stay there between task runs to enable incremental compilation. However it is also not removed by a ‘cleanCompileClojureScript’, which might cause troubles with stale files.
Can I simply define my own ‘cleanClojureScriptCompile’ task? It could do the right thing.
Would this clash with the task rule?
You should be able to configure the existing clean task (which has type ‘Delete’). Or you could make ‘cljs’ write the intermediary files to a temporary directory (e.g. ‘Task.temporaryDir’). Using a separate ‘@OutputDirectory’ for the intermediate files should work as well, as this shouldn’t automatically make them part of the source set output. Still, it’s probably not a good idea to declare intermediate files as outputs.