From ae7cc2220aa1eb47344b7f0cbf81178a1cc2dec3 Mon Sep 17 00:00:00 2001 From: Alex Abashev Date: Tue, 1 Dec 2026 01:44:57 +0300 Subject: [PATCH] Format the 17 line with 17.1.0 The 21 line's Gradle plugin does not load on Gradle with JDK 17, so the 17 line applied none until its own was out. 17.1.0 is, and formats this repository now, with formatDiff as on the 21 line. It runs the formatter inside the Gradle JVM: the line has no native image of its own. The README and CLAUDE.md no longer send changes to the 21 line's runnable jar. --- CLAUDE.md | 7 +++---- README.md | 9 ++------- build.gradle | 9 ++++----- gradle.properties | 5 ++--- 4 files changed, 11 insertions(+), 19 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 2de74380..8043e20f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,10 +1,9 @@ # Working in this repository Building and testing: the README's "Building and testing locally" section. This is the 17 line: Gradle, the toolchain -and the tests run on the Temurin 17 that `mise install` provides, and `./gradlew check` is what CI runs. Until 17.1.0 -is out nothing in the build formats the code: format the files you changed with the 21 line's runnable jar on JDK 21, -`java -jar open-java-format-21.1.2-all.jar --replace `. Error Prone, NullAway and Checkstyle do not run here; -the code is checked on 21.X.X and comes here as backports. +and the tests run on the Temurin 17 that `mise install` provides, `./gradlew check` is what CI runs, and +`./gradlew formatDiff` formats the files you changed with the released 17.1.0. Error Prone, NullAway and Checkstyle do +not run here; the code is checked on 21.X.X and comes here as backports. ## Conventions for new code diff --git a/README.md b/README.md index 640a79fa..6383519b 100644 --- a/README.md +++ b/README.md @@ -164,13 +164,8 @@ Nothing inside the build downloads a JDK. `gradle.properties` turns toolchain au reads the installation from `JDK17_HOME`, so a missing JDK is an error you can read rather than a silent download. -The released Gradle plugin that formats this repository is built for Java 21, so the 17 line applies -none until 17.1.0 is out. Until then, format the files you change with the 21 line's runnable jar on -JDK 21: - -```bash -java -jar open-java-format-21.1.2-all.jar --replace -``` +`./gradlew formatDiff` formats the files you changed with the released 17.1.0, the 17 line's own: the +21 line's Gradle plugin does not load on Gradle with JDK 17. The native image, the IntelliJ and Eclipse plugins, the WebAssembly module and the benchmarks are built on the 21 line. Here they stay in the tree, commented out in `settings.gradle`, so that a diff --git a/build.gradle b/build.gradle index 00306dbe..cc3d97ef 100644 --- a/build.gradle +++ b/build.gradle @@ -6,10 +6,9 @@ buildscript { dependencies { classpath 'com.gradle.publish:plugin-publish-plugin:2.2.1' - // The released open-java-format formats this repository, not the one being built here. The 21 line's - // plugin does not load on Gradle with JDK 17, so the 17 line applies none until 17.1.0 is out; until then, - // changes made on the branch are formatted with the 21 line's -all.jar. - // classpath 'dev.openjavaformat:gradle-open-java-format:21.0.2' + // The released open-java-format formats this repository, not the one being built here: the 17 line's own, + // since the 21 line's plugin does not load on Gradle with JDK 17. + classpath 'dev.openjavaformat:gradle-open-java-format:17.1.0' classpath 'me.champeau.jmh:jmh-gradle-plugin:0.7.4' } } @@ -49,7 +48,7 @@ def javacInternalExports = [ ] allprojects { - // apply plugin: 'dev.openjavaformat.java-format' + apply plugin: 'dev.openjavaformat.java-format' // The fork's Maven group (README, "Coordinates"). The Java packages stay com.palantir.javaformat. group = 'dev.openjavaformat' diff --git a/gradle.properties b/gradle.properties index 55c397f8..7157bcae 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,9 +7,8 @@ org.gradle.jvmargs=--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAME --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED -# Read by the released dev.openjavaformat.java-format plugin that formats this repository, which the 17 line does -# not apply until 17.1.0 is out (build.gradle); the 17 line publishes no native image of its own. -# openjavaformat.native.formatter=true +# The released dev.openjavaformat.java-format plugin that formats this repository (build.gradle) runs the formatter +# inside the Gradle JVM, with the exports above: the 17 line publishes no native image of its own. # Where Gradle looks for JDKs: the 17 line needs JDK 17 alone. Locally JDK17_HOME is unset and mise's install is # found through Gradle's asdf provider instead.