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

ir-merges.txt breaks build cache when trackSourceFiles enabled #1054

Open
midery opened this issue Sep 13, 2024 · 0 comments
Open

ir-merges.txt breaks build cache when trackSourceFiles enabled #1054

midery opened this issue Sep 13, 2024 · 0 comments

Comments

@midery
Copy link

midery commented Sep 13, 2024

In Gradle, AbstractKotlinCompile.incremental parameter considered as a compile task input, and if this value is changed, we cannot reuse previously saved cache entry:

Task ':delegate:sample:app:compileDebugKotlin' is not up-to-date because:
Value of input property 'incrementalCompilationEnabled$kotlin_gradle_plugin_common' has changed for task ':delegate:sample:app:compileDebugKotlin'
The input changes require a full rebuild for incremental task ':delegate:sample:app:compileDebugKotlin'.

This becomes a problem when we use remote caches:

  • In our CI, we run cache warmup job on a clean repository without any build folders, thus ir-merges.txt does not exist there, and the incremental compilation turned on.
  • Locally, developers always have the build folders saved to their project, and ir-merges.txt exists in them, so the incremental compilation turned off.

So when we try to reuse remote cache on a local machine, it does not get reused:

Reproducible scenario without remote cache:

  1. Turn on trackSourceFiles option in Anvil extension
  2. Run gradle clean
  3. Run gradle delegate:sample:app:assembleDebug
  4. Do any change in a file in :sample:app module. Example: rename MyActivity to MyActivity2.
  5. Run gradle delegate:delegate:sample:app:assembleDebug --no-build-cache, so we will have build directory updated, but caches store the old value.
  6. Revert the change from Step 4 (we're at the exactly same position as we were in Step 3, only difference is our build folder is not clean.
  7. Run gradle :sample:app:assembleDebug
  8. In logs, you see that the delegate:sample:app:compileDebugKotlin was not taken from cache, but was re-executed.

Introduced in: 2.5.0-beta11.

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

1 participant