From aa67612a6034a8c6411ee846a9738c3862833bdf Mon Sep 17 00:00:00 2001 From: LostLuma Date: Fri, 12 Jul 2024 15:25:07 +0200 Subject: [PATCH 1/3] Fix version generation / Loom warning --- .../groovy/kit_tunes.base_mod_conventions.gradle | 11 ++++++++--- .../groovy/kit_tunes.game_mod_conventions.gradle | 4 +++- ...nes.java.8.gradle => kit_tunes.java.08.gradle} | 0 .../kit_tunes/build_logic/ProjectMetadata.java | 15 ++++++++------- build.gradle | 1 - 5 files changed, 19 insertions(+), 12 deletions(-) rename build-logic/src/main/groovy/{kit_tunes.java.8.gradle => kit_tunes.java.08.gradle} (100%) diff --git a/build-logic/src/main/groovy/kit_tunes.base_mod_conventions.gradle b/build-logic/src/main/groovy/kit_tunes.base_mod_conventions.gradle index 637c3ef..603c22d 100644 --- a/build-logic/src/main/groovy/kit_tunes.base_mod_conventions.gradle +++ b/build-logic/src/main/groovy/kit_tunes.base_mod_conventions.gradle @@ -6,13 +6,16 @@ plugins { ext.metadata = new ProjectMetadata(project) +version = project.mod_version +maven_group = project.maven_group + base { - archivesName = metadata.base_file_name() + archivesName = metadata.archiveName() } loom { mods { - "${metadata.mod_id()}" { + "${metadata.modId()}" { sourceSet("main") } } @@ -23,7 +26,9 @@ dependencies { } processResources { + inputs.property("version", metadata.version()) + filesMatching('quilt.mod.json') { - expand 'version': project.mod_version + expand 'version': metadata.version() } } diff --git a/build-logic/src/main/groovy/kit_tunes.game_mod_conventions.gradle b/build-logic/src/main/groovy/kit_tunes.game_mod_conventions.gradle index ce9de80..5993bd3 100644 --- a/build-logic/src/main/groovy/kit_tunes.game_mod_conventions.gradle +++ b/build-logic/src/main/groovy/kit_tunes.game_mod_conventions.gradle @@ -11,6 +11,8 @@ dependencies { } } +version = metadata.gameModVersion() + base { - archivesName = metadata.game_mod_file_name() + archivesName = metadata.archiveName() } diff --git a/build-logic/src/main/groovy/kit_tunes.java.8.gradle b/build-logic/src/main/groovy/kit_tunes.java.08.gradle similarity index 100% rename from build-logic/src/main/groovy/kit_tunes.java.8.gradle rename to build-logic/src/main/groovy/kit_tunes.java.08.gradle diff --git a/build-logic/src/main/java/net/pixaurora/kit_tunes/build_logic/ProjectMetadata.java b/build-logic/src/main/java/net/pixaurora/kit_tunes/build_logic/ProjectMetadata.java index 86ca76f..5817e99 100644 --- a/build-logic/src/main/java/net/pixaurora/kit_tunes/build_logic/ProjectMetadata.java +++ b/build-logic/src/main/java/net/pixaurora/kit_tunes/build_logic/ProjectMetadata.java @@ -11,7 +11,7 @@ public ProjectMetadata(Project project) { this.properties = new ProjectProperties(project); } - public String mod_id() { + public String modId() { String modId = String.valueOf(properties.requireString(Property.BASE_MOD_ID)); Optional subModId = properties.optionalString(Property.SUB_MOD_ID); @@ -23,14 +23,15 @@ public String mod_id() { return modId; } - public String base_file_name() { - String modId = this.mod_id().replace("_", "-"); + public String version() { + return this.properties.requireString(Property.MOD_VERSION); + } - return modId + "-" + this.properties.requireString(Property.UPDATE_TITLE) + "-" - + this.properties.requireString(Property.MOD_VERSION); + public String archiveName() { + return this.modId().replace("_", "-") + "-" + this.properties.requireString(Property.UPDATE_TITLE); } - public String game_mod_file_name() { - return this.base_file_name() + "+minecraft-" + this.properties.requireString(Property.MINECRAFT_VERSION); + public String gameModVersion() { + return this.version() + "+minecraft-" + this.properties.requireString(Property.MINECRAFT_VERSION); } } diff --git a/build.gradle b/build.gradle index 8157d67..b9bc0ba 100644 --- a/build.gradle +++ b/build.gradle @@ -25,7 +25,6 @@ dependencies { include project(':subprojects:ui:r1.20.4') include project(':subprojects:ui:r1.21.0') - } // If you plan to use a different file for the license, don't forget to change the file name here! From 2951ea0f4d8c0a19a98798854550194f543d138f Mon Sep 17 00:00:00 2001 From: LostLuma Date: Fri, 12 Jul 2024 15:52:05 +0200 Subject: [PATCH 2/3] Build API and core without Loom --- .../src/main/groovy/kit_tunes.base.gradle | 26 +++++++++++++++++++ .../kit_tunes.base_mod_conventions.gradle | 20 +------------- .../kit_tunes.game_mod_conventions.gradle | 12 ++++----- build.gradle | 6 +---- gradle/libs.versions.toml | 10 +++++-- subprojects/api/build.gradle | 4 +-- subprojects/core/build.gradle | 8 ++++-- 7 files changed, 50 insertions(+), 36 deletions(-) create mode 100644 build-logic/src/main/groovy/kit_tunes.base.gradle diff --git a/build-logic/src/main/groovy/kit_tunes.base.gradle b/build-logic/src/main/groovy/kit_tunes.base.gradle new file mode 100644 index 0000000..46c008f --- /dev/null +++ b/build-logic/src/main/groovy/kit_tunes.base.gradle @@ -0,0 +1,26 @@ +import net.pixaurora.kit_tunes.build_logic.ProjectMetadata + +ext.metadata = new ProjectMetadata(project) + +version = project.mod_version +maven_group = project.maven_group + +base { + archivesName = metadata.archiveName() +} + +repositories { + mavenCentral() + maven { + name = 'Quilt' + url = 'https://maven.quiltmc.org/repository/release' + } +} + +processResources { + inputs.property("version", metadata.version()) + + filesMatching('quilt.mod.json') { + expand 'version': metadata.version() + } +} diff --git a/build-logic/src/main/groovy/kit_tunes.base_mod_conventions.gradle b/build-logic/src/main/groovy/kit_tunes.base_mod_conventions.gradle index 603c22d..0e91482 100644 --- a/build-logic/src/main/groovy/kit_tunes.base_mod_conventions.gradle +++ b/build-logic/src/main/groovy/kit_tunes.base_mod_conventions.gradle @@ -1,18 +1,8 @@ -import net.pixaurora.kit_tunes.build_logic.ProjectMetadata - plugins { + id 'kit_tunes.base' id 'org.quiltmc.loom' } -ext.metadata = new ProjectMetadata(project) - -version = project.mod_version -maven_group = project.maven_group - -base { - archivesName = metadata.archiveName() -} - loom { mods { "${metadata.modId()}" { @@ -24,11 +14,3 @@ loom { dependencies { modImplementation libs.quilt.loader } - -processResources { - inputs.property("version", metadata.version()) - - filesMatching('quilt.mod.json') { - expand 'version': metadata.version() - } -} diff --git a/build-logic/src/main/groovy/kit_tunes.game_mod_conventions.gradle b/build-logic/src/main/groovy/kit_tunes.game_mod_conventions.gradle index 5993bd3..0821575 100644 --- a/build-logic/src/main/groovy/kit_tunes.game_mod_conventions.gradle +++ b/build-logic/src/main/groovy/kit_tunes.game_mod_conventions.gradle @@ -2,6 +2,12 @@ plugins { id 'kit_tunes.base_mod_conventions' } +version = metadata.gameModVersion() + +base { + archivesName = metadata.archiveName() +} + dependencies { minecraft "com.mojang:minecraft:${project.minecraft_version}" @@ -10,9 +16,3 @@ dependencies { officialMojangMappings() } } - -version = metadata.gameModVersion() - -base { - archivesName = metadata.archiveName() -} diff --git a/build.gradle b/build.gradle index b9bc0ba..e57b360 100644 --- a/build.gradle +++ b/build.gradle @@ -12,11 +12,7 @@ repositories { // See https://docs.gradle.org/current/userguide/platforms.html for information on how version catalogs work. dependencies { minecraft libs.minecraft - - mappings loom.layered { - mappings "org.quiltmc:quilt-mappings:${libs.versions.quilt.mappings.get()}:intermediary-v2" - officialMojangMappings() - } + mappings loom.officialMojangMappings() include project(':subprojects:api') include project(':subprojects:core') diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 00d34f1..b384777 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,4 @@ [versions] -# The latest versions are available at https://lambdaurora.dev/tools/import_quilt.html minecraft = "1.20.4" quilt_mappings = "1.20.4+build.3" @@ -8,6 +7,10 @@ quilt_loader = "0.26.0" qsl = "8.0.0-alpha.11+1.20.4" +annotations = "24.1.0" +gson = "2.11.0" +slf4j = "2.0.13" + [libraries] minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" } @@ -16,7 +19,10 @@ quilt_loader = { module = "org.quiltmc:quilt-loader", version.ref = "quilt_loade qsl_resource_loader = { module = "org.quiltmc.qsl.core:resource_loader", version.ref = "qsl"} -# If you have multiple similar dependencies, you can declare a dependency bundle and reference it on the build script with "libs.bundles.example". +annotations = { module = "org.jetbrains:annotations", version.ref = "annotations" } +gson = { module = "com.google.code.gson:gson", version.ref = "gson" } +slf4j = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } + [bundles] [plugins] diff --git a/subprojects/api/build.gradle b/subprojects/api/build.gradle index 31570b1..3d110f1 100644 --- a/subprojects/api/build.gradle +++ b/subprojects/api/build.gradle @@ -1,4 +1,4 @@ plugins { - id 'kit_tunes.java.17' - id 'kit_tunes.library_mod_conventions' + id 'kit_tunes.java.08' + id 'kit_tunes.base' } diff --git a/subprojects/core/build.gradle b/subprojects/core/build.gradle index fb38c21..0f08068 100644 --- a/subprojects/core/build.gradle +++ b/subprojects/core/build.gradle @@ -1,8 +1,12 @@ plugins { - id 'kit_tunes.java.17' - id 'kit_tunes.library_mod_conventions' + id 'kit_tunes.java.17' // TODO: Switch to kit_tunes.java.08 + id 'kit_tunes.base' } dependencies { implementation project(':subprojects:api') + implementation(libs.annotations) + implementation(libs.quilt.loader) + implementation(libs.gson) + implementation(libs.slf4j) } From 833af089ebec889eda8c2b1353550dc72046a885 Mon Sep 17 00:00:00 2001 From: LostLuma Date: Fri, 12 Jul 2024 18:56:45 +0200 Subject: [PATCH 3/3] Convert build scripts to Kotlin --- build-logic/build.gradle | 20 ------------ build-logic/build.gradle.kts | 24 ++++++++++++++ .../{settings.gradle => settings.gradle.kts} | 4 +-- .../src/main/groovy/kit_tunes.base.gradle | 26 ---------------- .../kit_tunes.base_mod_conventions.gradle | 16 ---------- .../kit_tunes.game_mod_conventions.gradle | 18 ----------- .../src/main/groovy/kit_tunes.java.08.gradle | 19 ------------ .../src/main/groovy/kit_tunes.java.17.gradle | 19 ------------ .../src/main/groovy/kit_tunes.java.21.gradle | 19 ------------ .../kit_tunes.library_mod_conventions.gradle | 12 ------- .../build_logic/ProjectMetadata.java | 18 +++++++++-- .../kit_tunes/build_logic/Property.java | 7 +++-- .../src/main/kotlin/kit_tunes.base.gradle.kts | 30 ++++++++++++++++++ .../main/kotlin/kit_tunes.java.08.gradle.kts | 19 ++++++++++++ .../main/kotlin/kit_tunes.java.17.gradle.kts | 19 ++++++++++++ .../main/kotlin/kit_tunes.java.21.gradle.kts | 19 ++++++++++++ .../main/kotlin/kit_tunes.module.gradle.kts | 21 +++++++++++++ build.gradle | 31 ------------------- build.gradle.kts | 18 +++++++++++ gradle.properties | 2 +- settings.gradle | 28 ----------------- settings.gradle.kts | 28 +++++++++++++++++ subprojects/api/build.gradle | 4 --- subprojects/api/build.gradle.kts | 4 +++ subprojects/core/build.gradle | 12 ------- subprojects/core/build.gradle.kts | 13 ++++++++ subprojects/sound_events/r1.20.4/build.gradle | 9 ------ .../sound_events/r1.20.4/build.gradle.kts | 9 ++++++ .../sound_events/r1.20.4/gradle.properties | 2 +- subprojects/ui/r1.20.4/build.gradle | 20 ------------ subprojects/ui/r1.20.4/build.gradle.kts | 20 ++++++++++++ subprojects/ui/r1.20.4/gradle.properties | 2 +- subprojects/ui/r1.21.0/build.gradle | 20 ------------ subprojects/ui/r1.21.0/build.gradle.kts | 20 ++++++++++++ subprojects/ui/r1.21.0/gradle.properties | 2 +- 35 files changed, 270 insertions(+), 284 deletions(-) delete mode 100644 build-logic/build.gradle create mode 100644 build-logic/build.gradle.kts rename build-logic/{settings.gradle => settings.gradle.kts} (72%) delete mode 100644 build-logic/src/main/groovy/kit_tunes.base.gradle delete mode 100644 build-logic/src/main/groovy/kit_tunes.base_mod_conventions.gradle delete mode 100644 build-logic/src/main/groovy/kit_tunes.game_mod_conventions.gradle delete mode 100644 build-logic/src/main/groovy/kit_tunes.java.08.gradle delete mode 100644 build-logic/src/main/groovy/kit_tunes.java.17.gradle delete mode 100644 build-logic/src/main/groovy/kit_tunes.java.21.gradle delete mode 100644 build-logic/src/main/groovy/kit_tunes.library_mod_conventions.gradle create mode 100644 build-logic/src/main/kotlin/kit_tunes.base.gradle.kts create mode 100644 build-logic/src/main/kotlin/kit_tunes.java.08.gradle.kts create mode 100644 build-logic/src/main/kotlin/kit_tunes.java.17.gradle.kts create mode 100644 build-logic/src/main/kotlin/kit_tunes.java.21.gradle.kts create mode 100644 build-logic/src/main/kotlin/kit_tunes.module.gradle.kts delete mode 100644 build.gradle create mode 100644 build.gradle.kts delete mode 100644 settings.gradle create mode 100644 settings.gradle.kts delete mode 100644 subprojects/api/build.gradle create mode 100644 subprojects/api/build.gradle.kts delete mode 100644 subprojects/core/build.gradle create mode 100644 subprojects/core/build.gradle.kts delete mode 100644 subprojects/sound_events/r1.20.4/build.gradle create mode 100644 subprojects/sound_events/r1.20.4/build.gradle.kts delete mode 100644 subprojects/ui/r1.20.4/build.gradle create mode 100644 subprojects/ui/r1.20.4/build.gradle.kts delete mode 100644 subprojects/ui/r1.21.0/build.gradle create mode 100644 subprojects/ui/r1.21.0/build.gradle.kts diff --git a/build-logic/build.gradle b/build-logic/build.gradle deleted file mode 100644 index da165f1..0000000 --- a/build-logic/build.gradle +++ /dev/null @@ -1,20 +0,0 @@ -plugins { - id 'groovy-gradle-plugin' -} - -repositories { - maven { - name = 'Quilt' - url = 'https://maven.quiltmc.org/repository/release' - } - // Currently needed for Intermediary and other temporary dependencies - maven { - name = 'Fabric' - url = 'https://maven.fabricmc.net/' - } - gradlePluginPortal() -} - -dependencies { - implementation libs.quilt.loom -} diff --git a/build-logic/build.gradle.kts b/build-logic/build.gradle.kts new file mode 100644 index 0000000..cdbcb0c --- /dev/null +++ b/build-logic/build.gradle.kts @@ -0,0 +1,24 @@ +plugins { + `kotlin-dsl` +} + +repositories { + maven { + name = "Quilt" + url = uri("https://maven.quiltmc.org/repository/release") + } + // Currently needed for Intermediary and other temporary dependencies + maven { + name = "Fabric" + url = uri("https://maven.fabricmc.net/") + } + gradlePluginPortal() +} + +dependencies { + implementation(libs.quilt.loom) +} + +kotlin { + jvmToolchain(21) +} diff --git a/build-logic/settings.gradle b/build-logic/settings.gradle.kts similarity index 72% rename from build-logic/settings.gradle rename to build-logic/settings.gradle.kts index 33cf82b..4052c4e 100644 --- a/build-logic/settings.gradle +++ b/build-logic/settings.gradle.kts @@ -4,9 +4,9 @@ pluginManagement { } } -dependencyResolutionManagement{ +dependencyResolutionManagement { versionCatalogs { - libs { + create("libs") { from(files("../gradle/libs.versions.toml")) } } diff --git a/build-logic/src/main/groovy/kit_tunes.base.gradle b/build-logic/src/main/groovy/kit_tunes.base.gradle deleted file mode 100644 index 46c008f..0000000 --- a/build-logic/src/main/groovy/kit_tunes.base.gradle +++ /dev/null @@ -1,26 +0,0 @@ -import net.pixaurora.kit_tunes.build_logic.ProjectMetadata - -ext.metadata = new ProjectMetadata(project) - -version = project.mod_version -maven_group = project.maven_group - -base { - archivesName = metadata.archiveName() -} - -repositories { - mavenCentral() - maven { - name = 'Quilt' - url = 'https://maven.quiltmc.org/repository/release' - } -} - -processResources { - inputs.property("version", metadata.version()) - - filesMatching('quilt.mod.json') { - expand 'version': metadata.version() - } -} diff --git a/build-logic/src/main/groovy/kit_tunes.base_mod_conventions.gradle b/build-logic/src/main/groovy/kit_tunes.base_mod_conventions.gradle deleted file mode 100644 index 0e91482..0000000 --- a/build-logic/src/main/groovy/kit_tunes.base_mod_conventions.gradle +++ /dev/null @@ -1,16 +0,0 @@ -plugins { - id 'kit_tunes.base' - id 'org.quiltmc.loom' -} - -loom { - mods { - "${metadata.modId()}" { - sourceSet("main") - } - } -} - -dependencies { - modImplementation libs.quilt.loader -} diff --git a/build-logic/src/main/groovy/kit_tunes.game_mod_conventions.gradle b/build-logic/src/main/groovy/kit_tunes.game_mod_conventions.gradle deleted file mode 100644 index 0821575..0000000 --- a/build-logic/src/main/groovy/kit_tunes.game_mod_conventions.gradle +++ /dev/null @@ -1,18 +0,0 @@ -plugins { - id 'kit_tunes.base_mod_conventions' -} - -version = metadata.gameModVersion() - -base { - archivesName = metadata.archiveName() -} - -dependencies { - minecraft "com.mojang:minecraft:${project.minecraft_version}" - - mappings loom.layered { - mappings "org.quiltmc:quilt-mappings:${project.quilt_mappings_version}:intermediary-v2" - officialMojangMappings() - } -} diff --git a/build-logic/src/main/groovy/kit_tunes.java.08.gradle b/build-logic/src/main/groovy/kit_tunes.java.08.gradle deleted file mode 100644 index 173236a..0000000 --- a/build-logic/src/main/groovy/kit_tunes.java.08.gradle +++ /dev/null @@ -1,19 +0,0 @@ -plugins { - id 'java' -} - -java { - withSourcesJar() - - toolchain { - languageVersion = JavaLanguageVersion.of(8) - } -} - -tasks.withType(JavaCompile).configureEach { - it.options.encoding = "UTF-8" - - javaCompiler = javaToolchains.compilerFor { - languageVersion = JavaLanguageVersion.of(8) - } -} diff --git a/build-logic/src/main/groovy/kit_tunes.java.17.gradle b/build-logic/src/main/groovy/kit_tunes.java.17.gradle deleted file mode 100644 index c088290..0000000 --- a/build-logic/src/main/groovy/kit_tunes.java.17.gradle +++ /dev/null @@ -1,19 +0,0 @@ -plugins { - id 'java' -} - -java { - withSourcesJar() - - toolchain { - languageVersion = JavaLanguageVersion.of(17) - } -} - -tasks.withType(JavaCompile).configureEach { - it.options.encoding = "UTF-8" - - javaCompiler = javaToolchains.compilerFor { - languageVersion = JavaLanguageVersion.of(17) - } -} diff --git a/build-logic/src/main/groovy/kit_tunes.java.21.gradle b/build-logic/src/main/groovy/kit_tunes.java.21.gradle deleted file mode 100644 index 2dd436d..0000000 --- a/build-logic/src/main/groovy/kit_tunes.java.21.gradle +++ /dev/null @@ -1,19 +0,0 @@ -plugins { - id 'java' -} - -java { - withSourcesJar() - - toolchain { - languageVersion = JavaLanguageVersion.of(21) - } -} - -tasks.withType(JavaCompile).configureEach { - it.options.encoding = "UTF-8" - - javaCompiler = javaToolchains.compilerFor { - languageVersion = JavaLanguageVersion.of(21) - } -} diff --git a/build-logic/src/main/groovy/kit_tunes.library_mod_conventions.gradle b/build-logic/src/main/groovy/kit_tunes.library_mod_conventions.gradle deleted file mode 100644 index c5889a1..0000000 --- a/build-logic/src/main/groovy/kit_tunes.library_mod_conventions.gradle +++ /dev/null @@ -1,12 +0,0 @@ -plugins { - id 'kit_tunes.base_mod_conventions' -} - -dependencies { - // Minecraft should not actually be used by library mods as they can be used on any version. - minecraft 'com.mojang:minecraft:1.20.4' - - mappings loom.layered { - mappings "org.quiltmc:quilt-mappings:1.20.4+build.1:intermediary-v2" - } -} diff --git a/build-logic/src/main/java/net/pixaurora/kit_tunes/build_logic/ProjectMetadata.java b/build-logic/src/main/java/net/pixaurora/kit_tunes/build_logic/ProjectMetadata.java index 5817e99..1d6f665 100644 --- a/build-logic/src/main/java/net/pixaurora/kit_tunes/build_logic/ProjectMetadata.java +++ b/build-logic/src/main/java/net/pixaurora/kit_tunes/build_logic/ProjectMetadata.java @@ -5,9 +5,11 @@ import org.gradle.api.Project; public class ProjectMetadata { + private final Project project; private final ProjectProperties properties; public ProjectMetadata(Project project) { + this.project = project; this.properties = new ProjectProperties(project); } @@ -28,10 +30,20 @@ public String version() { } public String archiveName() { - return this.modId().replace("_", "-") + "-" + this.properties.requireString(Property.UPDATE_TITLE); + String base = this.modId().replace("_", "-"); + + if (this.isRootProject()) { + base += "-" + this.properties.requireString(Property.UPDATE_TITLE); + } + + if (!this.project.hasProperty(Property.MINECRAFT_VERSION_MIN.key())) { + return base; + } else { + return base + "-minecraft-" + this.properties.requireString(Property.MINECRAFT_VERSION_MIN); + } } - public String gameModVersion() { - return this.version() + "+minecraft-" + this.properties.requireString(Property.MINECRAFT_VERSION); + private boolean isRootProject() { + return this.project.getRootProject().equals(this.project); } } diff --git a/build-logic/src/main/java/net/pixaurora/kit_tunes/build_logic/Property.java b/build-logic/src/main/java/net/pixaurora/kit_tunes/build_logic/Property.java index 7c2dd86..148788f 100644 --- a/build-logic/src/main/java/net/pixaurora/kit_tunes/build_logic/Property.java +++ b/build-logic/src/main/java/net/pixaurora/kit_tunes/build_logic/Property.java @@ -1,8 +1,11 @@ package net.pixaurora.kit_tunes.build_logic; public enum Property { - BASE_MOD_ID("archives_base_name"), SUB_MOD_ID("sub_mod_name"), MOD_VERSION("mod_version"), - UPDATE_TITLE("update_title"), MINECRAFT_VERSION("minecraft_version"); + BASE_MOD_ID("archives_base_name"), + SUB_MOD_ID("sub_mod_name"), + MOD_VERSION("mod_version"), + UPDATE_TITLE("update_title"), + MINECRAFT_VERSION_MIN("minecraft_version_min"); private final String key; diff --git a/build-logic/src/main/kotlin/kit_tunes.base.gradle.kts b/build-logic/src/main/kotlin/kit_tunes.base.gradle.kts new file mode 100644 index 0000000..782d3dc --- /dev/null +++ b/build-logic/src/main/kotlin/kit_tunes.base.gradle.kts @@ -0,0 +1,30 @@ +import net.pixaurora.kit_tunes.build_logic.ProjectMetadata + +plugins { + id("base") +} + +val metadata = ProjectMetadata(project) +extra.set("metadata", metadata) + +version = metadata.version() + +base { + archivesName = metadata.archiveName() +} + +repositories { + mavenCentral() + maven { + name = "Quilt" + url = uri("https://maven.quiltmc.org/repository/release") + } +} + +tasks.withType { + inputs.property("version", metadata.version()) + + filesMatching("quilt.mod.json") { + expand(inputs.properties) + } +} diff --git a/build-logic/src/main/kotlin/kit_tunes.java.08.gradle.kts b/build-logic/src/main/kotlin/kit_tunes.java.08.gradle.kts new file mode 100644 index 0000000..85dd892 --- /dev/null +++ b/build-logic/src/main/kotlin/kit_tunes.java.08.gradle.kts @@ -0,0 +1,19 @@ +plugins { + id("java") +} + +java { + withSourcesJar() + + toolchain { + languageVersion = JavaLanguageVersion.of(8) + } +} + +tasks.withType { + options.encoding = "UTF-8" + + javaCompiler = javaToolchains.compilerFor { + languageVersion = JavaLanguageVersion.of(8) + } +} diff --git a/build-logic/src/main/kotlin/kit_tunes.java.17.gradle.kts b/build-logic/src/main/kotlin/kit_tunes.java.17.gradle.kts new file mode 100644 index 0000000..1acb975 --- /dev/null +++ b/build-logic/src/main/kotlin/kit_tunes.java.17.gradle.kts @@ -0,0 +1,19 @@ +plugins { + id("java") +} + +java { + withSourcesJar() + + toolchain { + languageVersion = JavaLanguageVersion.of(17) + } +} + +tasks.withType { + options.encoding = "UTF-8" + + javaCompiler = javaToolchains.compilerFor { + languageVersion = JavaLanguageVersion.of(17) + } +} diff --git a/build-logic/src/main/kotlin/kit_tunes.java.21.gradle.kts b/build-logic/src/main/kotlin/kit_tunes.java.21.gradle.kts new file mode 100644 index 0000000..10e67fe --- /dev/null +++ b/build-logic/src/main/kotlin/kit_tunes.java.21.gradle.kts @@ -0,0 +1,19 @@ +plugins { + id("java") +} + +java { + withSourcesJar() + + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } +} + +tasks.withType { + options.encoding = "UTF-8" + + javaCompiler = javaToolchains.compilerFor { + languageVersion = JavaLanguageVersion.of(21) + } +} diff --git a/build-logic/src/main/kotlin/kit_tunes.module.gradle.kts b/build-logic/src/main/kotlin/kit_tunes.module.gradle.kts new file mode 100644 index 0000000..0f29382 --- /dev/null +++ b/build-logic/src/main/kotlin/kit_tunes.module.gradle.kts @@ -0,0 +1,21 @@ +import net.pixaurora.kit_tunes.build_logic.ProjectMetadata + +plugins { + id("kit_tunes.base") + id("org.quiltmc.loom") +} + +val metadata = extra.get("metadata") as ProjectMetadata + +loom { + mods.create(metadata.modId()) { + sourceSet(sourceSets.main.get()) + } +} + +dependencies { + modImplementation("org.quiltmc:quilt-loader:0.26.0") + + mappings(loom.officialMojangMappings()) + minecraft("com.mojang:minecraft:${project.property("minecraft_version")}") +} diff --git a/build.gradle b/build.gradle deleted file mode 100644 index e57b360..0000000 --- a/build.gradle +++ /dev/null @@ -1,31 +0,0 @@ -plugins { - id 'kit_tunes.java.17' - id 'kit_tunes.base_mod_conventions' -} - -group = project.maven_group - -repositories { -} - -// All the dependencies are declared at gradle/libs.version.toml and referenced with "libs." -// See https://docs.gradle.org/current/userguide/platforms.html for information on how version catalogs work. -dependencies { - minecraft libs.minecraft - mappings loom.officialMojangMappings() - - include project(':subprojects:api') - include project(':subprojects:core') - - include project(':subprojects:sound_events:r1.20.4') - - include project(':subprojects:ui:r1.20.4') - include project(':subprojects:ui:r1.21.0') -} - -// If you plan to use a different file for the license, don't forget to change the file name here! -jar { - from('LICENSE') { - rename { "${it}_${base.archivesName.get()}" } - } -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..c386d1c --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,18 @@ +plugins { + id("kit_tunes.java.17") + id("kit_tunes.module") +} + +dependencies { + include(project(":subprojects:api")) + include(project(":subprojects:core")) + + include(project(":subprojects:sound_events:r1.20.4")) + + include(project(":subprojects:ui:r1.20.4")) + include(project(":subprojects:ui:r1.21.0")) +} + +tasks.withType { + from("LICENSE") +} diff --git a/gradle.properties b/gradle.properties index 103e2d2..1eae0b4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,4 +9,4 @@ update_title = axolotl maven_group = net.pixaurora archives_base_name = kit_tunes -# Dependencies are managed at gradle/libs.versions.toml +minecraft_version = 1.20.4 diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 41c7289..0000000 --- a/settings.gradle +++ /dev/null @@ -1,28 +0,0 @@ -pluginManagement { - repositories { - maven { - name = 'Quilt' - url = 'https://maven.quiltmc.org/repository/release' - } - // Currently needed for Intermediary and other temporary dependencies - maven { - name = 'Fabric' - url = 'https://maven.fabricmc.net/' - } - gradlePluginPortal() - } -} - -plugins { - id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" -} - -includeBuild 'build-logic' - -include('subprojects:api') -include('subprojects:core') - -include('subprojects:sound_events:r1.20.4') - -include('subprojects:ui:r1.20.4') -include('subprojects:ui:r1.21.0') diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..77cbe21 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + repositories { + maven { + name = "Quilt" + url = uri("https://maven.quiltmc.org/repository/release") + } + // Currently needed for Intermediary and other temporary dependencies + maven { + name = "Fabric" + url = uri("https://maven.fabricmc.net/") + } + gradlePluginPortal() + } +} + +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" +} + +includeBuild("build-logic") + +include("subprojects:api") +include("subprojects:core") + +include("subprojects:sound_events:r1.20.4") + +include("subprojects:ui:r1.20.4") +include("subprojects:ui:r1.21.0") diff --git a/subprojects/api/build.gradle b/subprojects/api/build.gradle deleted file mode 100644 index 3d110f1..0000000 --- a/subprojects/api/build.gradle +++ /dev/null @@ -1,4 +0,0 @@ -plugins { - id 'kit_tunes.java.08' - id 'kit_tunes.base' -} diff --git a/subprojects/api/build.gradle.kts b/subprojects/api/build.gradle.kts new file mode 100644 index 0000000..4df8177 --- /dev/null +++ b/subprojects/api/build.gradle.kts @@ -0,0 +1,4 @@ +plugins { + id("kit_tunes.java.08") + id("kit_tunes.base") +} diff --git a/subprojects/core/build.gradle b/subprojects/core/build.gradle deleted file mode 100644 index 0f08068..0000000 --- a/subprojects/core/build.gradle +++ /dev/null @@ -1,12 +0,0 @@ -plugins { - id 'kit_tunes.java.17' // TODO: Switch to kit_tunes.java.08 - id 'kit_tunes.base' -} - -dependencies { - implementation project(':subprojects:api') - implementation(libs.annotations) - implementation(libs.quilt.loader) - implementation(libs.gson) - implementation(libs.slf4j) -} diff --git a/subprojects/core/build.gradle.kts b/subprojects/core/build.gradle.kts new file mode 100644 index 0000000..eb62ceb --- /dev/null +++ b/subprojects/core/build.gradle.kts @@ -0,0 +1,13 @@ +plugins { + id("kit_tunes.java.17") // TODO: Switch to kit_tunes.java.08 + id("kit_tunes.base") +} + +dependencies { + implementation(project(":subprojects:api")) + + implementation(libs.annotations) + implementation(libs.quilt.loader) + implementation(libs.gson) + implementation(libs.slf4j) +} diff --git a/subprojects/sound_events/r1.20.4/build.gradle b/subprojects/sound_events/r1.20.4/build.gradle deleted file mode 100644 index f41a726..0000000 --- a/subprojects/sound_events/r1.20.4/build.gradle +++ /dev/null @@ -1,9 +0,0 @@ -plugins { - id 'kit_tunes.java.17' - id 'kit_tunes.game_mod_conventions' -} - -dependencies { - implementation project(':subprojects:api') - implementation project(':subprojects:core') -} diff --git a/subprojects/sound_events/r1.20.4/build.gradle.kts b/subprojects/sound_events/r1.20.4/build.gradle.kts new file mode 100644 index 0000000..2c2cf50 --- /dev/null +++ b/subprojects/sound_events/r1.20.4/build.gradle.kts @@ -0,0 +1,9 @@ +plugins { + id("kit_tunes.java.17") + id("kit_tunes.module") +} + +dependencies { + implementation(project(":subprojects:api")) + implementation(project(":subprojects:core")) +} diff --git a/subprojects/sound_events/r1.20.4/gradle.properties b/subprojects/sound_events/r1.20.4/gradle.properties index bc62651..ff3e1f7 100644 --- a/subprojects/sound_events/r1.20.4/gradle.properties +++ b/subprojects/sound_events/r1.20.4/gradle.properties @@ -1,5 +1,5 @@ # Mod properties sub_mod_name = sound_events +minecraft_version_min = 1.20.4 minecraft_version = 1.20.4 -quilt_mappings_version = 1.20.4+build.3 diff --git a/subprojects/ui/r1.20.4/build.gradle b/subprojects/ui/r1.20.4/build.gradle deleted file mode 100644 index 86bae40..0000000 --- a/subprojects/ui/r1.20.4/build.gradle +++ /dev/null @@ -1,20 +0,0 @@ -plugins { - id 'kit_tunes.java.17' - id 'kit_tunes.game_mod_conventions' -} - -repositories { - maven { - name = "Terraformers" - url = "https://maven.terraformersmc.com/" - } -} - -dependencies { - implementation project(':subprojects:api') - implementation project(':subprojects:core') - - modImplementation libs.qsl.resource.loader - - modImplementation "com.terraformersmc:modmenu:${project.modmenu_version}" -} diff --git a/subprojects/ui/r1.20.4/build.gradle.kts b/subprojects/ui/r1.20.4/build.gradle.kts new file mode 100644 index 0000000..3c5ee83 --- /dev/null +++ b/subprojects/ui/r1.20.4/build.gradle.kts @@ -0,0 +1,20 @@ +plugins { + id("kit_tunes.java.17") + id("kit_tunes.module") +} + +repositories { + maven { + name = "Terraformers" + url = uri("https://maven.terraformersmc.com/") + } +} + +dependencies { + implementation(project(":subprojects:api")) + implementation(project(":subprojects:core")) + + modImplementation(libs.qsl.resource.loader) + + modImplementation("com.terraformersmc:modmenu:${project.property("modmenu_version")}") +} diff --git a/subprojects/ui/r1.20.4/gradle.properties b/subprojects/ui/r1.20.4/gradle.properties index 1de99cd..f74739b 100644 --- a/subprojects/ui/r1.20.4/gradle.properties +++ b/subprojects/ui/r1.20.4/gradle.properties @@ -1,7 +1,7 @@ # Mod properties sub_mod_name = ui +minecraft_version_min = 1.20.4 minecraft_version = 1.20.4 -quilt_mappings_version = 1.20.4+build.3 modmenu_version=9.2.0-beta.2 diff --git a/subprojects/ui/r1.21.0/build.gradle b/subprojects/ui/r1.21.0/build.gradle deleted file mode 100644 index 16d5740..0000000 --- a/subprojects/ui/r1.21.0/build.gradle +++ /dev/null @@ -1,20 +0,0 @@ -plugins { - id 'kit_tunes.java.21' - id 'kit_tunes.game_mod_conventions' -} - -repositories { - maven { - name = "Terraformers" - url = "https://maven.terraformersmc.com/" - } -} - -dependencies { - implementation project(':subprojects:api') - implementation project(':subprojects:core') - - modImplementation fabricApi.module("fabric-resource-loader-v0", project.fabric_api_version) - - modImplementation "com.terraformersmc:modmenu:${project.modmenu_version}" -} diff --git a/subprojects/ui/r1.21.0/build.gradle.kts b/subprojects/ui/r1.21.0/build.gradle.kts new file mode 100644 index 0000000..45a1eb4 --- /dev/null +++ b/subprojects/ui/r1.21.0/build.gradle.kts @@ -0,0 +1,20 @@ +plugins { + id("kit_tunes.java.21") + id("kit_tunes.module") +} + +repositories { + maven { + name = "Terraformers" + url = uri("https://maven.terraformersmc.com/") + } +} + +dependencies { + implementation(project(":subprojects:api")) + implementation(project(":subprojects:core")) + + modImplementation(fabricApi.module("fabric-resource-loader-v0", project.property("fabric_api_version").toString())) + + modImplementation("com.terraformersmc:modmenu:${project.property("modmenu_version")}") +} diff --git a/subprojects/ui/r1.21.0/gradle.properties b/subprojects/ui/r1.21.0/gradle.properties index 8f4d77e..c869e7b 100644 --- a/subprojects/ui/r1.21.0/gradle.properties +++ b/subprojects/ui/r1.21.0/gradle.properties @@ -1,8 +1,8 @@ # Mod properties sub_mod_name = ui +minecraft_version_min = 1.21.0 minecraft_version = 1.21 -quilt_mappings_version = 1.21+build.2 modmenu_version=9.2.0-beta.2 fabric_api_version = 0.100.1+1.21