feat(build): upgrade to Gradle 8.14.5 and support JDK 21 builds - #139
Open
halibobo1205 wants to merge 5 commits into
Open
feat(build): upgrade to Gradle 8.14.5 and support JDK 21 builds#139halibobo1205 wants to merge 5 commits into
halibobo1205 wants to merge 5 commits into
Conversation
🤖 CodeAnt AI — Review Status
|
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0b97f995fa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Migrate deprecated Gradle APIs while retaining JDK 8 compatibility. Bump protobuf-gradle-plugin 0.9.1 -> 0.9.6 for Gradle 8 support. Move protobuf generation from src/ to build/generated and exclude legacy generated sources so incremental builds cannot compile duplicate classes. Update the custom actuator guides for the relocated codegen path and lifecycle. Declare jacocoTestReport dependency on classes so Gradle 8 task validation holds when test is excluded from the graph. Refresh dependency verification metadata for the upgraded build tooling.
Accept JDK 8 or newer on x86_64 and JDK 17 or newer on ARM64 while continuing to emit Java 8 bytecode. Select VM options from the build JVM and remove runtime gates that previously required exact JDK versions. Rework install_dependencies.sh to keep any JDK meeting the architecture minimum, and drop the now-dead gate code and its tests. Make JDK 21 static mocking work by excluding Mockito transitive Byte Buddy 1.12.19 and declaring 1.17.7 directly while retaining JDK 8 runtime compatibility. Remove the obsolete 1.12.19 verification entries.
Upgrade JaCoCo, Lombok, AspectJ runtime/weaver, and the Gradle test-retry plugin. Remove the unused JDK 17-only AspectJ compiler tools and refresh strict dependency verification metadata, including the required plugin POM checksum.
Move the legacy-compatible MathWrapper into the platform common source set and remove the x86 Math implementation. This keeps transcendental results deterministic across JDKs and architectures.
halibobo1205
force-pushed
the
java/JDK21
branch
from
August 4, 2026 06:59
8c4d2e5 to
969b215
Compare
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
Exercise every supported architecture and JDK combination in pull requests: x86_64 on JDK 8, 17 and 21, and ARM64 on JDK 17 and 21, covering Linux for both plus macOS on JDK 21. This guards the architecture minimums as well as newer-JDK compatibility. Pin JDK 17 explicitly on Rocky Linux and assert the active version: "Development Tools" pulls in java-1.8.0-openjdk-headless, whose alternatives priority outranks the JDK 17 package and would otherwise leave the build on a JRE without javac.
halibobo1205
force-pushed
the
java/JDK21
branch
from
August 4, 2026 12:19
969b215 to
75426f2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Modernizes the build toolchain and widens the supported JDK envelope, in 5 commits:
build(gradle): Gradle 7.6.4 → 8.14.5. Migrates removed Gradle 7 APIs (reportenabled→required,mainClassName→application.mainClass,fileMode→filePermissions, archive properties), bumps protobuf-gradle-plugin 0.9.1 → 0.9.6, and relocates protobuf codegen out ofprotocol/src/intobuild/generated. Legacy generated sources left inprotocol/src/main/javaby older builds are excluded from compilation and purged automatically, so existing checkouts upgrade without duplicate-class failures. DeclaresjacocoTestReport's dependency onclassesso Gradle 8 task validation holds forbuild -x test.feat(build): per-arch JDK minimums. The build now accepts JDK 8+ on x86_64 and JDK 17+ on ARM64 (previously exact 8/17), while--release 8keeps all bytecode Java 8 (major 52). The runtime exact-JDK gate inFullNodeis removed (see rationale below). Test mocking works on JDK 21 by excluding Mockito's Byte Buddy 1.12.19 and declaring 1.17.7 directly.install_dependencies.shnow keeps any JDK meeting the architecture minimum instead of requiring an exact version, and validates the same JVM gradlew would use —JAVA_HOMEfirst, thenPATH— requiringjavacin that same installation so a JRE is never mistaken for a JDK, and exiting non-zero when the resulting environment cannot build.build(deps): JDK-compatible tooling. lombok 1.18.46, AspectJ 1.9.25 (aspectjtools dropped — unused), JaCoCo 0.8.15, test-retry 1.6.5.fix(math): unify pow behavior across architectures. Removes the x86-onlyMathWrapper(rawMath.pow) and promotes the StrictMath + mainnet-patch-table implementation (already used by all ARM64 nodes to sync from genesis) as the single cross-arch implementation. All 48 historicalpowspecial cases are preserved byte-for-byte.ci: every supported architecture × JDK combination is now built. x86_64 on JDK 8 (Debian 11), 17 (Rocky Linux 8) and 21 (Ubuntu 24.04); ARM64 on JDK 17 and 21 (Ubuntu 24.04) plus JDK 21 on macOS 26. The Rocky Linux job additionally pins JDK 17 explicitly and asserts the active version —dnf groupinstall "Development Tools"pulls injava-1.8.0-openjdk-headless, whose RHEL alternatives priority (1800502 vs 1) hijacksjavaand would leave the build on a JRE withoutjavac.Why are these changes required?
The exact-JDK runtime pin existed solely because x86 consensus
powdepended on JDK 8'sMath.powintrinsics. UnifyingMathWrapperonStrictMath(bit-reproducible by spec across JDKs and architectures) removes that dependency, which is what makes the minimum-based JDK envelope sound. Gradle 7.6.4 cannot run modern JDKs; 8.14.5 supports building on JDK 8–24.Consensus note: on mainnet/nile/shasta
ALLOW_STRICT_MATH(chain parameter 87, activated by mainnet proposal 101) is active, so new blocks useStrictMathWrapperand this change only affects historical replay, which the 48-entry table reproduces exactly — behaviour already validated by every ARM64 node syncing mainnet from genesis. Private chains that have not activated the parameter still executeMathWrapper.powon the live path and should upgrade all x86 nodes in lockstep (or activate the proposal first).This PR has been tested by:
AllowTvmLondonTest,ValidateMultiSignContractTeston JDK 21; a disjoint set on JDK 25); each passes cleanly when run on its own on both JDK 17 and JDK 21, so they are load-sensitive rather than JDK-specific.protocol/src/) rebuilt on this branch without clean — no duplicate classesbuild -x test)FullNode.jarboots and produces blocks on a JDK 25 private chain; packaged JDK17+ vmoptions validated on 17/21/25JAVA_HOMEpointing at a JRE, a JDK below the architecture minimum, a JDK 8jresubdirectory, or an invalid path are all rejected;PATH-only JDK 8/17 andJAVA_HOME-set JDK 17 are accepted; a machine with nojavais detected as suchgradle-wrapper.jarbyte-identical to the official 8.14.5 release; every changedverification-metadata.xmlchecksum re-derived from Maven Central / Gradle Plugin PortalFollow up
sun.misc.Unsafe(warn-only on JDK 24/25; JDK 26 plans deny-by-default per JEP 498) — revisit with a netty upgradebuildFinished,configurations.archives, eager task APIs) remain and will need attention at the next Gradle majorExtra details
bin/vmoptions are selected when the distribution is built (build JDK < 17 → CMS file, ≥ 17 → ZGC file) rather than detected at node startup, so a distribution targets its build JDK's runtime family;java -jaris runtime-agnostic (verified 8→25).Build rockylinux (JDK 17 / x86_64),Build macos26 (JDK 21 / aarch64)) and one job is added (Build ubuntu24 (JDK 21 / x86_64|aarch64)) — branch-protection required checks need a one-time update. The added job runs in parallel, so wall-clock CI time is unchanged.MathWrappervariants (one renamed, one deleted), plus dead-code removal inFullNode,ArchandTronError.