zyxist / chainsaw

Gradle plugin: adds support for building Java 9 modules.
Apache License 2.0
71 stars 4 forks source link

Change the phase of reconfiguring the compilation tasks #10

Open zyxist opened 6 years ago

zyxist commented 6 years ago

Follow up: #9

Compile task reconfiguration is done in doFirst phase (during execution). They change the configuration which affects incremental compilation. Moving it to the configuration phase should solve this issue.

zyxist commented 6 years ago

The reconfiguration has been changed. Regarding incremental compilation: there is no difference between reconfiguring the JavaCompile tasks in doFirst, or in the configuration phase. In both cases, the debug log shows that the incremental compilation works as expected. The task seems to ignore changes of the compilation options. However, I have added a test to ensure that the plugin covers this use case as well.

Vampire commented 6 years ago

Changed to what? As far as I can see from the commit, you still configure the task during execution phase, not configuration phase.

I also never said it will influence incremental compilation, but incremental task execution, the UP-TO-DATE checks that determine whether a task needs to be executed at all or not.

Also this does not only affect incremental execution but also using the build cache.

There might be other stuff affected as configuration of a task should never be changed during execution phase, but only during configuration phase.

zyxist commented 6 years ago

I've reopened the issue - I checked once more and indeed, the whole orchestrator is called in afterEvaluate(), which should not happen, because there are parts of the tasks that were not supposed to called so lately.

Vampire commented 6 years ago

If you call doLast or doFirst in am afterEvaluate block, that doesn't change when it is executed. doLast and doFirst blocks are still executed during execution phase, calling those methods in afterEvaluate just attaches them at the end of configuration phase but they are still executed at execution phase.