You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Gradle cache doesn't work when the same project is cloned to different location as the file inputs declared using InputFile are not declared with @PathSensitive(PathSensitivity.RELATIVE).
Steps to Reproduce
In our project we use graphqlQueryIntrospectionResultPath to generate java classes. Every time when the developers creates new feature branch, GraphQL classes are regenerated even when introspection result file hasn't changed. On debugging the cache computation noticed that most of the input files are not marked with relative path sensitivity.
when built from original cloned folder the cache key is computed as below
Appending input file fingerprints for 'graphqlQueryIntrospectionResultPath' to build cache key: 2dd0b667193a08224bb85235c5be67b2 - ABSOLUTE_PATH{/Users/xxxxx/Projects/service-a/graphql-client/src/main/resources/graphql/introspection-result.json='/Users/xxxxx/Projects/service-a/graphql-client//src/main/resources/graphql/introspection-result.json' / 71e1b7cce6d99cbeefb868790c467850}
the same code built from another folder result in different cache key
Appending input file fingerprints for 'graphqlQueryIntrospectionResultPath' to build cache key: 87d2d3337b15ca3b875538b6b9a17ab1 - ABSOLUTE_PATH{/Users/xxxxxyyy/Projects/service-a/graphql-client//src/main/resources/graphql/introspection-result.json='/Users/xxxxxyyy/Projects/service-a/graphql-client//src/main/resources/graphql/introspection-result.json' / 71e1b7cce6d99cbeefb868790c467850}
Expected Result
If the introspection result hasn't changed the classes should be used from the cache rather than being generated
Actual Result
Classes are regenerated every time the source code is cloned into different folder. This adds additional time to builds on CI server as each feature branch are cloned to different folders.
itsnagaraj
changed the title
[Short Description]
Gradle cache doesn't work when the same project is cloned to different location and graphqlCodegen task is executed
Feb 6, 2024
I just ran into this myself and it is even worse:
This bug results in the whole gradle build being unable to utilize the gradle build cache, because the @Generated annotation contains a timestamp per default. That makes the builds not reproducible as all following cache keys change.
I worked around this by setting addGeneratedAnnotation = false so the output is identical and subsequent gradle task can compute the same cache key.
Issue Description
Gradle cache doesn't work when the same project is cloned to different location as the file inputs declared using InputFile are not declared with
@PathSensitive(PathSensitivity.RELATIVE)
.Steps to Reproduce
In our project we use
graphqlQueryIntrospectionResultPath
to generate java classes. Every time when the developers creates new feature branch, GraphQL classes are regenerated even when introspection result file hasn't changed. On debugging the cache computation noticed that most of the input files are not marked with relative path sensitivity.when built from original cloned folder the cache key is computed as below
the same code built from another folder result in different cache key
Expected Result
If the introspection result hasn't changed the classes should be used from the cache rather than being generated
Actual Result
Classes are regenerated every time the source code is cloned into different folder. This adds additional time to builds on CI server as each feature branch are cloned to different folders.
Your Environment and Setup
The text was updated successfully, but these errors were encountered: