Skip to content

Commit

Permalink
Update to Gradle 8.12 (#1028)
Browse files Browse the repository at this point in the history
  • Loading branch information
wmdietl authored Dec 22, 2024
1 parent 84f02e8 commit ab0a9e7
Show file tree
Hide file tree
Showing 7 changed files with 125 additions and 121 deletions.
84 changes: 46 additions & 38 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ apply plugin: 'de.undercouch.download'

// There is another `repositories { ... }` block below; if you change this one, change that one as well.
repositories {
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/'}
maven { url = 'https://oss.sonatype.org/content/repositories/snapshots/'}
mavenCentral()
}

Expand Down Expand Up @@ -115,7 +115,7 @@ task setLocalRepo(type:Exec) {

// No group so it does not show up in the output of `gradlew tasks`
task installGitHooks(type: Copy, dependsOn: 'setLocalRepo') {
description 'Copies git hooks to .git directory'
description = 'Copies git hooks to .git directory'
from files('checker/bin-devel/git.post-merge', 'checker/bin-devel/git.pre-commit')
rename('git\\.(.*)', '$1')
into localRepo + '/hooks'
Expand Down Expand Up @@ -158,7 +158,7 @@ allprojects {
// * any new checkers have been added, or
// * backward-incompatible changes have been made to APIs or elsewhere.
// To make a snapshot release: ./gradlew publish
version '3.42.0-eisop6-SNAPSHOT'
version = '3.42.0-eisop6-SNAPSHOT'

tasks.withType(JavaCompile).configureEach {
options.fork = true
Expand All @@ -170,11 +170,11 @@ allprojects {
apply plugin: 'de.undercouch.download'
apply plugin: 'net.ltgt.errorprone'

group 'io.github.eisop'
group = 'io.github.eisop'

// Keep in sync with "repositories { ... }" block above.
repositories {
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/'}
maven { url = 'https://oss.sonatype.org/content/repositories/snapshots/'}
mavenCentral()
}

Expand Down Expand Up @@ -352,6 +352,7 @@ allprojects {

dependsOn(':checker:shadowJar')
dependsOn(":framework-test:${tagletVersion}Classes")

doFirst {
options.encoding = 'UTF-8'
if (!name.equals('javadocDoclintAll')) {
Expand Down Expand Up @@ -558,7 +559,7 @@ allprojects {
} // end allProjects

task version(group: 'Documentation') {
description 'Print Checker Framework version'
description = 'Print Checker Framework version'
doLast {
println version
}
Expand All @@ -575,8 +576,8 @@ task version(group: 'Documentation') {
*/
def createCheckTypeTask(projectName, taskName, checker, args = []) {
project("${projectName}").tasks.create(name: "check${taskName}", type: JavaCompile, dependsOn: ':checker:shadowJar') {
description "Run the ${taskName} Checker on the main sources."
group 'Verification'
description = "Run the ${taskName} Checker on the main sources."
group = 'Verification'
// Always run the task.
outputs.upToDateWhen { false }
source = project("${projectName}").sourceSets.main.java
Expand Down Expand Up @@ -616,7 +617,7 @@ def createCheckTypeTask(projectName, taskName, checker, args = []) {
}

task htmlValidate(type: Exec, group: 'Format') {
description 'Validate that HTML files are well-formed'
description = 'Validate that HTML files are well-formed'
executable 'html5validator'
args = [
'--ignore',
Expand Down Expand Up @@ -684,7 +685,7 @@ task allJavadoc(type: Javadoc, group: 'Documentation') {
into "${rootDir}/docs/api"
}
injected.execOps.exec {
workingDir "${rootDir}/docs/api"
workingDir file("${rootDir}/docs/api")
executable "${htmlToolsHome}/html-add-favicon"
args += [
'.',
Expand Down Expand Up @@ -747,18 +748,19 @@ def createJavadocTask(taskName, taskDescription, memberLevel) {
createJavadocTask('javadocDoclintAll', 'Runs javadoc with -Xdoclint:all option.', JavadocMemberLevel.PRIVATE)

task manual(group: 'Documentation') {
description 'Build the manual'
description = 'Build the manual'
def injected = project.objects.newInstance(InjectedExecOps)
doLast {
injected.execOps.exec {
commandLine 'make', '-C', 'docs/manual', 'all'
workingDir = file('docs/manual')
commandLine 'make', 'all'
}
}
}

// No group so it does not show up in the output of `gradlew tasks`
task downloadJtreg(type: Download) {
description "Downloads and unpacks jtreg."
description = 'Downloads and unpacks jtreg.'
onlyIf { !(new File("${jtregHome}/lib/jtreg.jar").exists()) }
// src 'https://ci.adoptopenjdk.net/view/Dependencies/job/jtreg/lastSuccessfulBuild/artifact/jtreg-4.2.0-tip.tar.gz'
// If ci.adoptopenjdk.net is down, use this copy.
Expand Down Expand Up @@ -795,7 +797,7 @@ task downloadJtreg(type: Download) {
void clone(url, directory, ignoreError, extraArgs = []){
def injected = project.objects.newInstance(InjectedExecOps)
injected.execOps.exec {
workingDir "${directory}/../"
workingDir file("${directory}/../")
executable 'git'
args = [
'clone',
Expand All @@ -806,8 +808,9 @@ void clone(url, directory, ignoreError, extraArgs = []){
]
args += extraArgs
ignoreExitValue = ignoreError
timeout = 60000 // 60 seconds
}
// TODO: not sure this does what it is supposed to.
// timeout = Duration.ofSeconds(60)
}

/**
Expand All @@ -822,7 +825,7 @@ void clone(url, directory, ignoreError, extraArgs = []){
*/
def createCloneTask(taskName, url, directory, extraArgs = []) {
tasks.create(name: taskName) {
description "Obtain or update ${url}"
description = "Obtain or update ${url}"

// Always run.
outputs.upToDateWhen { false }
Expand All @@ -832,12 +835,13 @@ def createCloneTask(taskName, url, directory, extraArgs = []) {
doLast {
if (file(directory).exists()) {
injected.execOps.exec {
workingDir directory
workingDir file(directory)
executable 'git'
args = ['pull', '-q']
ignoreExitValue = true
timeout = 60000 // 60 seconds
}
// TODO: not sure this does what it is supposed to.
// timeout = Duration.ofSeconds(60)
} else {
try {
clone(url, directory, true, extraArgs)
Expand All @@ -864,14 +868,14 @@ createCloneTask('getDoLikeJavac', 'https://github.com/opprop/do-like-javac.git',

// No group so it does not show up in the output of `gradlew tasks`
task pythonIsInstalled(type: Exec) {
description 'Check that the python3 executable is installed.'
description = 'Check that the python3 executable is installed.'
executable = 'python3'
args '--version'
}

task tags {
group 'Emacs'
description 'Create Emacs TAGS table'
group = 'Emacs'
description = 'Create Emacs TAGS table'

def injected = project.objects.newInstance(InjectedExecOps)

Expand Down Expand Up @@ -951,7 +955,7 @@ subprojects {

if (!project.name.startsWith('checker-qual-android')) {
task tags(type: Exec) {
description 'Create Emacs TAGS table'
description = 'Create Emacs TAGS table'
commandLine 'bash', '-c', "find . \\( -name build -o -name jtreg -o -name tests \\) -prune -o -name '*.java' -print | sort-directory-order | xargs ctags -e -f TAGS"
}
}
Expand Down Expand Up @@ -1039,7 +1043,7 @@ subprojects {
// Add jtregTests to framework and checker modules
if (project.name.is('framework') || project.name.is('checker')) {
tasks.create(name: 'jtregTests', group: 'Verification') {
description 'Run the jtreg tests.'
description = 'Run the jtreg tests.'

if (currentRuntimeJavaVersion < 11) {
// jtreg only works on JDK 11+
Expand All @@ -1053,9 +1057,13 @@ subprojects {

def injected = project.objects.newInstance(InjectedExecOps)

def isFramework = project.name.is('framework')
def isChecker = project.name.is('checker')

String jtregOutput = "${buildDir}/jtreg"
String name = 'all'
String tests = '.'

doLast {
try {
injected.execOps.exec {
Expand Down Expand Up @@ -1089,12 +1097,12 @@ subprojects {
'-vmoptions:--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED',
'-vmoptions:--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED',
]
if (project.name.is('framework')) {
if (isFramework) {
// Do not check for the annotated JDK
args += [
'-javacoptions:-ApermitMissingJdk'
]
} else if (project.name.is('checker')) {
} else if (isChecker) {
args += [
"-javacoptions:-classpath ${sourceSets.testannotations.output.asPath}",
]
Expand Down Expand Up @@ -1126,7 +1134,7 @@ subprojects {
sourceSets.test.allJava.filter {it.path.matches('.*test[\\\\/]junit.*')}.forEach { file ->
String junitClassName = file.name.replaceAll('.java', '')
tasks.create(name: "${junitClassName}", type: Test) {
description "Run ${junitClassName} tests."
description = "Run ${junitClassName} tests."
include "**/${name}.class"
testClassesDirs = testing.suites.test.sources.output.classesDirs
classpath = testing.suites.test.sources.runtimeClasspath
Expand Down Expand Up @@ -1157,7 +1165,7 @@ subprojects {
outputs.upToDateWhen { false }

// Show the found unexpected diagnostics and expected diagnostics not found.
exceptionFormat 'full'
exceptionFormat = 'full'
events 'failed'

// Don't show the uninteresting stack traces from the exceptions.
Expand All @@ -1181,7 +1189,7 @@ subprojects {

// Create a nonJunitTests task per project
tasks.create(name: 'nonJunitTests', group: 'Verification') {
description 'Run all Checker Framework tests except for the JUnit tests and inference tests.'
description = 'Run all Checker Framework tests except for the JUnit tests and inference tests.'
if (project.name.is('framework') || project.name.is('checker')) {
dependsOn('jtregTests')
}
Expand All @@ -1203,21 +1211,21 @@ subprojects {

// Create an inferenceTests task per project
tasks.create(name: 'inferenceTests', group: 'Verification') {
description 'Run inference tests.'
description = 'Run inference tests.'
if (project.name.is('checker')) {
// NO-AFU: Needs to depend on future AFU version of CF
// dependsOn('inferenceTests-part1', 'inferenceTests-part1')
}
}
tasks.create(name: 'inferenceTests-part1', group: 'Verification') {
description 'Run inference tests (part 1).'
description = 'Run inference tests (part 1).'
if (project.name.is('checker')) {
// NO-AFU: Needs to depend on future AFU version of CF
// dependsOn('ainferTest', 'wpiManyTest')
}
}
tasks.create(name: 'inferenceTests-part2', group: 'Verification') {
description 'Run inference tests (part 2).'
description = 'Run inference tests (part 2).'
if (project.name.is('checker')) {
// NO-AFU: Needs to depend on future AFU version of CF
// dependsOn('wpiPlumeLibTest')
Expand All @@ -1228,15 +1236,15 @@ subprojects {
// This isn't a test of the Checker Framework as the test and nonJunitTests tasks are.
// Tasks such as 'checkInterning' are constructed by createCheckTypeTask.
tasks.create(name: 'typecheck', group: 'Verification') {
description 'Run the Checker Framework on itself'
description = 'Run the Checker Framework on itself'
dependsOn('typecheck-part1', 'typecheck-part2')
}
tasks.create(name: 'typecheck-part1', group: 'Verification') {
description 'Run the Checker Framework on itself (part 1)'
description = 'Run the Checker Framework on itself (part 1)'
dependsOn('checkFormatter', 'checkInterning', 'checkOptional', 'checkPurity')
}
tasks.create(name: 'typecheck-part2', group: 'Verification') {
description 'Run the Checker Framework on itself (part 2)'
description = 'Run the Checker Framework on itself (part 2)'
dependsOn('checkResourceLeak', 'checkSignature')
if (project.name.is('framework') || project.name.is('checker')) {
dependsOn('checkCompilerMessages')
Expand All @@ -1247,7 +1255,7 @@ subprojects {
// Create an allTests task per project.
// allTests = test + nonJunitTests + inferenceTests + typecheck
tasks.create(name: 'allTests', group: 'Verification') {
description 'Run all Checker Framework tests'
description = 'Run all Checker Framework tests'
// The 'test' target is just the JUnit tests.
dependsOn('test', 'nonJunitTests', 'inferenceTests', 'typecheck')
}
Expand All @@ -1273,7 +1281,7 @@ assemble.dependsOn(':checker:assembleForJavac')
assemble.mustRunAfter(clean)

task buildAll(group: 'Build') {
description 'Build all jar files, including source and javadoc jars'
description = 'Build all jar files, including source and javadoc jars'
dependsOn(allJavadoc)
subprojects { Project subproject ->
dependsOn("${subproject.name}:assemble")
Expand All @@ -1284,7 +1292,7 @@ task buildAll(group: 'Build') {
}

task releaseBuild(group: 'Build') {
description 'Build everything required for a release'
description = 'Build everything required for a release'
dependsOn(clean)
doFirst {
release = true
Expand All @@ -1296,7 +1304,7 @@ task releaseBuild(group: 'Build') {

// No group so it does not show up in the output of `gradlew tasks`
task releaseAndTest {
description 'Build everything required for a release and run allTests'
description = 'Build everything required for a release and run allTests'
dependsOn(releaseBuild)
subprojects { Project subproject ->
dependsOn("${subproject.name}:allTests")
Expand Down
2 changes: 1 addition & 1 deletion checker-qual-android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
evaluationDependsOn(':checker-qual')

task copySources(type: Copy) {
description 'Copy checker-qual source to checker-qual-android'
description = 'Copy checker-qual source to checker-qual-android'
includeEmptyDirs = false
doFirst {
// Delete the directory in case a previously copied file should no longer be in checker-qual
Expand Down
Loading

0 comments on commit ab0a9e7

Please sign in to comment.