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

Kotlin-dsl not reusing configuration-cache in clean builds #21265

Open
CristianGM opened this issue Jul 15, 2022 · 5 comments
Open

Kotlin-dsl not reusing configuration-cache in clean builds #21265

CristianGM opened this issue Jul 15, 2022 · 5 comments

Comments

@CristianGM
Copy link
Contributor

CristianGM commented Jul 15, 2022

Gradle 7.5 release announced that kotlin-dsl is CC compatible, but I have found an issue.

Using an included build to create a convention plugin, written with kotlin-dsl, I want to reuse CC in clean builds.

an easy example would be:
running ./gradlew help, cleaning the build folders, and running ./gradlew help

The use case is for CI, where the build always start from a fresh clone but the setup is absolutely identical, but it happens locally too.

Expected Behavior

Reusing configuration cache.

Current Behavior

Calculating task graph as configuration cache cannot be reused because an input to task ':gradle-plugins:sample-plugin:compilePluginsBlocks' has changed.

Context

Enabling CC in our CI is useless as it's never reused.

Steps to Reproduce

reproducer: https://github.com/CristianGM/kotlin-dsl-CC-issues
clone
execute ./gradlew help, CC will be stored

running ./gradlew help will reuse CC

drop sample-plugin build folder: rm -rf gradle-plugins/sample-plugin/build
execute ./gradlew help, you'll see the message:

Calculating task graph as configuration cache cannot be reused because an input to task ':gradle-plugins:sample-plugin:compilePluginsBlocks' has changed.

Your Environment

I don't think my environment is relevant because I tried in different machines and OS

@donat donat added in:configuration-cache Configuration Caching in:kotlin-dsl and removed to-triage labels Jul 20, 2022
@mlopatkin mlopatkin added 👋 team-triage Issues that need to be triaged by a specific team and removed 👋 team-triage Issues that need to be triaged by a specific team labels Jul 18, 2023
@plnice
Copy link

plnice commented Aug 2, 2023

I've noticed this today in my project - apparently Gradle 8.1.1 is still affected by this issue

@plnice
Copy link

plnice commented Oct 6, 2023

Still encounter this when using Gradle 8.4. Is there anything we can do to push investigation of this forward?

@plnice
Copy link

plnice commented Oct 6, 2023

After running https://gist.github.com/myniva/80b9f98b7eac5b55584d2d1f536b23d5 I've noticed that for :buildSrc:compilePluginsBlocks apart from various files from ~/gradle/wrapper and ~/gradle/caches there are following file inputs specified:

 - /Users/plnice/Development/myproject/buildSrc/build/kotlin-dsl/plugins-blocks/extracted/com/myproject/myplugin1.gradle.kts
 - /Users/plnice/Development/myproject/buildSrc/build/kotlin-dsl/plugins-blocks/extracted/com/myproject/myplugin2.gradle.kts
 - /Users/plnice/Development/myproject/buildSrc/build/generated-sources/kotlin-dsl-external-plugin-spec-builders/kotlin/gradle/kotlin/dsl/plugins/_ab0d3cfa3988cbb7f5bd9eed0586a3ed/PluginSpecBuilders.kt

Probably they are not cached, so when the clean build is run after restoring the cache on CI, they are missing, so configuration cache detects them as changed inputs?

@plnice
Copy link

plnice commented Oct 28, 2023

In my case the workaround was to cache buildSrc/build directory on the CI. This must be related to the fact that additional source files are generated by the kotlin-dsl plugin, they are subject to the configuration cache and the build cache, but since configuration cache status is determined before they are restored from the build cache, configuration cache detects missing files as changed task inputs.

@ov7a ov7a added the to-triage label Dec 21, 2023
@ov7a
Copy link
Member

ov7a commented Dec 21, 2023

Sorry for the late reply.

Thank you for providing a valid report.

The issue is in the backlog of the relevant team, but this area of Gradle is currently not a focus one, so it might take a while before a fix is made.

@ov7a ov7a removed the to-triage label Dec 21, 2023
krzema12 added a commit to typesafegithub/github-workflows-kt that referenced this issue Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants