Skip to content

chore: upgrade sbt-java-formatter to 0.12.0#3066

Merged
He-Pin merged 7 commits into
mainfrom
unify-formatter-config
Jun 14, 2026
Merged

chore: upgrade sbt-java-formatter to 0.12.0#3066
He-Pin merged 7 commits into
mainfrom
unify-formatter-config

Conversation

@He-Pin

@He-Pin He-Pin commented Jun 14, 2026

Copy link
Copy Markdown
Member

Motivation

Align sbt-java-formatter version with other pekko sub-projects to reduce maintenance burden and ensure consistent Java formatting across the ecosystem.

Modification

Upgrade sbt-java-formatter from 0.11.0 to 0.12.0 in project/plugins.sbt.

Result

pekko core now uses the same sbt-java-formatter version (0.12.0) as all other pekko sub-projects.

Tests

Not run - build config change only

References

None - formatter unification across pekko sub-projects

Motivation:
Align sbt-java-formatter version with other pekko sub-projects to
reduce maintenance burden and ensure consistent Java formatting.

Modification:
Upgrade sbt-java-formatter from 0.11.0 to 0.12.0 in project/plugins.sbt.

Result:
All pekko sub-projects now use the same sbt-java-formatter version (0.12.0).

Tests:
Not run - build config change only

References:
None - formatter unification across pekko sub-projects
@pjfanning

Copy link
Copy Markdown
Member

@He-Pin you may need to add something like ThisBuild / javafmtFormatterCompatibleJavaVersion := 17 to build.sbt to get around the google formatter issues

He-Pin added 4 commits June 14, 2026 20:40
Motivation:
The CI workflow was only checking Java formatting. The checkCodeStyle
alias covers scalafmt, javafmt, and header checks in one command.

Modification:
Replace javafmtCheckAll with checkCodeStyle in build-test-prValidation.yml.

Result:
CI now runs the full code style check (scalafmt + javafmt + headers).
Motivation:
As suggested by @pjfanning, google-java-format requires the JDK
compatibility version to be set explicitly in build.sbt to avoid
formatting issues with the upgraded sbt-java-formatter 0.12.0.

Modification:
Add `ThisBuild / javafmtFormatterCompatibleJavaVersion := 17`
before the addCommandAlias lines.

Result:
Code Style check should pass with consistent formatting across
local and CI environments.
google-java-format requires import statements to be contiguous (no comments
between them). Moved Paradox snippet markers (// #tag-name) from within
import blocks to below the last import statement, then ran javafmtAll.
Files in jdocs/ and docs/ directories use Paradox snippet markers
(// #tag-name) between import statements for documentation extraction.
google-java-format requires imports to be contiguous, so these files
cannot be auto-formatted. Added excludeFilter to skip them.
@He-Pin
He-Pin marked this pull request as draft June 14, 2026 14:02
Motivation:
The previous approach of either excluding doc files from javafmt or
manually repositioning Paradox markers broke documentation rendering.
google-java-format requires contiguous imports, and alphabetically
sorting imports moves Paradox snippet markers (// #tag) to wrong
positions relative to the imports they wrap.

Modification:
- Replace javafmt/excludeFilter with javafmtSortImports := false
- Restore 60 doc files to their original import order
- Run javafmtAll which now formats code without reordering imports
- Paradox markers stay in their original positions between imports

Result:
All Java files are formatted by javafmt while Paradox snippet markers
correctly wrap their intended imports for documentation rendering.
@He-Pin
He-Pin force-pushed the unify-formatter-config branch from f6ea2bd to 7aefacd Compare June 14, 2026 14:42
…28.0

Motivation:
google-java-format 1.28.0 (used by sbt-java-formatter 0.12.0 with
javafmtFormatterCompatibleJavaVersion := 17) expects 24-space indentation
for string continuation lines inside nested method calls. The file had
21-space indentation, causing the Check / Code Style CI job to fail.

Modification:
Fix indentation of two string continuation lines in filterExample and
filterNotExample methods to match google-java-format 1.28.0 expectations.

Result:
The checkCodeStyle CI check passes for the docs module.

Tests:
- sbt checkCodeStyle → success
- google-java-format 1.28.0 --skip-sorting-imports --dry-run → exit 0

References:
Refs #3066
@He-Pin
He-Pin marked this pull request as ready for review June 14, 2026 15:32
@He-Pin
He-Pin requested a review from pjfanning June 14, 2026 15:32
@He-Pin He-Pin added this to the 2.0.0-M4 milestone Jun 14, 2026

@pjfanning pjfanning left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@He-Pin
He-Pin merged commit 3e578d8 into main Jun 14, 2026
9 checks passed
@He-Pin
He-Pin deleted the unify-formatter-config branch June 14, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants