build: extract publishing config into a build-logic convention plugin#105
Merged
Conversation
Every publishable module repeated the same ~45-line maven-publish + signing
+ POM block, so any change to the Sonatype coordinates, license, SCM, or
signing setup meant editing nine build scripts in lockstep.
Introduce a `build-logic` included build with a single precompiled script
plugin, `dexpace.published-module`, that owns the publication, POM metadata,
staging repository, coordinates (group `org.dexpace`, version
`0.0.1-alpha.1`), and the CI-gated in-memory signing configuration. Each of
the nine modules now applies `id("dexpace.published-module")` and keeps only
its module-specific dependencies and toolchain overrides; the POM name and
description continue to derive from `project.name`, so no module needs any
further publishing configuration. A module that should not be published
simply does not apply the plugin.
The generated POMs, Gradle module metadata, coordinates, artifacts, and
signing behaviour are unchanged: the per-module POMs are byte-identical to
those produced before the change, and `publishToMavenLocal` continues to skip
signing when no PGP key is present (signing is required only under CI).
…rd the publication on the kotlin-jvm plugin
…the publishing convention Set group/version once in gradle.properties, which Gradle applies to the root project and every subproject, removing the duplicated literals from the root build script and the published-module convention plugin. A coordinate bump is now a single one-line edit. Published POM coordinates are unchanged (org.dexpace / 0.0.1-alpha.1). Document the dexpace.published-module convention in CLAUDE.md so new modules apply the plugin rather than re-inlining a publishing block.
…ention-plugin # Conflicts: # gradle.properties
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
All nine publishable modules carried a byte-identical ~45-line block of publishing configuration — a
publishing {}publication with the full POM (name, description, url, MIT license, developer, SCM) and the local staging repo, a CI-gatedsigning {}block using in-memory PGP keys, and repeatedgroup/versionlines. The only "module-specific" parts (POM name/description) were already derived fromproject.name, so nothing was genuinely per-module.This extracts that block into a
build-logicincluded build with a single precompiled script plugin,dexpace.published-module. Each module now appliesid("dexpace.published-module")instead of repeating the configuration; module-specific bits (the JDK-11/21 toolchain overrides, detekt-disable blocks) are left untouched. Net −469/+148 across 13 files. The plugin is opt-in, so a future non-publishing module (e.g. the example module on another branch) simply won't apply it.Published output is unchanged
Regenerated POMs for
sdk-core,sdk-async-virtualthreads, andsdk-serde-jacksonare byte-identical to the baseline frommain, and the published.pom/.modulein the local repo carry the sameorg.dexpace/0.0.1-alpha.1coordinates. CI-gated signing is wired identically — skipped locally without keys (isRequired = CI == "true"), engaging under CI withSIGNING_KEY/SIGNING_PASSWORD.Validation
./gradlew buildgreen (all gates, including ktlint over the module.ktsscripts and the build-logic compile);./gradlew publishToMavenLocalandpublishAllPublicationsToLocalRepositoryboth green with the full artifact sets.Closes #71