Skip to content

build: extract shared Gradle logic into buildSrc conventions - #206

Merged
TheMeinerLP merged 1 commit into
mainfrom
build/buildsrc-conventions
Aug 28, 2026
Merged

build: extract shared Gradle logic into buildSrc conventions#206
TheMeinerLP merged 1 commit into
mainfrom
build/buildsrc-conventions

Conversation

@TheMeinerLP

Copy link
Copy Markdown
Contributor

Warum

Die Build-Logik war über die Modul-Buildfiles hinweg kopiert statt geteilt:

Duplikat vorher nachher
java { toolchain { …25 } }
Test-Konfiguration (useJUnitPlatform, -Dminestom.inside-test=true)
Publishing-Boilerplate (Lizenz, Developer, SCM, Repository, ~45 Zeilen)
Shadow-Version 9.6.1 hartcodiert 1× (Root, apply false)
Jacoco nur :common + :setup alle Module

:app hatte 15 Testklassen, aber keinen Coverage-Report, weil Jacoco dort nie angewendet wurde.

Was

Zwei precompiled script plugins in buildSrc:

  • titan.java-conventions — Toolchain 25, javac-Optionen (--release 25, UTF-8, -Xlint:deprecation,unchecked), JUnit-Platform mit minestom.inside-test, Jacoco mit XML-Report an test gekoppelt
  • titan.publish-conventions — die maven-Publication mit Koordinaten, POM-Metadaten und dem OneLiteFeather-Repository

In den Modulen bleibt nur, was sich tatsächlich unterscheidet — artifactId, POM-name/description und die publizierten Artefakte:

publishing.publications.named<MavenPublication>("maven") {
    artifactId = "titan-app"
    artifact(tasks.shadowJar)
    pom {
        name = "Titan App"
        description = "Titan App Server for OneLiteFeather"
    }
}

Unterm Strich: −207 / +151 Zeilen, 245 Zeilen dupliziertes Modul-Boilerplate ersetzt durch 109 Zeilen geteilte Conventions.

Damit erfüllt Titan OLF-L1-01 aus dem OLF-Minestom-Project-Standard und zieht mit Cygnus' cygnus.java-conventions gleich.

Verifikation — keine Änderung am Build-Output

Gegen einen Baseline-Build von main vor der Änderung geprüft:

  • Alle 7 Jars inhaltsgleich (sortierte Entry-Listen): api, common, bridge, app-titan.jar, setup-titan.jar, beide -unshaded
  • Generierte POMs identisch für :app, :setup, :bridge
  • Publish-Tasks identisch (inkl. publishMavenPublicationToOneLiteFeatherRepositoryRepository)
  • Testergebnisse identisch: 21 Klassen, 56 Tests, 0 Fehler
  • Abhängigkeitsgraph identisch bis auf die neuen jacocoAgent/jacocoAnt-Konfigurationen in :app, :api, :bridge — reine Tooling-Konfigurationen, die auf keinem Compile- oder Runtime-Classpath landen (bestätigt durch die identischen Jars)

Nebeneffekt

-Xlint:deprecation legt fünf bereits vorhandene Warnungen offen:

common/.../map/MapProvider.java:48,63    GsonFileHandler ist veraltet (Aves, forRemoval)
common/.../map/MapProvider.java:93       AnvilLoader(Path) ist veraltet (forRemoval)
common/.../config/AppConfigProvider.java:34,41  GsonFileHandler ist veraltet

Bewusst als Warnung stehen gelassen — der Wechsel auf ModernGsonFileHandler ist eigene Arbeit (Phase 3 des Standards).

Nicht Teil dieses PRs

  • Version bleibt in gradle.properties samt substringBefore('#')-Hack. Der Umzug nach build.gradle.kts (wie in Cygnus) berührt release-please-config.json und gehört in einen eigenen PR.
  • shadowJar-Konfiguration bleibt pro Modul: :app setzt Signatur-/module-info-Excludes und DuplicatesStrategy.EXCLUDE, :setup nicht. Vereinheitlichen würde den Output verändern und ist damit kein reines Refactoring.
  • Spotless bleibt im subprojects {}-Block des Root-Builds.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QtbnMbAj6m2q3vrDYFizDr

@TheMeinerLP
TheMeinerLP requested a review from a team as a code owner August 27, 2026 18:44
@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Test results

 63 files   63 suites   55s ⏱️
 55 tests  53 ✅ 2 💤 0 ❌
168 runs  162 ✅ 6 💤 0 ❌

Results for commit 00dfaed.

♻️ This comment has been updated with latest results.

Every module build file carried its own copy of the same setup: the Java
toolchain five times, the test configuration four times, and the ~45-line
publishing boilerplate (licence, developer, SCM, repository) three times.
Jacoco was applied to only two of the five modules, so :app produced no
coverage report despite having 15 test classes.

Two precompiled script plugins now own that:

- titan.java-conventions: toolchain 25, javac options (--release, UTF-8,
  -Xlint:deprecation/unchecked), JUnit Platform + minestom.inside-test,
  Jacoco with an XML report wired to test
- titan.publish-conventions: the "maven" publication with coordinates,
  POM metadata and the OneLiteFeather repository. Modules keep only what
  actually differs - artifactId, POM name/description and the artifacts.

The Shadow plugin version is declared once in the root build with
`apply false` instead of being repeated in :app and :setup.

No change to build output. Verified against a pre-change baseline:
identical entry listings for all seven jars, identical generated POMs for
:app, :setup and :bridge, identical publish task set, and identical test
results (21 classes, 56 tests). The only dependency-graph difference is
the jacocoAgent/jacocoAnt tooling configurations in the three modules that
gained Jacoco; they reach no compile or runtime class path.

-Xlint:deprecation now surfaces five pre-existing warnings for the
deprecated Aves GsonFileHandler and AnvilLoader(Path). They are left as
warnings on purpose - replacing them is separate work.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QtbnMbAj6m2q3vrDYFizDr
@TheMeinerLP
TheMeinerLP force-pushed the build/buildsrc-conventions branch from c9a0860 to 00dfaed Compare August 27, 2026 20:03
@TheMeinerLP
TheMeinerLP merged commit 131fc62 into main Aug 28, 2026
7 checks passed
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.

1 participant