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

Conversation

Ao-senXiong
Copy link
Member

@Ao-senXiong
Copy link
Member Author

Okay, looks like more build logic is needed here.

@Ao-senXiong Ao-senXiong changed the title Use layout.buildDirectory to replace deprecated builddir Replace deprecated builddir Dec 14, 2024
@Ao-senXiong Ao-senXiong changed the title Replace deprecated builddir Replace deprecated buildDir Dec 14, 2024
@Ao-senXiong Ao-senXiong changed the title Replace deprecated buildDir Replace deprecated buildDir Dec 14, 2024
@Ao-senXiong Ao-senXiong requested a review from wmdietl December 14, 2024 23:53
@Ao-senXiong Ao-senXiong assigned wmdietl and unassigned Ao-senXiong Dec 14, 2024
Copy link
Member

@wmdietl wmdietl left a comment

Choose a reason for hiding this comment

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

Thanks for looking into this!

build.gradle Outdated
@@ -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?

@wmdietl wmdietl assigned Ao-senXiong and unassigned wmdietl Dec 20, 2024
@Ao-senXiong Ao-senXiong requested a review from wmdietl December 27, 2024 22:51
@Ao-senXiong Ao-senXiong assigned wmdietl and unassigned Ao-senXiong Dec 27, 2024
Copy link
Member

@wmdietl wmdietl left a comment

Choose a reason for hiding this comment

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

Thanks for looking into this update!

@@ -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?

@@ -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.

@wmdietl wmdietl assigned Ao-senXiong and unassigned wmdietl Dec 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants