A difference in KSP task `classpathStructure` inpu...
# caching
g
A difference in KSP task
classpathStructure
input was found to be the main local-local cache miss in a project. Has anyone encountered this? Any ideas on how to find what the actual difference is between builds?
i
It's the only difference shown in the build scan comparison?
g
Hi! It's the "root" difference. This is from exp. 2 of build-validation-scripts (local-local, caching same location), so same commit on both builds, etc. Other than this, differences only on some custom values we log in build scans (GC time, things like that)
i
what's the version for Ksp and Kotlin, I will try to reproduce it locally
g
Thank you! We're on Kotlin 2.0.0 and KSP 2.0.0-1.0.22. I couldn't find anything of relevance in later release notes of either plugin.
@Inaki Villar In the logging of a
@Classpath
-annotated
ConfigurableFileCollection
input, do you happen to know what the hash after each file is? The one after " / " in the end
Copy code
Appending input file fingerprints for 'classpathSnapshotProperties.classpathSnapshot' to build cache key: 324da4c69283103d2fe03508e60e6db6 - CLASSPATH{/Users/gabrielfeo2/.gradle/caches/8.8/transforms/12679143162a17ea33fc81707e533d86/transformed/R_jar-snapshot.bin=IGNORED / 80e215ef46218de1a44229cfa725909c, [...]
The exact input property is this. Re-running with
-Dorg.gradle.caching.debug=true
, I found that all the paths reported by Develocity as different on that input, have the same hash after " / ". I also found that other elements (not reported as different) have the same hash (images). But I haven't figured out what the hash stands for yet
i
I was not able to reproduce it with nowinandroid aligning versions. But that's something that I saw recently in other build scans. I continue the investigation. if I'm not wrong this hash represents the fingerprinting input. We will confirm with the team
g
Good to know I’m not alone šŸ˜… This is a large project, so there was a fat chance of being something specific to us
i
one more question about the experiment 2 showing the differences: can you check what's the outcome for the transforms: • ClasspathEntrySnapshotTransform • BuildToolsApiClasspathEntrySnapshotTransform in both builds? (Performance > Transform Execution)
g
Despite not knowing what the hashes mean, I was able to narrow it down one of the transforms that was different. Out of the image before, there was 1 for an "internal.jar" input and 1 for a "public.jar" that were executed with a different output in the 2nd build. There were other transforms of a "public.jar" re-executed, but only one of an "internal.jar" šŸ™ŒšŸ». Based on this transform, it might be related to empty projects. The one of "internal.jar" has no src. I also realized that "public/internal.jar" is the de facto "name" of the subproject, like "featureexample:public" šŸ¤¦šŸ»ā€ā™‚ļø . So I should be able to find the other changed transform, "public.jar", by renaming the projects. PS: In Develocity UI, I couldn't search transforms by input name, but using the API I was able to find them easily
i
looks like that this is the issue, can you confirm after renaming you don't observe task differences? After looking for similar issues, I found a case with another customer where the difference was in the
kapt
task, but the input was the same:
classpathSnapshotProperties.classpathSnapshot
. In that instance, the problem was that the modularized project contained different modules named "foo," such as "corefoo," "featurefoo", ":foo" and so on. The build scan comparison identified the "foo" snapshot bin as the source of the differences. After they fixed the naming the differences disappeared
g
Hi, @Inaki Villar! I can confirm that either • renaming each project to a unique name, or • deleting the projects can fix the cache misses. I tested both separately. I also couldn't reproduce it in isolation so far, but I'll try a bit more.
By the way, we see no differences by/in tasks of other projects that have repeated names, only in projects with repeated names that have no source. There's probably some other factor though, as I couldn't reproduce the issue with that alone. Since I can't provide a reproducer, I don't think it's worth an issue
i
Thanks for the detailed investigation Gabriel, I was not able to reproduce it locally, it's the second time we have seen this issue with project names and
classpathSnapshotProperties.classpathSnapshot
will inform the team internally
šŸ™‚ 1