diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 973e39e..0000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,14 +0,0 @@ -version: 2 -updates: -- package-ecosystem: gradle - directory: "/" - schedule: - interval: daily - open-pull-requests-limit: 10 - ignore: - - dependency-name: com.google.errorprone:javac - versions: - - 1.8.0-u20 - - dependency-name: org.checkerframework - versions: - - 0.5.18 diff --git a/.github/renovate.json b/.github/renovate.json new file mode 100644 index 0000000..090f465 --- /dev/null +++ b/.github/renovate.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:base", + ":automergeAll", + ":automergeRequireAllStatusChecks", + "schedule:nonOfficeHours", + ":disableDependencyDashboard" + ], + "timezone": "America/Los_Angeles" +} diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index a165171..2683a82 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -9,15 +9,18 @@ jobs: strategy: matrix: - java: [ '8', '11', '17', '19' ] + java: [ '11', '17', '21' ] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up JDK - uses: actions/setup-java@v1 + uses: actions/setup-java@v3 with: + distribution: 'temurin' java-version: ${{ matrix.java }} - name: ./gradlew build javadoc run: ./gradlew build - name: ./gradlew requireJavadoc run: ./gradlew requireJavadoc + - name: ./gradlew spotlessCheck + run: ./gradlew spotlessCheck diff --git a/.travis.yml b/.travis.yml index fee1002..894df40 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ cache: - $HOME/.m2/ jdk: - - oraclejdk8 + - oraclejdk17 # Add "verGJF" task when google-java-format handles type annotations better; # see https://github.com/google/google-java-format/issues/5 diff --git a/build.gradle b/build.gradle index 7c41329..183414a 100644 --- a/build.gradle +++ b/build.gradle @@ -2,52 +2,51 @@ plugins { id 'java' id 'application' - // To create a fat jar build/libs/html-pretty-print-all.jar, run: ./gradlew shadowJar - id 'com.github.johnrengelman.shadow' version '7.1.2' + // To create a fat jar build/libs/...-all.jar, run: ./gradlew shadowJar + id 'com.github.johnrengelman.shadow' version '8.1.1' // Code formatting; defines targets "spotlessApply" and "spotlessCheck" - id "com.diffplug.spotless" version "6.12.0" + // Requires JDK 11 or higher; the plugin crashes under JDK 8. + id 'com.diffplug.spotless' version '6.22.0' // Error Prone linter - id("net.ltgt.errorprone") version "3.0.1" + id('net.ltgt.errorprone') version '3.1.0' // Checker Framework pluggable type-checking - id 'org.checkerframework' version '0.6.20' + id 'org.checkerframework' version '0.6.34' } repositories { - mavenCentral() + mavenCentral() } dependencies { - // This dependency is found on compile classpath of this component and consumers. - implementation 'com.google.guava:guava:31.1-jre' + implementation 'com.google.guava:guava:32.1.3-jre' + implementation 'org.ccil.cowan.tagsoup:tagsoup:1.2.1' + implementation 'xom:xom:1.3.9' - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.1' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' - - // https://mvnrepository.com/artifact/org.ccil.cowan.tagsoup/tagsoup - implementation group: 'org.ccil.cowan.tagsoup', name: 'tagsoup', version: '1.2.1' - - // https://mvnrepository.com/artifact/xom/xom - implementation group: 'xom', name: 'xom', version: '1.3.8' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.0' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' } application { mainClass = 'org.plumelib.htmlprettyprint.HtmlPrettyPrint' } +sourceCompatibility = 11 +targetCompatibility = 11 + test { - useJUnitPlatform { - includeEngines 'junit-jupiter' - excludeEngines 'junit-vintage' - } + useJUnitPlatform { + includeEngines 'junit-jupiter' + excludeEngines 'junit-vintage' + } } spotless { format 'misc', { // define the files to apply `misc` to - target '*.gradle', '*.md', '.gitignore' + target '*.md', '.gitignore' // define the steps to apply to those files trimTrailingWhitespace() @@ -55,22 +54,29 @@ spotless { endWithNewline() } java { - targetExclude("**/WeakIdentityHashMap.java") + targetExclude('**/WeakIdentityHashMap.java') googleJavaFormat() formatAnnotations() } + groovyGradle { + target '**/*.gradle' + greclipse() // which formatter Spotless should use to format .gradle files. + indentWithSpaces(2) + trimTrailingWhitespace() + // endWithNewline() // Don't want to end empty files with a newline + } } /// Error Prone linter dependencies { - errorprone("com.google.errorprone:error_prone_core:2.16") + errorprone('com.google.errorprone:error_prone_core:2.23.0') } tasks.withType(JavaCompile).configureEach { - options.compilerArgs << "-Xlint:all" << "-Werror" + // "-processing" avoids javac warning "No processor claimed any of these annotations". + options.compilerArgs << '-Xlint:all,-processing' << '-Werror' options.errorprone { - enabled = JavaVersion.current() != JavaVersion.VERSION_1_8 - disable("ReferenceEquality") // Use Interning Checker instead. + disable('ReferenceEquality') // Use Interning Checker instead. } } @@ -79,9 +85,9 @@ tasks.withType(JavaCompile).configureEach { apply plugin: 'org.checkerframework' dependencies { - compileOnly 'io.github.eisop:checker-qual:3.28.0-eisop1' - testCompileOnly 'io.github.eisop:checker-qual:3.28.0-eisop1' - checkerFramework 'io.github.eisop:checker:3.28.0-eisop1' + compileOnly 'io.github.eisop:checker-qual:3.34.0-eisop1' + testCompileOnly 'io.github.eisop:checker-qual:3.34.0-eisop1' + checkerFramework 'io.github.eisop:checker:3.34.0-eisop1' } checkerFramework { @@ -103,18 +109,19 @@ checkerFramework { '-Werror', '-AcheckPurityAnnotations', '-ArequirePrefixInWarningSuppressions', + '-AwarnRedundantAnnotations', '-AwarnUnneededSuppressions', '-AnoJreVersionCheck', ] } // To use a locally-built Checker Framework, run gradle with "-PcfLocal". -if (project.hasProperty("cfLocal")) { - def cfHome = String.valueOf(System.getenv("CHECKERFRAMEWORK")) +if (project.hasProperty('cfLocal')) { + def cfHome = String.valueOf(System.getenv('CHECKERFRAMEWORK')) dependencies { - compileOnly files(cfHome + "/checker/dist/checker-qual.jar") - testCompileOnly files(cfHome + "/checker/dist/checker-qual.jar") - checkerFramework files(cfHome + "/checker/dist/checker.jar") + compileOnly files(cfHome + '/checker/dist/checker-qual.jar') + testCompileOnly files(cfHome + '/checker/dist/checker-qual.jar') + checkerFramework files(cfHome + '/checker/dist/checker.jar') } } @@ -124,6 +131,13 @@ if (project.hasProperty("cfLocal")) { javadoc { options.addStringOption('Xwerror', '-Xdoclint:all') options.addStringOption('private', '-quiet') + options.addStringOption('source', '11') + doLast { + ant.replaceregexp(match:"@import url\\('resources/fonts/dejavu.css'\\);\\s*", replace:'', + flags:'g', byline:true) { + fileset(dir: destinationDir) + } + } } check.dependsOn javadoc @@ -131,13 +145,13 @@ configurations { requireJavadoc } dependencies { - requireJavadoc "org.plumelib:require-javadoc:1.0.6" + requireJavadoc 'org.plumelib:require-javadoc:1.0.6' } task requireJavadoc(type: JavaExec) { description = 'Ensures that Javadoc documentation exists.' - mainClass = "org.plumelib.javadoc.RequireJavadoc" + mainClass = 'org.plumelib.javadoc.RequireJavadoc' classpath = configurations.requireJavadoc - args "src/main/java" + args 'src/main/java' } check.dependsOn requireJavadoc @@ -145,6 +159,6 @@ check.dependsOn requireJavadoc /* Make Emacs TAGS table */ task tags(type: Exec) { - description "Run etags to create an Emacs TAGS table" - commandLine "bash", "-c", "find src/ -name '*.java' | sort | xargs etags" + description 'Run etags to create an Emacs TAGS table' + commandLine 'bash', '-c', "find src/ -name '*.java' | sort | xargs etags" } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 943f0cb..7f93135 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f398c33..3fa8f86 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 65dcd68..1aa94a4 100755 --- a/gradlew +++ b/gradlew @@ -83,10 +83,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,10 +131,13 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. @@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/settings.gradle b/settings.gradle index 48b88a4..fb7e53a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,2 +1,8 @@ +buildscript { + if (JavaVersion.current() == JavaVersion.VERSION_1_8) { + throw new Error("Use Java 11 or later.") + } +} + // Project name is read-only in build scripts, and defaults to directory name. rootProject.name = 'html-pretty-print'