In a nutshell, the changes will register the Gradle tasks, but they will only be configured if they are actually required (i.e. when they will actually be executed), improving the time Gradle takes to configure everything.
I noticed that the plugin was configuring downloadLicenses, license and licenseFormat tasks even if a small Gradle task was run.
For demo purposes, I created a small demo project, which defines three modules, each having a simple helloWorld task whose only purpose is to print something to the console:
LicenseGradlePluginLazyTaskConfigurationSample.zip
The project prints the tasks that are configured by Gradle to the console.
When running ./gradlew :module1:helloWorld with the latest released plugin version, the console output looks as follows:
BUILD SUCCESSFUL in 589ms
1 actionable task: 1 executed
As you can see, downloadLicenses, license and licenseFormat tasks are configured even if they are not run, also for modules that are not affected by the current Gradle run.
This PR improves the plugin by registering tasks using Task Configuration Avoidance.
In a nutshell, the changes will register the Gradle tasks, but they will only be configured if they are actually required (i.e. when they will actually be executed), improving the time Gradle takes to configure everything.
I noticed that the plugin was configuring
downloadLicenses
,license
andlicenseFormat
tasks even if a small Gradle task was run.For demo purposes, I created a small demo project, which defines three modules, each having a simple
helloWorld
task whose only purpose is to print something to the console: LicenseGradlePluginLazyTaskConfigurationSample.zipThe project prints the tasks that are configured by Gradle to the console.
When running
./gradlew :module1:helloWorld
with the latest released plugin version, the console output looks as follows:As you can see,
downloadLicenses
,license
andlicenseFormat
tasks are configured even if they are not run, also for modules that are not affected by the current Gradle run.After my changes, the output looks as follows: