This message was deleted.
# configuration-cache
s
This message was deleted.
s
Copy code
Caused by: java.lang.ClassNotFoundException: com.squareup.wire.gradle.WireTask
	at org.gradle.configurationcache.serialization.DefaultReadContext.readClass(Contexts.kt:285)
	at org.gradle.configurationcache.serialization.codecs.TaskNodeCodec.readTask(TaskNodeCodec.kt:514)
	at org.gradle.configurationcache.serialization.codecs.TaskNodeCodec.decode(TaskNodeCodec.kt:75)
	at org.gradle.configurationcache.serialization.codecs.BindingsBackedCodec.decode(BindingsBackedCodec.kt:59)
	at org.gradle.configurationcache.serialization.DefaultReadContext.read(Contexts.kt:259)
	at org.gradle.configurationcache.serialization.CodecKt.readNonNull(Codec.kt:96)
	at org.gradle.configurationcache.serialization.codecs.WorkNodeCodec.readNode(WorkNodeCodec.kt:103)
	at org.gradle.configurationcache.serialization.codecs.WorkNodeCodec.readNodes(WorkNodeCodec.kt:86)
	at org.gradle.configurationcache.serialization.codecs.WorkNodeCodec.readWork(WorkNodeCodec.kt:59)
	at org.gradle.configurationcache.ConfigurationCacheState.readWorkGraph(ConfigurationCacheState.kt:267)
	at org.gradle.configurationcache.ConfigurationCacheState.readBuildState$configuration_cache(ConfigurationCacheState.kt:238)
	at org.gradle.configurationcache.ConfigurationCacheState.readRootBuild(ConfigurationCacheState.kt:192)
	at org.gradle.configurationcache.ConfigurationCacheState.readRootBuildState(ConfigurationCacheState.kt:120)
	at org.gradle.configurationcache.ConfigurationCacheIO$readRootBuildStateFrom$1.invokeSuspend(ConfigurationCacheIO.kt:141)
	at org.gradle.configurationcache.ConfigurationCacheIO$readRootBuildStateFrom$1.invoke(ConfigurationCacheIO.kt)
	at org.gradle.configurationcache.ConfigurationCacheIO$readRootBuildStateFrom$1.invoke(ConfigurationCacheIO.kt)
	at org.gradle.configurationcache.ConfigurationCacheIO$readConfigurationCacheState$1.invokeSuspend(ConfigurationCacheIO.kt:170)
	at org.gradle.configurationcache.ConfigurationCacheIO$readConfigurationCacheState$1.invoke(ConfigurationCacheIO.kt)
	at org.gradle.configurationcache.ConfigurationCacheIO$readConfigurationCacheState$1.invoke(ConfigurationCacheIO.kt)
	at org.gradle.configurationcache.ConfigurationCacheIO$withReadContextFor$1$1$1$1.invokeSuspend(ConfigurationCacheIO.kt:248)
	at org.gradle.configurationcache.ConfigurationCacheIO$withReadContextFor$1$1$1$1.invoke(ConfigurationCacheIO.kt)
	at org.gradle.configurationcache.ConfigurationCacheIO$withReadContextFor$1$1$1$1.invoke(ConfigurationCacheIO.kt)
	at org.gradle.configurationcache.serialization.RunningKt$runReadOperation$2.invokeSuspend(Running.kt:34)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlin.coroutines.ContinuationKt.startCoroutine(Continuation.kt:115)
	at org.gradle.configurationcache.serialization.RunningKt.runToCompletion(Running.kt:56)
	at org.gradle.configurationcache.serialization.RunningKt.runReadOperation(Running.kt:33)
	at org.gradle.configurationcache.ConfigurationCacheIO.withReadContextFor$configuration_cache(ConfigurationCacheIO.kt:247)
	at org.gradle.configurationcache.ConfigurationCacheIO.readConfigurationCacheState(ConfigurationCacheIO.kt:168)
	at org.gradle.configurationcache.ConfigurationCacheIO.readRootBuildStateFrom$configuration_cache(ConfigurationCacheIO.kt:139)
	at org.gradle.configurationcache.DefaultConfigurationCache$loadWorkGraph$1.invoke(DefaultConfigurationCache.kt:352)
	at org.gradle.configurationcache.DefaultConfigurationCache$loadWorkGraph$1.invoke(DefaultConfigurationCache.kt:351)
	at org.gradle.configurationcache.ConfigurationCacheRepository$StoreImpl$useForStateLoad$1.invoke(ConfigurationCacheRepository.kt:159)
	at org.gradle.configurationcache.ConfigurationCacheRepository$StoreImpl$useForStateLoad$1.invoke(ConfigurationCacheRepository.kt:159)
	at org.gradle.configurationcache.ConfigurationCacheRepository$StoreImpl$useForStateLoad$2.invoke(ConfigurationCacheRepository.kt:164)
	at org.gradle.configurationcache.ConfigurationCacheRepository$StoreImpl$useForStateLoad$2.invoke(ConfigurationCacheRepository.kt:163)
	at org.gradle.configurationcache.ConfigurationCacheRepository$withExclusiveAccessToCache$1.create(ConfigurationCacheRepository.kt:244)
	at org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess.withFileLock(LockOnDemandCrossProcessCacheAccess.java:90)
	at org.gradle.cache.internal.DefaultCacheAccess.withFileLock(DefaultCacheAccess.java:191)
	at org.gradle.cache.internal.DefaultPersistentDirectoryStore.withFileLock(DefaultPersistentDirectoryStore.java:188)
	at org.gradle.cache.internal.DefaultCacheFactory$ReferenceTrackingCache.withFileLock(DefaultCacheFactory.java:209)
	at org.gradle.configurationcache.ConfigurationCacheRepository.withExclusiveAccessToCache(ConfigurationCacheRepository.kt:242)
	at org.gradle.configurationcache.ConfigurationCacheRepository.access$withExclusiveAccessToCache(ConfigurationCacheRepository.kt:46)
	at org.gradle.configurationcache.ConfigurationCacheRepository$StoreImpl.useForStateLoad(ConfigurationCacheRepository.kt:163)
	at org.gradle.configurationcache.ConfigurationCacheRepository$StoreImpl.useForStateLoad(ConfigurationCacheRepository.kt:159)
	at org.gradle.configurationcache.DefaultConfigurationCache$loadFromCache$result$1.invoke(DefaultConfigurationCache.kt:365)
	at org.gradle.configurationcache.ConfigurationCacheBuildOperationsKt$withOperation$1.call(ConfigurationCacheBuildOperations.kt:60)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
c
CC does not currently support re-use, other than locally.
s
gradle-build-action in github supports it
c
no, it supports caching dependencies, gradle distributions. Gradle itself does not support reusing the CC.
Correction, it appears they have added that:
• Any configuration-cache data stored in the project
.gradle
directory. (Only supported for Gradle 7 or higher.)
However, that doesn’t change the fact that Gradle itself doesn’t currently support reusing the CC.
v
Are you sure? Shouldn't it work if it is restored to the exact same physical place, which should be the case if you run on the same environment on GHA
c
it’s documented as such. Not currently designed to be reused. No guarantee that another build agent is identical - at a minimum it has different hostnames, etc. Without knowing why the CC is not reusable it’s just speculation. Hopefully it will get there soon.
v
I assume it is mainly absolute paths stored inside or something like that. I would even imply that, purley by the fact that the official
gradle-build-action
does cache and restore it. Also @CristianGM wrote in https://github.com/gradle/gradle/issues/13510 that he successfully reuses the CC on TravisCI and Github Actions by copying around the CC directory.
c
absolute paths, difference in job variables, etc will trip it up. Personal preference to invest the time in getting it working ahead of Gradle fully supporting all use cases.
c
In ephemeral CI it works fine, even if it requires to copy some folders. Obviously there are some issues (for example included build or buildSrc breaks CC unless you build them again)
s
But I do have all these checkboxes checked 1. Absolute path to the root project dir is the same between runs. 2. Job variables captured by build are consistent, otherwise I wouldn’t be able to get to
Reusing configuration cache.
stage in the first place. 3. I don’t have included builds/buildSrc (build logic is supplied via artifacts)
Maybe there are some hacks within gradle-build-action, that I miss?
Maybe you are hitting the reason for:
```This removes the chance of having a configuration-cache entry restored that is
incompatible with the restored Gradle User Home state, and makes the logic easier
to understand.```
Just guessing though
c
Btw I said you need to copy some folders, that class not found is because of that
But don't ask me right now which folder I'm referring to (I'm in a team gathering)
c
gradle-build-action code implies that Gradle User Home must also be restored from cache:
/**
* Handle the case where Gradle User Home has not been fully restored, so that the configuration-cache
* entry is not reusable.
*/
☝️ 2
s
Thanks to everyone for the help, doing a little digging into my setup with the longer and separately living dependencies cache + conditional dependencies substitution I identified few problems, fixed them and now have successfully enabled CC in CI 🙏
❤️ 3