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 4 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 @@ -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("${buildDir}")
destinationDirectory = file("${projectDir}/build")
Copy link
Member

Choose a reason for hiding this comment

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

This is not the recommended fix suggested in https://docs.gradle.org/current/userguide/upgrading_version_8.html#project_builddir
Wouldn't it be nicer to use the suggested replacement?


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

def injected = project.objects.newInstance(InjectedExecOps)

String jtregOutput = "${buildDir}/jtreg"
String jtregOutput = "${projectDir}/build/jtreg"
String name = 'all'
String tests = '.'
doLast {
Expand Down
17 changes: 9 additions & 8 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 = "${projectDir}/build/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("${projectDir}/build/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("${projectDir}/build/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("${projectDir}/build/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("${projectDir}/build/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("${projectDir}/build/ainfer-resourceleak/")
}
outputs.upToDateWhen { false }
include '**/AinferResourceLeakAjavaGenerationTest.class'
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("${projectDir}/build/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 = "${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"

Expand Down
Loading