diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index bf065be55..cc75b785f 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: - java: [ '11', '17', '21' ] + java: [ '11', '17', '21', '23' ] steps: - uses: actions/checkout@v4 diff --git a/build.gradle b/build.gradle index 054782af8..9553f2780 100644 --- a/build.gradle +++ b/build.gradle @@ -13,7 +13,7 @@ plugins { id 'java-library' // To create a fat jar build/libs/...-all.jar, run: ./gradlew shadowJar - id 'com.github.johnrengelman.shadow' version '8.1.1' + id 'com.gradleup.shadow' version '8.3.5' // Error Prone linter id('net.ltgt.errorprone') version '4.1.0' @@ -24,13 +24,14 @@ plugins { repositories { mavenCentral() - maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } + maven { url = 'https://oss.sonatype.org/content/repositories/snapshots/' } } -ext.errorproneVersion = '2.31.0' - ext { + errorproneVersion = '2.36.0' isJava11orHigher = JavaVersion.current() >= JavaVersion.VERSION_11 + isJava17orHigher = JavaVersion.current() >= JavaVersion.VERSION_17 + isJava21orHigher = JavaVersion.current() >= JavaVersion.VERSION_21 } dependencies { @@ -39,9 +40,6 @@ dependencies { implementation 'org.apache.commons:commons-text:1.13.0' implementation 'org.plumelib:reflection-util:1.1.4' - compileOnly "com.google.errorprone:error_prone_annotations:${errorproneVersion}" - errorprone("com.google.errorprone:error_prone_core:${errorproneVersion}") - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.4' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' } @@ -94,7 +92,12 @@ if (isJava11orHigher) { } } -/// Error Prone linter +// Error Prone linter + +dependencies { + compileOnly "com.google.errorprone:error_prone_annotations:${errorproneVersion}" + errorprone("com.google.errorprone:error_prone_core:${errorproneVersion}") +} tasks.withType(JavaCompile).configureEach { // "-processing" avoids javac warning "No processor claimed any of these annotations". @@ -108,15 +111,16 @@ tasks.withType(JavaCompile).configureEach { disable('AnnotateFormatMethod') // Error Prone doesn't know about Checker Framework @FormatMethod disable('UseCorrectAssertInTests') // https://github.com/typetools/checker-framework/issues/3345 } + options.errorprone.enabled = isJava17orHigher } -/// Checker Framework pluggable type-checking +// Checker Framework pluggable type-checking apply plugin: 'org.checkerframework' if (true) { // Use the released version of the EISOP Checker Framework. - ext.checkerFrameworkVersion = '3.42.0-eisop3' + ext.checkerFrameworkVersion = '3.42.0-eisop5' } else { // To use a snapshot version of the EISOP Checker Framework. // TODO: Change the above test to false to use a snapshot. @@ -168,7 +172,7 @@ checkerFramework { ] } -/// Javadoc +// Javadoc // Turn Javadoc warnings into errors. javadoc { @@ -186,7 +190,7 @@ javadoc { check.dependsOn javadoc task javadocWeb(type: Javadoc) { - description 'Upload API documentation to website.' + description = 'Upload API documentation to website.' source = sourceSets.main.allJava destinationDir = file("/cse/web/research/plumelib/${project.name}/api") classpath = project.sourceSets.main.compileClasspath @@ -225,10 +229,10 @@ task requireJavadoc(type: JavaExec) { check.dependsOn requireJavadoc javadocWeb.dependsOn requireJavadoc -/// Emacs support +// Emacs support /* Make Emacs TAGS table */ task tags(type: Exec) { - description 'Run etags to create an Emacs TAGS table' + description = 'Run etags to create an Emacs TAGS table' commandLine 'bash', '-c', "find src/ -name '*.java' | sort | xargs etags" } diff --git a/gradle/mavencentral.gradle b/gradle/mavencentral.gradle index 702522e91..cfef2ccd2 100644 --- a/gradle/mavencentral.gradle +++ b/gradle/mavencentral.gradle @@ -1,9 +1,9 @@ // REQUIREMENTS to make a release: // * Your ~/.gradle/gradle.properties file must contain: -// ossrhUsername=YOUR_USER_NAME_HERE -// ossrhPassword=YOUR_PASSWORD_HERE +// SONATYPE_NEXUS_USERNAME=... +// SONATYPE_NEXUS_PASSWORD=... -// To make a release (run on any filesystem, except the last step): +// To make a release (run on any filesystem, except the `javadocWeb` step): // * git pull // * In ../build.gradle, ensure that "To use a snapshot version" is not enabled. // * Update the version number in ../README.md and in this file (multiple times in each). @@ -20,8 +20,11 @@ apply plugin: 'maven-publish' apply plugin: 'signing' -group 'org.plumelib' -version '2.0.3' +group = 'org.plumelib' +version = '2.0.3' +ext { + packageName = 'options' +} final isSnapshot = version.contains('SNAPSHOT') @@ -41,12 +44,12 @@ publishing { pom { name = 'Plume-lib Options' description = 'Command-line option processing for Java.' - url = 'https://github.com/plume-lib/options' + url = "https://github.com/plume-lib/${packageName}" scm { - connection = 'scm:git:git@github.com:plume-lib/options.git' - developerConnection = 'scm:git:git@github.com:plume-lib/options.git' - url = 'git@github.com:plume-lib/options.git' + connection = "scm:git:git@github.com:plume-lib/${packageName}.git" + developerConnection = "scm:git:git@github.com:plume-lib/${packageName}.git" + url = "git@github.com:plume-lib/${packageName}.git" } licenses { @@ -74,8 +77,8 @@ publishing { : project.properties.getOrDefault('RELEASE_REPOSITORY_URL', 'https://oss.sonatype.org/service/local/staging/deploy/maven2/') ) credentials { - username = project.properties.get('ossrhUsername') - password = project.properties.get('ossrhPassword') + username = project.properties.get('SONATYPE_NEXUS_USERNAME') + password = project.properties.get('SONATYPE_NEXUS_PASSWORD') } } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e2847c820..cea7a793a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index f5feea6d6..f3b75f3b0 100755 --- a/gradlew +++ b/gradlew @@ -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 diff --git a/src/main/java/org/plumelib/options/Options.java b/src/main/java/org/plumelib/options/Options.java index 662f1db51..72f914fde 100644 --- a/src/main/java/org/plumelib/options/Options.java +++ b/src/main/java/org/plumelib/options/Options.java @@ -374,7 +374,7 @@ class OptionInfo { /** * Long argument name. Uses '-' or '_' to separate words, depending on the value of {@link - * useDashes}. + * #useDashes}. */ String longName; diff --git a/src/main/java/org/plumelib/options/OptionsDoclet.java b/src/main/java/org/plumelib/options/OptionsDoclet.java index 9290e4422..1f43b7c69 100644 --- a/src/main/java/org/plumelib/options/OptionsDoclet.java +++ b/src/main/java/org/plumelib/options/OptionsDoclet.java @@ -242,9 +242,9 @@ public OptionsDoclet() { // this.options = options; } - /////////////////////////////////////////////////////////////////////////// - /// Doclet-specific methods - /// + // ////////////////////////////////////////////////////////////////////// + // Doclet-specific methods + // @Override public void init(Locale locale, Reporter reporter) { @@ -338,9 +338,9 @@ public boolean run(DocletEnvironment denv) { return OK; } - /////////////////////////////////////////////////////////////////////////// - /// Javadoc command-line options - /// + // ////////////////////////////////////////////////////////////////////// + // Javadoc command-line options + // // The doclet cannot use the Options class itself because Javadoc specifies its own way of // handling command-line arguments. @@ -588,9 +588,9 @@ private void printError(String msg) { reporter.print(Diagnostic.Kind.ERROR, msg); } - /////////////////////////////////////////////////////////////////////////// - /// File IO methods - /// + // ////////////////////////////////////////////////////////////////////// + // File IO methods + // /** * Write the output of this doclet to the correct file. @@ -685,9 +685,9 @@ private String newDocFileText() throws Exception { return b.toString(); } - /////////////////////////////////////////////////////////////////////////// - /// HTML and Javadoc processing methods - /// + // ////////////////////////////////////////////////////////////////////// + // HTML and Javadoc processing methods + // /** * Returns the fields defined by the given type. @@ -1143,9 +1143,9 @@ public Void visitSee(SeeTree node, StringBuilder sb) { } - /////////////////////////////////////////////////////////////////////////// - /// Signature string methods - /// + // ////////////////////////////////////////////////////////////////////// + // Signature string methods + // /** * Returns true if the given element kind is a type, i.e., a class, enum, interface, or annotation @@ -1190,9 +1190,9 @@ public static boolean isTypeElement(Element element) { } } - /////////////////////////////////////////////////////////////////////////// - /// Getters and Setters - /// + // ////////////////////////////////////////////////////////////////////// + // Getters and Setters + // /** * Returns true if the output format is Javadoc, false if the output format is HTML.