-
Notifications
You must be signed in to change notification settings - Fork 29
Enable the Gradle configuration cache #1362
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
base: master
Are you sure you want to change the base?
Changes from all commits
94d0fa6
a270387
3a568a8
a1d888c
8e8dc4e
03d391b
b41fe9a
ab7683f
0bc6604
b29932f
426e48a
716d3d4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -133,45 +133,43 @@ jar { | |||
| // This task differs from the `assemble` task in that it does not build Javadoc. | ||||
| // It is useful for those who only want to run `javac`. | ||||
| // checker.jar is copied to checker/dist/ when it is built by the shadowJar task. | ||||
| task assembleForJavac(dependsOn: shadowJar, group: 'Build') { | ||||
| task assembleForJavac(group: 'Build') { | ||||
| description = 'Builds or downloads jars required by CheckerMain and puts them in checker/dist/.' | ||||
| dependsOn 'copyCheckerQualJar' | ||||
| dependsOn 'copyCheckerUtilJar' | ||||
| dependsOn 'copyJavacJar' | ||||
| } | ||||
|
|
||||
| tasks.register('copyCheckerQualJar', Copy) { | ||||
| dependsOn ':checker-qual:jar' | ||||
|
||||
| dependsOn ':checker-qual:jar' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../../gradle.properties | ||
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../../gradle.properties | ||
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../../gradle.properties | ||
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../../gradle.properties | ||
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -97,18 +97,52 @@ tasks.register('cloneAnnotatedJdk', CloneTask) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| outputs.upToDateWhen { false } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| task copyAndMinimizeAnnotatedJdkFiles(type: JavaExec, dependsOn: cloneAnnotatedJdk, group: 'Build') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tasks.register('copyAnnotatedJdkFiles', Copy) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| dependsOn ':framework:cloneAnnotatedJdk' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def inputDir = "${annotatedJdkHome}/src" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def outputDir = "${buildDir}/generated/resources/annotated-jdk/" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputs.dir file(inputDir) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| outputs.dir file(outputDir) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| FileTree tree = fileTree(dir: inputDir) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| String absolutejdkHome = file(annotatedJdkHome).absolutePath | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| int jdkDirStringSize = absolutejdkHome.size() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| NavigableSet<String> annotatedForFiles = new TreeSet<>(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Populate `annotatedForFiles`. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tree.visit { FileVisitDetails fvd -> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!fvd.file.isDirectory() && fvd.file.name.matches('.*\\.java') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| && !fvd.file.path.contains('org/checkerframework')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fvd.getFile().readLines().any { line -> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (line.contains('@AnnotatedFor') || line.contains('org.checkerframework') || line.contains('org.jspecify')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| annotatedForFiles.add(fvd.file.absolutePath) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from(annotatedJdkHome) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| into(outputDir) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (String filename : annotatedForFiles) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| include filename.substring(jdkDirStringSize) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+109
to
+130
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| FileTree tree = fileTree(dir: inputDir) | |
| String absolutejdkHome = file(annotatedJdkHome).absolutePath | |
| int jdkDirStringSize = absolutejdkHome.size() | |
| NavigableSet<String> annotatedForFiles = new TreeSet<>(); | |
| // Populate `annotatedForFiles`. | |
| tree.visit { FileVisitDetails fvd -> | |
| if (!fvd.file.isDirectory() && fvd.file.name.matches('.*\\.java') | |
| && !fvd.file.path.contains('org/checkerframework')) { | |
| fvd.getFile().readLines().any { line -> | |
| if (line.contains('@AnnotatedFor') || line.contains('org.checkerframework') || line.contains('org.jspecify')) { | |
| annotatedForFiles.add(fvd.file.absolutePath) | |
| return true; | |
| } | |
| } | |
| } | |
| } | |
| from(annotatedJdkHome) | |
| into(outputDir) | |
| for (String filename : annotatedForFiles) { | |
| include filename.substring(jdkDirStringSize) | |
| from(annotatedJdkHome) | |
| into(outputDir) | |
| doFirst { | |
| String absolutejdkHome = file(annotatedJdkHome).absolutePath | |
| int jdkDirStringSize = absolutejdkHome.size() | |
| NavigableSet<String> annotatedForFiles = new TreeSet<>() | |
| FileTree tree = fileTree(dir: inputDir) | |
| // Populate `annotatedForFiles`. | |
| tree.visit { FileVisitDetails fvd -> | |
| if (!fvd.file.isDirectory() && fvd.file.name.matches('.*\\.java') | |
| && !fvd.file.path.contains('org/checkerframework')) { | |
| fvd.getFile().readLines().any { line -> | |
| if (line.contains('@AnnotatedFor') || line.contains('org.checkerframework') || line.contains('org.jspecify')) { | |
| annotatedForFiles.add(fvd.file.absolutePath) | |
| return true | |
| } | |
| } | |
| } | |
| } | |
| for (String filename : annotatedForFiles) { | |
| include filename.substring(jdkDirStringSize) | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
deletePreviousSourcestask performs a delete operation during the configuration phase (line 5), which violates configuration cache principles. The delete operation should be moved to the execution phase by wrapping it in adoFirstordoLastblock, or by making this a Delete task type instead of a generic task.