From 938ab8462dbe8d36380e813081c5d12429439a3e Mon Sep 17 00:00:00 2001 From: Aosen Xiong Date: Tue, 3 Sep 2024 21:14:10 -0400 Subject: [PATCH 1/3] Use `layout.buildDirectory` to replace deprecated `builddir` --- build.gradle | 6 +++--- checker/build.gradle | 16 ++++++++-------- dataflow/build.gradle | 2 +- framework/build.gradle | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index eec1d1000f9..5dda8f59640 100644 --- a/build.gradle +++ b/build.gradle @@ -570,7 +570,7 @@ def createCheckTypeTask(projectName, taskName, checker, args = []) { outputs.upToDateWhen { false } source = project("${projectName}").sourceSets.main.java classpath = files(project("${projectName}").compileJava.classpath,project(':checker-qual').sourceSets.main.output) - destinationDirectory = file("${buildDir}") + destinationDirectory = file("${layout.buildDirectory}") options.annotationProcessorPath = files(project(':checker').tasks.shadowJar.archiveFile) options.compilerArgs += [ @@ -740,7 +740,7 @@ task downloadJtreg(type: Download) { // dest new File(buildDir, 'jtreg-4.2.0-tip.tar.gz') // src 'https://builds.shipilev.net/jtreg/jtreg4.2-b16.zip' src 'https://builds.shipilev.net/jtreg/jtreg-6.2%2B1.zip' - dest new File(buildDir, 'jtreg.zip') + dest new File(layout.buildDirectory.get().asFile, 'jtreg.zip') overwrite true retries 3 doLast { @@ -1003,7 +1003,7 @@ subprojects { dependsOn('compileTestJava') dependsOn('shadowJar') - String jtregOutput = "${buildDir}/jtreg" + String jtregOutput = "${layout.buildDirectory}/jtreg" String name = 'all' String tests = '.' doLast { diff --git a/checker/build.gradle b/checker/build.gradle index ef5b2799584..4e32e0c4743 100644 --- a/checker/build.gradle +++ b/checker/build.gradle @@ -249,9 +249,9 @@ clean { } clean.doLast { - while (buildDir.exists()) { + while (layout.buildDirectory.exists()) { sleep(10000) // wait 10 seconds - buildDir.deleteDir() + layout.buildDirectory.deleteDir() } } @@ -355,7 +355,7 @@ task jtregJdk11Tests(dependsOn: ':downloadJtreg', group: 'Verification') { dependsOn('compileTestJava') dependsOn('shadowJar') - String jtregOutput = "${buildDir}/jtregJdk11" + String jtregOutput = "${layout.buildDirectory}/jtregJdk11" String name = 'all' doLast { if (isJava8) { @@ -442,7 +442,7 @@ task ainferTestCheckerGenerateStubs(type: Test) { dependsOn(compileTestJava) doFirst { delete('tests/ainfer-testchecker/annotated') - delete("${buildDir}/ainfer-testchecker/") + delete("${layout.buildDirectory}/ainfer-testchecker/") } outputs.upToDateWhen { false } include '**/AinferTestCheckerStubsGenerationTest.class' @@ -501,7 +501,7 @@ task ainferTestCheckerGenerateAjava(type: Test) { dependsOn(compileTestJava) doFirst { delete('tests/ainfer-testchecker/annotated') - delete("${buildDir}/ainfer-testchecker/") + delete("${layout.buildDirectory}/ainfer-testchecker/") } outputs.upToDateWhen { false } include '**/AinferTestCheckerAjavaGenerationTest.class' @@ -705,7 +705,7 @@ task ainferIndexGenerateAjava(type: Test) { dependsOn(compileTestJava) doFirst { delete('tests/ainfer-index/annotated') - delete("${buildDir}/ainfer-index/") + delete("${layout.buildDirectory}/ainfer-index/") } outputs.upToDateWhen { false } include '**/AinferIndexAjavaGenerationTest.class' @@ -751,7 +751,7 @@ task ainferNullnessGenerateAjava(type: Test) { dependsOn(compileTestJava) doFirst { delete('tests/ainfer-nullness/annotated') - delete("${buildDir}/ainfer-nullness/") + delete("${layout.buildDirectory}/ainfer-nullness/") } outputs.upToDateWhen { false } include '**/AinferNullnessAjavaGenerationTest.class' @@ -797,7 +797,7 @@ task ainferResourceLeakGenerateAjava(type: Test) { dependsOn(compileTestJava) doFirst { delete('tests/ainfer-resourceleak/annotated') - delete("${buildDir}/ainfer-resourceleak/") + delete("${layout.buildDirectory}/ainfer-resourceleak/") } outputs.upToDateWhen { false } include '**/AinferResourceLeakAjavaGenerationTest.class' diff --git a/dataflow/build.gradle b/dataflow/build.gradle index f7dd7424c4b..e0b097d4a19 100644 --- a/dataflow/build.gradle +++ b/dataflow/build.gradle @@ -41,7 +41,7 @@ def createDataflowShaded(shadedPkgName) { from shadowJar.source configurations = shadowJar.configurations - destinationDirectory = file("${buildDir}/shadow/dataflow${shadedPkgName}") + destinationDirectory = file("${layout.buildDirectory}/shadow/dataflow${shadedPkgName}") relocate('org.checkerframework', "org.checkerframework.${shadedPkgName}") { diff --git a/framework/build.gradle b/framework/build.gradle index 68233f95179..aa247372605 100644 --- a/framework/build.gradle +++ b/framework/build.gradle @@ -114,7 +114,7 @@ task cloneAnnotatedJdk() { task copyAndMinimizeAnnotatedJdkFiles(dependsOn: cloneAnnotatedJdk, group: 'Build') { dependsOn ':framework:compileJava', project(':javacutil').tasks.jar def inputDir = "${annotatedJdkHome}/src" - def outputDir = "${buildDir}/generated/resources/annotated-jdk/" + def outputDir = "${layout.buildDirectory}/generated/resources/annotated-jdk/" description "Copy annotated JDK files to ${outputDir}. Removes private and package-private methods, method bodies, comments, etc. from the annotated JDK" From 696ac2accf9e7a2b0b36d2c24e08e785ed84b8d4 Mon Sep 17 00:00:00 2001 From: Aosen Xiong Date: Sat, 14 Dec 2024 14:28:15 -0800 Subject: [PATCH 2/3] Fix failure when running test cases --- build.gradle | 4 ++-- checker/build.gradle | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 827f3cd9391..6b5620a6966 100644 --- a/build.gradle +++ b/build.gradle @@ -766,7 +766,7 @@ task downloadJtreg(type: Download) { // dest new File(buildDir, 'jtreg-4.2.0-tip.tar.gz') // src 'https://builds.shipilev.net/jtreg/jtreg4.2-b16.zip' src 'https://builds.shipilev.net/jtreg/jtreg-7.5+1.zip' - dest new File(buildDir, 'jtreg.zip') + dest new File(layout.buildDirectory.asFile.get(), 'jtreg.zip') overwrite true retries 3 @@ -1053,7 +1053,7 @@ subprojects { def injected = project.objects.newInstance(InjectedExecOps) - String jtregOutput = "${buildDir}/jtreg" + String jtregOutput = "${layout.buildDirectory.get()}/jtreg" String name = 'all' String tests = '.' doLast { diff --git a/checker/build.gradle b/checker/build.gradle index a4e96c40c44..4565ec5346f 100644 --- a/checker/build.gradle +++ b/checker/build.gradle @@ -383,7 +383,7 @@ task jtregJdk11Tests(dependsOn: ':downloadJtreg', group: 'Verification') { def injected = project.objects.newInstance(InjectedExecOps) - String jtregOutput = "${buildDir}/jtregJdk11" + String jtregOutput = "${layout.buildDirectory.get()}/jtregJdk11" String name = 'all' doLast { From a14b2123c6706e625702ae46171d804e52e59350 Mon Sep 17 00:00:00 2001 From: Aosen Xiong Date: Sat, 14 Dec 2024 15:02:37 -0800 Subject: [PATCH 3/3] Use projectDir if buildDir is used as string --- build.gradle | 4 ++-- checker/build.gradle | 14 +++++++------- dataflow/build.gradle | 2 +- framework/build.gradle | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/build.gradle b/build.gradle index 6b5620a6966..03a95728473 100644 --- a/build.gradle +++ b/build.gradle @@ -581,7 +581,7 @@ def createCheckTypeTask(projectName, taskName, checker, args = []) { outputs.upToDateWhen { false } source = project("${projectName}").sourceSets.main.java classpath = files(project("${projectName}").compileJava.classpath,project(':checker-qual').sourceSets.main.output) - destinationDirectory = file("${layout.buildDirectory}") + destinationDirectory = file("${projectDir}/build") options.annotationProcessorPath = files(project(':checker').tasks.shadowJar.archiveFile) options.compilerArgs += [ @@ -1053,7 +1053,7 @@ subprojects { def injected = project.objects.newInstance(InjectedExecOps) - String jtregOutput = "${layout.buildDirectory.get()}/jtreg" + String jtregOutput = "${projectDir}/build/jtreg" String name = 'all' String tests = '.' doLast { diff --git a/checker/build.gradle b/checker/build.gradle index 4565ec5346f..5d00ca8504a 100644 --- a/checker/build.gradle +++ b/checker/build.gradle @@ -272,7 +272,7 @@ clean { } clean.doLast { - while (layout.buildDirectory.exists()) { + while (layout.buildDirectory.asFile.get().exists()) { sleep(10000) // wait 10 seconds layout.buildDirectory.deleteDir() } @@ -383,7 +383,7 @@ task jtregJdk11Tests(dependsOn: ':downloadJtreg', group: 'Verification') { def injected = project.objects.newInstance(InjectedExecOps) - String jtregOutput = "${layout.buildDirectory.get()}/jtregJdk11" + String jtregOutput = "${projectDir}/build/jtregJdk11" String name = 'all' doLast { @@ -471,7 +471,7 @@ task ainferTestCheckerGenerateStubs(type: Test) { dependsOn(compileTestJava) doFirst { delete('tests/ainfer-testchecker/annotated') - delete("${layout.buildDirectory}/ainfer-testchecker/") + delete("${projectDir}/build/ainfer-testchecker/") } outputs.upToDateWhen { false } include '**/AinferTestCheckerStubsGenerationTest.class' @@ -530,7 +530,7 @@ task ainferTestCheckerGenerateAjava(type: Test) { dependsOn(compileTestJava) doFirst { delete('tests/ainfer-testchecker/annotated') - delete("${layout.buildDirectory}/ainfer-testchecker/") + delete("${projectDir}/build/ainfer-testchecker/") } outputs.upToDateWhen { false } include '**/AinferTestCheckerAjavaGenerationTest.class' @@ -736,7 +736,7 @@ task ainferIndexGenerateAjava(type: Test) { dependsOn(compileTestJava) doFirst { delete('tests/ainfer-index/annotated') - delete("${layout.buildDirectory}/ainfer-index/") + delete("${projectDir}/build/ainfer-index/") } outputs.upToDateWhen { false } include '**/AinferIndexAjavaGenerationTest.class' @@ -782,7 +782,7 @@ task ainferNullnessGenerateAjava(type: Test) { dependsOn(compileTestJava) doFirst { delete('tests/ainfer-nullness/annotated') - delete("${layout.buildDirectory}/ainfer-nullness/") + delete("${projectDir}/build/ainfer-nullness/") } outputs.upToDateWhen { false } include '**/AinferNullnessAjavaGenerationTest.class' @@ -828,7 +828,7 @@ task ainferResourceLeakGenerateAjava(type: Test) { dependsOn(compileTestJava) doFirst { delete('tests/ainfer-resourceleak/annotated') - delete("${layout.buildDirectory}/ainfer-resourceleak/") + delete("${projectDir}/build/ainfer-resourceleak/") } outputs.upToDateWhen { false } include '**/AinferResourceLeakAjavaGenerationTest.class' diff --git a/dataflow/build.gradle b/dataflow/build.gradle index 131d7120b5b..f063d560eb3 100644 --- a/dataflow/build.gradle +++ b/dataflow/build.gradle @@ -47,7 +47,7 @@ def createDataflowShaded(shadedPkgName) { from shadowJar.source configurations = shadowJar.configurations - destinationDirectory = file("${layout.buildDirectory}/shadow/dataflow${shadedPkgName}") + destinationDirectory = file("${projectDir}/build/shadow/dataflow${shadedPkgName}") relocate('org.checkerframework', "org.checkerframework.${shadedPkgName}") { diff --git a/framework/build.gradle b/framework/build.gradle index a8d805008cc..889cefb4a17 100644 --- a/framework/build.gradle +++ b/framework/build.gradle @@ -127,7 +127,7 @@ task cloneAnnotatedJdk() { task copyAndMinimizeAnnotatedJdkFiles(dependsOn: cloneAnnotatedJdk, group: 'Build') { dependsOn ':framework:compileJava', project(':javacutil').tasks.jar def inputDir = "${annotatedJdkHome}/src" - def outputDir = "${layout.buildDirectory}/generated/resources/annotated-jdk/" + def outputDir = "${projectDir}/build/generated/resources/annotated-jdk/" description "Copy annotated JDK files to ${outputDir}. Removes private and package-private methods, method bodies, comments, etc. from the annotated JDK"