Incremental Build of legacy generators (input/output after task execution)


(Nicolas Cabanis) #1

As I understand the Incremental Build concept, task inputs and outputs have to be defined before task execution. We have several quite complicated legacy code generators for which I cannot tell in advance, which files will be generated. Another generator doesnt only read the defined input files, but additional files, which I cannot predict also.

Wouldn’t it be nice, if I could define task inputs and outputs after the task has been executed and Gradle is remembering that. And if nothing has changed in the next Gradle run, the task doesn’t need to run - and Gradle knows that without asking the task.


(Lance Java) #2

Wouldn’t it be nice, if I could define task inputs and outputs after the task has been executed and Gradle is remembering that. And if nothing has changed in the next Gradle run

This doesn’t make sense to me… the sole purpose of inputs/outputs is the ability to skip a task that’s up-to-date. If you have to run the task to calculate inputs/outputs… what’s the point?

We have several quite complicated legacy code generators for which I cannot tell in advance, which files will be generated

Can you refactor the generators such that they output to a single root directory (eg $buildDir/generated/...) which contains nothing else but generated files?

Another generator doesnt only read the defined input files, but additional files, which I cannot predict also

I’m guessing there’s a finite set of files which can be inputs. Can you move/copy these to a separate “inputs” folder?

If you could make these changes… you could use the two folders as @InputDirectory and @OutputDirectory. I realise it mightn’t be as granular as you’d like but it’s a pretty good start.