Repository navigation
Share build logic through convention plugins and enable the configuration cache - #17
Merged
Merged
Conversation
lhotari
added this pull request to stack #18
September 23, 2026 21:52
…tion cache The three module build scripts repeated the toolchain, the Javadoc options, the POM, the publication, the embedded-dependency digest check, the shading setup and the fixture task wiring, and their task actions called helper functions of the build script itself, which kept the configuration cache from working (22 problems for the check tasks). - build-logic/ is an included build with four precompiled convention plugins: jonoffcpu.java-conventions (Corretto 25 toolchain, --release from `jonoffcpu.javaRelease`, which also sets the published JVM version, UTF-8, Javadoc, fixtures), publish-conventions (the POM and Maven Central setup, license overridable), shaded-jar-conventions (the embeddedRuntime configuration, its digest check, the shaded JAR and its publication) and protobuf-conventions (the lite codec from docs/schema). They bring the third-party plugins as dependencies, so every module loads them from one class loader. - The task logic is in typed task classes with declared inputs: VerifyDependencyDigests, VerifyJarContents, VerifyNativeLibraries, GenerateNativeChecksums, VerifyAgentJar, and FixtureExec, which reports each fixture class as the root build script did. The host C library is read by a value source, so /proc/self/maps, which differs on every run, is not a configuration input. - Every library and plugin version is in gradle/libs.versions.toml. Repositories are declared once in the settings, and project repositories are refused. - No project configures another: the root subprojects block is gone, the root directory is read through `isolated.rootProject`, and each module's check depends on :spotlessCheck by path. - gradle.properties turns on the configuration cache, configure-on- demand and parallel execution, next to the build cache. Spotless now pins LF line endings: its default reads git attributes with JGit, whose file system probes invalidated the configuration cache on every run. The check tasks of all three modules now store a configuration cache entry without problems and reuse it on the next run. Configuring :jonoffcpu-jfr-converter:check configures only the root and that project. After a clean, compilation, the generated protobuf code, the Javadoc and the correlator's shaded JAR come from the build cache. The published artifacts are the same as before: the same JAR entries, POMs and Gradle module metadata, with only the order of the shaded JARs' manifest attributes changed; the agent still declares JVM 17 and the other modules JVM 21.
lhotari
force-pushed
the
gradle-build-logic
branch
from
September 23, 2026 22:02
a9c26ad to
36d800e
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.
Gradle build refactoring following Gradle best practices. Based on #16 (CI improvements); review only the top commit.
What changes
build-logic/included build (as in the Apache Pulsar build, kept small) with four precompiled convention plugins:jonoffcpu.java-conventions: Corretto 25 toolchain,--releasefromjonoffcpu.javaRelease(default 21; the agent sets 17; it also drives the publishedorg.gradle.jvm.version), UTF-8, Javadoc options, sources/javadoc JARs, disabled JUnittest, andcheck→ everyFixtureExec+:spotlessCheck(by path).jonoffcpu.publish-conventions: the shared Maven Central/POM setup; modules setjonoffcpuPublication.displayName/description, and the converter overrides the license.jonoffcpu.shaded-jar-conventions: theembeddedRuntimeconfiguration,verifyDependencyDigests, the shaded JAR and its publication; modules add relocations and contents.jonoffcpu.protobuf-conventions: the lite codec fromdocs/schema.doLastblocks that called build-script functions:VerifyDependencyDigests,VerifyJarContents,VerifyNativeLibraries,GenerateNativeChecksums,VerifyAgentJar, andFixtureExec, which replaces the root script's STARTED/PASSED logging. The host C library is detected in aValueSource, so/proc/self/maps(different on every run) is no configuration input.gradle/libs.versions.tomlholds every library and plugin version. Repositories are declared once in settings, withFAIL_ON_PROJECT_REPOS.subprojects {}block is removed, the root directory is read viaisolated.rootProject, and:spotlessCheckis depended on by path.gradle.properties:org.gradle.configuration-cache=true,org.gradle.configureondemand=trueandorg.gradle.parallel=true, next toorg.gradle.caching=truefrom Speed up CI and make its builds visible #16.gradlew.batis CRLF, and Spotless doesn't format it.Verification
Reusing configuration cache.The same holds forpublishToMavenLocaland a dry run ofpublishAndReleaseToMavenCentral -PsignAllPublications=true.:jonoffcpu-jfr-converter:checkconfigures only:,build-logicand:jonoffcpu-jfr-converter.clean,compileJava,generateProto,javadocand the correlator'sshadowJarareFROM-CACHE.spotlessCheck :jonoffcpu-agent:check :jonoffcpu-correlator:check :jonoffcpu-jfr-converter:check -PnativeArchitectures=x86_64 -PnativeLibcs=allpasses; all 19 fixture tasks run, including the native ones.publishToMavenLocal, x86-64 glibc+musl): identical JAR entry lists, POMs and Gradle module metadata. The only difference is the order of the shaded JARs' manifest attributes, hence their size and hashes. Published JVM versions are unchanged: agent 17, correlator and converter 21.-PprebuiltNative=true -PnativeArchitectures=all -PnativeLibcs=all) plans no Docker builds, as before.Not verified locally
--no-configuration-cache.