Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration cache support #255

Open
dsvensson opened this issue Feb 9, 2023 · 1 comment
Open

Configuration cache support #255

dsvensson opened this issue Feb 9, 2023 · 1 comment
Assignees

Comments

@dsvensson
Copy link

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
Copy link

erdi commented Jul 17, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants