Skip to content

Commit fc2420d

Browse files
authored
Number versions after the Java version (#140)
* Number versions after the Java version, not after palantir's Up to 2.98.0.6 the version was palantir-java-format's with a build number appended. The bug fixes made the output differ from upstream, so following its numbers lost its meaning. From here a version is <java>.<minor>.<build>: the Java version the formatter is built for, then a number that moves with every change to the output, then one that moves with builds that leave the output alone. The README gets a Versions section that says so, and the palantir section stops promising a 2.x line and changes waiting for 3.0. * Run CI on the release-line branches The default branch is 21.X.X now, and a release line is named after the Java version it is built for, so the workflows that watched main alone also take '*.X.X': CI, CodeQL, the dependency graph, the SHA-pinning and zizmor checks. The PR updater follows 21.X.X, the base of every pull request, and dependabot loses its target-branch so that it opens its pull requests against the default branch, whichever line that is. Releases need nothing: release.yml runs on a tag, and JReleaser never compares the branch. * Watch the release lines only main is the old line and gets nothing new, so the workflows stop watching it: CI, CodeQL, the dependency graph, the SHA-pinning and zizmor checks run on '*.X.X' alone. dependabot names 21.X.X outright instead of following the default branch, and moves when the next line starts. * Say what the third number is for It is not a build counter but the number of fixes that leave the output alone: a crash, a regression, an internal bug, a dependency update. The line between it and the second number is the output, not the kind of change: a fix that changes the output raises the second, a fix that does not raises the third.
1 parent a0bb83f commit fc2420d

8 files changed

Lines changed: 39 additions & 22 deletions

File tree

‎.github/dependabot.yml‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
version: 2
22
# A release is proposed only once it is a week old: a compromised or broken release is usually pulled
33
# within days. The cooldown holds back version updates only; security updates still come at once.
4+
#
5+
# target-branch names the current release line; it moves when the next line starts.
46
updates:
57
- package-ecosystem: "github-actions"
68
directory: "/"
79
schedule:
810
interval: "weekly"
9-
target-branch: "main"
11+
target-branch: "21.X.X"
1012
cooldown:
1113
default-days: 7
1214

1315
- package-ecosystem: "gradle"
1416
directory: "/"
1517
schedule:
1618
interval: "weekly"
17-
target-branch: "main"
19+
target-branch: "21.X.X"
1820
cooldown:
1921
default-days: 7

‎.github/workflows/ci.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: CI
33
on:
44
push:
55
branches:
6-
- main
6+
- '*.X.X' # a release line is named after the Java version it is built for: 21.X.X
77
pull_request:
88

99
permissions:
@@ -48,7 +48,7 @@ jobs:
4848
# jobs and nothing they build is kept. The code is still compiled for Java 21 by JDK 21, as in the
4949
# release; -PjavaRuntime moves only the test JVMs, and with them the javac whose internals the
5050
# formatter parses with. The IntelliJ plugin's tests stay on the runtime of the IDE they start.
51-
# JDK 21 itself is `build`, the check the main branch requires.
51+
# JDK 21 itself is `build`, the check the default branch requires.
5252
jdk:
5353
name: build (JDK ${{ matrix.jdk }})
5454
runs-on: ubuntu-latest

‎.github/workflows/codeql-analysis.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: "CodeQL"
22

33
on:
44
push:
5-
branches: [ 'main' ]
5+
branches: [ '*.X.X' ]
66
pull_request:
7-
branches: [ 'main' ]
7+
branches: [ '*.X.X' ]
88
schedule:
99
- cron: '33 9 * * 6'
1010

‎.github/workflows/dependency-submission.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Submit dependency graph
22

33
on:
44
push:
5-
branches: [ 'main' ]
5+
branches: [ '*.X.X' ]
66

77
permissions:
88
contents: write

‎.github/workflows/sha-pinning-check.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Ensure SHA-pinned actions
22

33
on:
44
pull_request:
5-
branches: [ 'main' ]
5+
branches: [ '*.X.X' ]
66
push:
7-
branches: [ 'main' ]
7+
branches: [ '*.X.X' ]
88

99
permissions:
1010
contents: read

‎.github/workflows/update-pr-branch.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Update PR branches
22

33
on:
44
push:
5-
branches: [ 'main' ]
5+
branches: [ '21.X.X' ] # the default branch, the base of every pull request
66
schedule:
77
# Run every hour to catch stuck PRs
88
- cron: '0 * * * *'
@@ -18,6 +18,6 @@ jobs:
1818
- uses: adRise/update-pr-branch@e96e796f4ab23ab388016fdaed7092de99bd71cf # v0.11.1
1919
with:
2020
token: ${{ secrets.BOT_PAT }}
21-
base: 'main'
21+
base: '21.X.X'
2222
required_approval_count: 1
2323
require_passed_checks: true

‎.github/workflows/zizmor.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: GitHub Actions Security Analysis with zizmor 🌈
22

33
on:
44
push:
5-
branches: ["main"]
5+
branches: ["*.X.X"]
66
pull_request:
77
branches: ["**"]
88

‎README.md‎

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,14 @@ private static void configureResolvedVersionsWithVersionMapping(Project project)
8585

8686
## Coming from palantir-java-format
8787

88-
- **Same output, except for bug fixes.** 2.98.0.x is the code of palantir-java-format 2.98.0, renamed
89-
and rebuilt in the open. Its output is the same except where it fixes a bug, and
90-
[Migrate](https://openjavaformat.dev/migrate/) lists those fixes. The fourth number counts builds of
91-
an upstream version.
92-
- **Identical Java packages.** `com.palantir.javaformat.*` stays for the whole 2.x line, so your code
93-
and the SPI keep working.
88+
- **Same output, except for bug fixes.** The formatter is the code of palantir-java-format 2.98.0,
89+
renamed and rebuilt in the open. Its output is the same except where it fixes a bug, and
90+
[Migrate](https://openjavaformat.dev/migrate/) lists those fixes. Any later change to the output
91+
comes with a new minor version, see [Versions](#versions).
92+
- **Identical Java packages.** `com.palantir.javaformat.*` stays, so your code and the SPI keep
93+
working.
9494
- **One-line migration.** Change the coordinates below. Nothing else.
9595

96-
Other changes to the formatter's output wait for 3.0.
97-
9896
| | palantir-java-format | open-java-format |
9997
|---|---|---|
10098
| Maven group | `com.palantir.javaformat` | `dev.openjavaformat` |
@@ -109,8 +107,25 @@ Other changes to the formatter's output wait for 3.0.
109107
| CLI style flag | `--palantir`, `-palantir` | none: there is one style |
110108
| Formatter style | `PALANTIR` | `OJF` |
111109
| Native formatter Gradle property | `palantir.native.formatter` | `openjavaformat.native.formatter` |
112-
| Java packages | `com.palantir.javaformat.*` | **unchanged in 2.x** |
113-
| Version numbers | `2.98.0` | `2.98.0.1` |
110+
| Java packages | `com.palantir.javaformat.*` | **unchanged** |
111+
| Version numbers | `2.98.0` | `21.<minor>.<build>`, see [Versions](#versions) |
112+
113+
## Versions
114+
115+
A version is three numbers, `<java>.<minor>.<build>`, and each one answers a question of its own.
116+
117+
- **The first is the Java version the formatter is built for**, 21 today. It moves when the minimum
118+
Java version moves.
119+
- **The second moves with every change to the output**: a fix in wrapping or alignment, a new rule,
120+
a new feature. A newer minor version can reformat code that the previous one left alone.
121+
- **The third moves with fixes that leave the output alone**: a crash, a regression, an internal
122+
bug, a dependency update. A newer build formats every file exactly as the previous one did.
123+
124+
The line between the last two numbers is the output, not the kind of change: a fix that changes
125+
the output raises the second number, a fix that does not raises the third.
126+
127+
Up to 2.98.0.6 the version was palantir-java-format's with a build number appended. Once the bug
128+
fixes made the output differ from upstream, that numbering lost its meaning.
114129

115130
## Building and testing locally
116131

0 commit comments

Comments
 (0)