refactor: extract shared LinuxPackaging utility to eliminate build script duplication#1407
Merged
Conversation
…ript duplication Move ~60 lines of identical boilerplate (plugins, repositories, dependencies, sourceSets, test config) and ~100 lines of docker build/run/check task logic into a shared LinuxPackaging utility class in buildSrc. Each platform build.gradle (jdk/jre × alpine/debian/redhat/suse) is reduced from ~150-230 lines to ~10 lines of declarative configuration. The ca-certificates build is similarly simplified using applyCommonConfig(). All Gradle task names are preserved exactly (packageJdkAlpine, checkJdkRedHat, packageJdkrhel, etc.) so Jenkinsfiles and CI pipelines require no changes. Also adds buildSrc to linux_new/ with ExecHelper wrapper for consistent exec handling across both directories. Net change: -2,967 lines, +207 lines across 17 modified + 4 new files.
steelhead31
approved these changes
May 18, 2026
Contributor
steelhead31
left a comment
There was a problem hiding this comment.
Looks good, the code looks much cleaner with this refactor.
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.
Summary
Extracts all duplicated Gradle build logic from the 16 platform
build.gradlefiles (jdk/jre × alpine/debian/redhat/suse) in bothlinux/andlinux_new/into a sharedLinuxPackagingutility class inbuildSrc.Problem
Each platform build file contained ~150-230 lines of nearly identical code:
This made maintenance painful — any change to the build pattern required updating 16+ files, with inevitable drift and inconsistency.
Solution
A single
LinuxPackaging.groovyclass inbuildSrcprovides:applyCommonConfig(project)— sets up all shared Gradle configurationconfigure(project, config)— creates packaging and check tasks from a declarative config mapEach platform build file is now ~10 lines:
Changes
linux/buildSrc/src/main/groovy/org/adoptium/LinuxPackaging.groovylinux_new/buildSrc/withExecHelper.groovy+LinuxPackaging.groovybuild.gradlefiles +ca-certificates/debian/build.gradleCompatibility
packageJdkAlpine,checkJdkRedHat,packageJdkrhel, etc.)./gradlew taskson bothlinux/andlinux_new/