Skip to content

Commit

Permalink
Use layout.buildDirectory.get().asFile to replace {projectDir}/build
Browse files Browse the repository at this point in the history
  • Loading branch information
Ao-senXiong committed Dec 27, 2024
1 parent a14b212 commit a3d52f3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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("${projectDir}/build")
destinationDirectory = file("${layout.buildDirectory.get().asFile}")

options.annotationProcessorPath = files(project(':checker').tasks.shadowJar.archiveFile)
options.compilerArgs += [
Expand Down Expand Up @@ -1053,7 +1053,7 @@ subprojects {

def injected = project.objects.newInstance(InjectedExecOps)

String jtregOutput = "${projectDir}/build/jtreg"
String jtregOutput = "${layout.buildDirectory.get().asFile}/jtreg"
String name = 'all'
String tests = '.'
doLast {
Expand Down
22 changes: 11 additions & 11 deletions checker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ task jtregJdk11Tests(dependsOn: ':downloadJtreg', group: 'Verification') {

def injected = project.objects.newInstance(InjectedExecOps)

String jtregOutput = "${projectDir}/build/jtregJdk11"
String jtregOutput = "${layout.buildDirectory.get().asFile}/jtregJdk11"

String name = 'all'
doLast {
Expand Down Expand Up @@ -471,7 +471,7 @@ task ainferTestCheckerGenerateStubs(type: Test) {
dependsOn(compileTestJava)
doFirst {
delete('tests/ainfer-testchecker/annotated')
delete("${projectDir}/build/ainfer-testchecker/")
delete("${layout.buildDirectory.get().asFile}/ainfer-testchecker/")
}
outputs.upToDateWhen { false }
include '**/AinferTestCheckerStubsGenerationTest.class'
Expand Down Expand Up @@ -530,7 +530,7 @@ task ainferTestCheckerGenerateAjava(type: Test) {
dependsOn(compileTestJava)
doFirst {
delete('tests/ainfer-testchecker/annotated')
delete("${projectDir}/build/ainfer-testchecker/")
delete("${layout.buildDirectory.get().asFile}/ainfer-testchecker/")
}
outputs.upToDateWhen { false }
include '**/AinferTestCheckerAjavaGenerationTest.class'
Expand Down Expand Up @@ -736,7 +736,7 @@ task ainferIndexGenerateAjava(type: Test) {
dependsOn(compileTestJava)
doFirst {
delete('tests/ainfer-index/annotated')
delete("${projectDir}/build/ainfer-index/")
delete("${layout.buildDirectory.get().asFile}/ainfer-index/")
}
outputs.upToDateWhen { false }
include '**/AinferIndexAjavaGenerationTest.class'
Expand Down Expand Up @@ -782,7 +782,7 @@ task ainferNullnessGenerateAjava(type: Test) {
dependsOn(compileTestJava)
doFirst {
delete('tests/ainfer-nullness/annotated')
delete("${projectDir}/build/ainfer-nullness/")
delete("${layout.buildDirectory.get().asFile}/ainfer-nullness/")
}
outputs.upToDateWhen { false }
include '**/AinferNullnessAjavaGenerationTest.class'
Expand Down Expand Up @@ -828,7 +828,7 @@ task ainferResourceLeakGenerateAjava(type: Test) {
dependsOn(compileTestJava)
doFirst {
delete('tests/ainfer-resourceleak/annotated')
delete("${projectDir}/build/ainfer-resourceleak/")
delete("${layout.buildDirectory.get().asFile}/ainfer-resourceleak/")
}
outputs.upToDateWhen { false }
include '**/AinferResourceLeakAjavaGenerationTest.class'
Expand Down Expand Up @@ -979,11 +979,11 @@ task wpiManyTest(group: 'Verification') {
outputs.upToDateWhen { false }

doFirst {
delete("${project.projectDir}/build/wpi-many-tests-results/")
delete("${layout.buildDirectory.get().asFile}/wpi-many-tests-results/")
// wpi-many.sh is run in skip mode so that logs are preserved, but
// we don't actually want to skip previously-failing tests when we
// re-run the tests locally.
delete fileTree("${project.projectDir}/build/wpi-many-tests") {
delete fileTree("${layout.buildDirectory.get().asFile}/wpi-many-tests") {
include '**/.cannot-run-wpi'
}
}
Expand All @@ -992,13 +992,13 @@ task wpiManyTest(group: 'Verification') {

doLast {
// Run wpi-many.sh
def typecheckFilesDir = "${project.projectDir}/build/wpi-many-tests-results/"
def typecheckFilesDir = "${layout.buildDirectory.get().asFile}/wpi-many-tests-results/"
try {
injected.execOps.exec {
environment CHECKERFRAMEWORK: "${projectDir}/.."
commandLine 'bin/wpi-many.sh',
'-i', "${project.projectDir}/tests/wpi-many/testin.txt",
'-o', "${project.projectDir}/build/wpi-many-tests",
'-o', "${layout.buildDirectory.get().asFile}/wpi-many-tests",
'-s',
'--',
'--checker', 'nullness,interning,lock,regex,signature,calledmethods,resourceleak',
Expand Down Expand Up @@ -1070,7 +1070,7 @@ task wpiManyTest(group: 'Verification') {

// check that WPI causes the expected builds to succeed
typecheckFiles.visit { FileVisitDetails details ->
def filename = "${project.projectDir}/build/wpi-many-tests-results/" + details.getName()
def filename = "${layout.buildDirectory.get().asFile}/wpi-many-tests-results/" + details.getName()
def file = details.getFile()
if (file.length() == 0) {
throw new GradleException('Failure: WPI produced empty typecheck file ' + filename)
Expand Down
2 changes: 1 addition & 1 deletion dataflow/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def createDataflowShaded(shadedPkgName) {
from shadowJar.source
configurations = shadowJar.configurations

destinationDirectory = file("${projectDir}/build/shadow/dataflow${shadedPkgName}")
destinationDirectory = file("${layout.buildDirectory.get().asFile}/shadow/dataflow${shadedPkgName}")


relocate('org.checkerframework', "org.checkerframework.${shadedPkgName}") {
Expand Down
2 changes: 1 addition & 1 deletion framework/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "${projectDir}/build/generated/resources/annotated-jdk/"
def outputDir = "${layout.buildDirectory.get().asFile}/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"

Expand Down

0 comments on commit a3d52f3

Please sign in to comment.