Skip to content
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

Replace deprecated buildDir #898

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,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.get().asFile}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
destinationDirectory = file("${layout.buildDirectory.get().asFile}")
destinationDirectory = layout.buildDirectory.get().asFile

Wouldn't that already be a file?


options.annotationProcessorPath = files(project(':checker').tasks.shadowJar.archiveFile)
options.compilerArgs += [
Expand Down Expand Up @@ -769,7 +769,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')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference between asFile.get() and get().asFile used elsewhere?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't layout.buildDirectory.file('jtreg.zip').get().asFile be more idiomatic?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference between asFile.get() and get().asFile used elsewhere?

That's a good question. I will ask gradle people on slack. Looks like both of them return a file.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it doesn't matter, pick one ordering and consistently use it.

overwrite true
retries 3

Expand Down Expand Up @@ -1061,7 +1061,7 @@ subprojects {
def isFramework = project.name.is('framework')
def isChecker = project.name.is('checker')

String jtregOutput = "${buildDir}/jtreg"
String jtregOutput = "${layout.buildDirectory.get().asFile}/jtreg"
String name = 'all'
String tests = '.'

Expand Down
27 changes: 14 additions & 13 deletions checker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,9 @@ clean {
}

clean.doLast {
while (buildDir.exists()) {
while (layout.buildDirectory.asFile.get().exists()) {
sleep(10000) // wait 10 seconds
buildDir.deleteDir()
layout.buildDirectory.deleteDir()
}
}

Expand Down Expand Up @@ -383,7 +383,8 @@ task jtregJdk11Tests(dependsOn: ':downloadJtreg', group: 'Verification') {

def injected = project.objects.newInstance(InjectedExecOps)

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

String name = 'all'
doLast {
if (isJava8) {
Expand Down Expand Up @@ -470,7 +471,7 @@ task ainferTestCheckerGenerateStubs(type: Test) {
dependsOn(compileTestJava)
doFirst {
delete('tests/ainfer-testchecker/annotated')
delete("${buildDir}/ainfer-testchecker/")
delete("${layout.buildDirectory.get().asFile}/ainfer-testchecker/")
}
outputs.upToDateWhen { false }
include '**/AinferTestCheckerStubsGenerationTest.class'
Expand Down Expand Up @@ -529,7 +530,7 @@ task ainferTestCheckerGenerateAjava(type: Test) {
dependsOn(compileTestJava)
doFirst {
delete('tests/ainfer-testchecker/annotated')
delete("${buildDir}/ainfer-testchecker/")
delete("${layout.buildDirectory.get().asFile}/ainfer-testchecker/")
}
outputs.upToDateWhen { false }
include '**/AinferTestCheckerAjavaGenerationTest.class'
Expand Down Expand Up @@ -735,7 +736,7 @@ task ainferIndexGenerateAjava(type: Test) {
dependsOn(compileTestJava)
doFirst {
delete('tests/ainfer-index/annotated')
delete("${buildDir}/ainfer-index/")
delete("${layout.buildDirectory.get().asFile}/ainfer-index/")
}
outputs.upToDateWhen { false }
include '**/AinferIndexAjavaGenerationTest.class'
Expand Down Expand Up @@ -781,7 +782,7 @@ task ainferNullnessGenerateAjava(type: Test) {
dependsOn(compileTestJava)
doFirst {
delete('tests/ainfer-nullness/annotated')
delete("${buildDir}/ainfer-nullness/")
delete("${layout.buildDirectory.get().asFile}/ainfer-nullness/")
}
outputs.upToDateWhen { false }
include '**/AinferNullnessAjavaGenerationTest.class'
Expand Down Expand Up @@ -827,7 +828,7 @@ task ainferResourceLeakGenerateAjava(type: Test) {
dependsOn(compileTestJava)
doFirst {
delete('tests/ainfer-resourceleak/annotated')
delete("${buildDir}/ainfer-resourceleak/")
delete("${layout.buildDirectory.get().asFile}/ainfer-resourceleak/")
}
outputs.upToDateWhen { false }
include '**/AinferResourceLeakAjavaGenerationTest.class'
Expand Down Expand Up @@ -978,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 @@ -991,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 @@ -1069,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("${buildDir}/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 = "${buildDir}/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
Loading