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

Update to Gradle 8.12 #215

Merged
merged 3 commits into from
Dec 26, 2024
Merged
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
15 changes: 12 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ if (jspecify != null) {
assemble.dependsOn(jspecify.task(':assemble'))
}

// Enable exec/javaexec
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm happy for suggestions for how to do this in a nicer way... The upgrade instructions didn't really help me a lot.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sadly but unsurprisingly, I'm clueless. Now that I know to look for ExecOperations, I see gradle/gradle#30822, which seems encouraging, I think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, here I was doing the right (oddly verbose) thing but in settings.gradle I wasn't actually executing the task. Now it both compiles and seems to do the right thing.

interface InjectedExecOps {
@Inject
ExecOperations getExecOps()
}

tasks.withType(JavaCompile).configureEach {
options.compilerArgs.add("-Xlint:all")
// ErrorProne makes suppressing these easier
Expand Down Expand Up @@ -146,6 +152,8 @@ tasks.register('includeJSpecifyJDK') {
inputs.dir file(srcDir)
outputs.dir file(dstDir)

def injected = project.objects.newInstance(InjectedExecOps)

doLast {
FileTree srcTree = fileTree(dir: srcDir)
NavigableSet<String> specFiles = new TreeSet<>();
Expand All @@ -168,7 +176,7 @@ tasks.register('includeJSpecifyJDK') {
include specFile.substring(srcPrefixSize)
}
}
javaexec {
injected.execOps.javaexec {
classpath = sourceSets.main.runtimeClasspath
standardOutput = System.out
errorOutput = System.err
Expand Down Expand Up @@ -202,7 +210,7 @@ tasks.withType(Test).configureEach {
showStackTraces = false
showStandardStreams = true
events "failed"
exceptionFormat "full"
exceptionFormat = "full"
}
}

Expand Down Expand Up @@ -293,10 +301,11 @@ if (checkerFramework != null) {
def cfQualJar =
checkerFramework.projectDir.toPath()
.resolve("checker-qual/build/libs/checker-qual-${libs.versions.checkerFramework.get()}.jar")
def injected = project.objects.newInstance(InjectedExecOps)

if (!cfQualJar.toFile().exists()) {
mkdir(cfQualJar.parent)
exec {
injected.execOps.exec {
executable 'jar'
args = [
'cf',
Expand Down
4 changes: 2 additions & 2 deletions conformance-test-framework/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ plugins {
id 'java-library'
}

group 'org.jspecify.conformance'
version '0.0.0-SNAPSHOT'
group = 'org.jspecify.conformance'
version = '0.0.0-SNAPSHOT'

repositories {
mavenCentral()
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
3 changes: 1 addition & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
4 changes: 2 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ include 'conformance-test-framework'
// See https://docs.gradle.org/current/userguide/composite_builds.html#included_build_declaring_substitutions
includeBuild(".")

exec {
providers.exec {
executable './initialize-project'
}
}.result.get()

dependencyResolutionManagement {
versionCatalogs {
Expand Down
Loading