Configuration cache support
dsvensson opened this issue · 1 comments
dsvensson commented
Configuration cache seems to be on track for being marked as stable for 8.1 release of gradle which is not that far away. This feature speeds up gradle a lot, but at the moment this plugin is not compatible.
5 problems were found storing the configuration cache, 4 of which seem unique.
- Task `:checkLicensePreparation` of type `com.github.jk1.license.task.CheckLicensePreparationTask`: invocation of 'Task.project' at execution time is unsupported.
See https://docs.gradle.org/8.0-rc-3/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution
- Task `:checkLicense` of type `com.github.jk1.license.task.CheckLicenseTask`: cannot serialize object of type 'com.github.jk1.license.task.CacheableReportTask', a subtype of 'org.gradle.api.Task', as these are not supported with the configuration cache.
See https://docs.gradle.org/8.0-rc-3/userguide/configuration_cache.html#config_cache:requirements:task_access
- Task `:checkLicense` of type `com.github.jk1.license.task.CheckLicenseTask`: cannot serialize object of type 'org.gradle.api.internal.project.DefaultProject', a subtype of 'org.gradle.api.Project', as these are not supported with the configuration cache.
See https://docs.gradle.org/8.0-rc-3/userguide/configuration_cache.html#config_cache:requirements:disallowed_types
- Task `:checkLicense` of type `com.github.jk1.license.task.CheckLicenseTask`: invocation of 'Task.project' at execution time is unsupported.
See https://docs.gradle.org/8.0-rc-3/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution
erdi commented
I'm making our build cache compatible and stumbled upon this. The following test added to CheckLicenseTaskSpec
currently fails
def "using it with configuration cache should not cause the build to fail"() {
given:
buildFile << """
plugins {
id 'com.github.jk1.dependency-license-report' version '2.1'
}
licenseReport {
allowedLicensesFile = new File("${StringEscapeUtils.escapeJava(allowed.path)}")
}
"""
when:
BuildResult buildResult = result("--configuration-cache", "checkLicense")
then:
buildResult.task(":checkLicense").outcome == TaskOutcome.SUCCESS
}
Ideally the plugin would be made configuration cache compatible but at the very least #269 should be followed up on and CheckLicensePreparationTask
as well as CheckLicenseTask
should also be marked as not compatible with the configuration cache so that the plugin tasks do not cause the build to fail in strict configuration cache mode.