Skip to content

Commit 90c1703

Browse files
soloturnclaude
andcommitted
build: convert Gradle build scripts from Groovy to Kotlin DSL
Converts every .gradle file in the repo (root, build-logic's precompiled plugins, desktop/engine/modules/templates) to .gradle.kts. Notable non-mechanical changes required along the way: - build-logic switches from the groovy-gradle-plugin to kotlin-dsl plugin; its precompiled scripts move from src/main/groovy to src/main/kotlin. - GestaltExtension is extracted into its own GestaltExtension.kt: Kotlin script files don't share top-level type declarations across files the way Groovy scripts implicitly do. - Several scripts (destination-sol-jre, destination-sol-module, engine/build.gradle.kts, desktop/build.gradle.kts) look up the base/idea/eclipse extensions explicitly via the<T>()/configure<T>() instead of the generated type-safe accessors: those plugins are applied transitively through another precompiled plugin rather than directly in the consuming script's own plugins{} block, and Gradle's accessor generation doesn't chase through that chain. - destination-sol-ide.gradle.kts's IDEA XML patching (compiler.xml, misc.xml, checkstyle-idea.xml) is ported off Groovy's Node '.@attr' sugar onto groovy.util.Node's plain Java API via small child()/attr() helpers. Verified by actually running `gradlew idea` - not just compiling - since this is exactly the kind of dynamically-typed code a naive port could silently get wrong. - gestalt-module.gradle.kts's module.json/module.txt parsing moves from Groovy's JsonSlurper to Gson (added as a build-logic dependency), fully typed. - The publishing blocks in gestalt-module, terasology-publish-common and destination-sol-module all configure the same, project-name-keyed MavenPublication. Groovy's "$project.name"(MavenPublication){} sugar silently reconfigures an existing publication; Kotlin's create<>() does not, it throws. Switched all three to maybeCreate(). - Dropped ipr.withXml{}/workspace.iws.withXml{} calls to ideaActivateCheckstyle/Copyright/Annotations/Git/Gradle, ideaMakeAutomatically and ideaRunConfig in the root build script: none of the 7 functions have existed since config/gradle/ide.gradle was deleted in 6819386 (Dec 2022). Groovy only fails on missing methods at runtime, when `gradle idea`/`ipr`/`iws` actually executes, which nothing does - so this has been silently dead for ~3 years. Kept the one working sibling line (wildcards.remove) alongside it. - .gitignore's !modules/subprojects.gradle and !libs/subprojects.gradle negations are updated to the new .kts filenames, otherwise the broader modules/*/libs/* ignore rules swallow the renamed files. Verified: gradlew help configures the full project (root, build-logic, desktop, engine, templates, and the auto-templated modules:core). :engine:compileJava and :desktop:compileJava both build clean. gradlew idea and :desktop:eclipse both run end-to-end, exercising the hand-ported XML logic at runtime rather than just at compile time. No behavior change intended anywhere in this diff; the findbugs -> error-prone swap is a separate, follow-up PR. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 2807a6e commit 90c1703

41 files changed

Lines changed: 1278 additions & 1230 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.gitignore‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ gwt
1111
steam
1212
modules/*
1313
modules/**/build.gradle
14+
modules/**/build.gradle.kts
1415
!modules/core
15-
!modules/subprojects.gradle
16+
!modules/subprojects.gradle.kts
1617
libs/*
17-
!libs/subprojects.gradle
18+
!libs/subprojects.gradle.kts
1819

1920
## GWT
2021
war/

‎build-logic/build.gradle‎

Lines changed: 0 additions & 19 deletions
This file was deleted.

‎build-logic/build.gradle.kts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
plugins {
2+
`kotlin-dsl`
3+
}
4+
5+
repositories {
6+
gradlePluginPortal()
7+
}
8+
9+
dependencies {
10+
implementation("com.google.code.gson:gson:2.10.1")
11+
implementation("com.github.spotbugs.snom:spotbugs-gradle-plugin:5.2.3")
12+
implementation("ru.vyarus:gradle-animalsniffer-plugin:2.0.1")
13+
implementation("de.undercouch:gradle-download-task:5.7.0")
14+
implementation("gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:1.4.1")
15+
}

‎build-logic/src/main/groovy/destination-sol-constants.gradle‎

Lines changed: 0 additions & 11 deletions
This file was deleted.

‎build-logic/src/main/groovy/destination-sol-ide.gradle‎

Lines changed: 0 additions & 87 deletions
This file was deleted.

‎build-logic/src/main/groovy/destination-sol-java.gradle‎

Lines changed: 0 additions & 33 deletions
This file was deleted.

‎build-logic/src/main/groovy/destination-sol-jre.gradle‎

Lines changed: 0 additions & 73 deletions
This file was deleted.

‎build-logic/src/main/groovy/destination-sol-module.gradle‎

Lines changed: 0 additions & 76 deletions
This file was deleted.

‎build-logic/src/main/groovy/destination-sol-repositories.gradle‎

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)