From ab4fcee98d605fb0792d8ee37b3c9e72e1b4b9e4 Mon Sep 17 00:00:00 2001 From: SHsuperCM Date: Tue, 20 Jun 2023 17:05:34 +0300 Subject: Restructured to use stonecutter --- build.gradle | 169 ++++++++++++---------------- defaults/build.gradle | 85 +++++++++++--- defaults/src/main/resources/fabric.mod.json | 4 +- defaults/stonecutter.gradle | 3 + defaults/versions/1.20.1/gradle.properties | 6 + gradle.properties | 33 +++--- settings.gradle | 19 +++- src/main/resources/fabric.mod.json | 4 +- stonecutter.gradle | 3 + versions/1.20.1/gradle.properties | 6 + 10 files changed, 197 insertions(+), 135 deletions(-) create mode 100644 defaults/stonecutter.gradle create mode 100644 defaults/versions/1.20.1/gradle.properties create mode 100644 stonecutter.gradle create mode 100644 versions/1.20.1/gradle.properties diff --git a/build.gradle b/build.gradle index c02be24..1db46e5 100644 --- a/build.gradle +++ b/build.gradle @@ -1,123 +1,104 @@ -import java.nio.file.Files - plugins { - id 'fabric-loom' version '1.1-SNAPSHOT' apply false - id 'io.shcm.shsupercm.fabric.fletchingtable' version '1.6' apply false - id 'com.modrinth.minotaur' version '2.+' apply false - id 'com.matthewprenger.cursegradle' version '1.4.0' apply false + id 'fabric-loom' version '1.2-SNAPSHOT' + id 'io.shcm.shsupercm.fabric.fletchingtable' version '1.6' } -allprojects { - apply plugin: "fabric-loom" - apply plugin: "io.shcm.shsupercm.fabric.fletchingtable" - - version = project.mod_version + "+" + project.minecraft_version - group = project.maven_group +version = "${property('mod.version')}+${stonecutter.current().version()}" +group = 'shcm.shsupercm.fabric.citresewn' - repositories { - maven { url "https://maven.shedaniel.me/" } - maven { url "https://maven.terraformersmc.com/releases" } - maven { url "https://cursemaven.com" } - } +repositories { + maven { url 'https://maven.terraformersmc.com/releases/' } + maven { url 'https://maven.shedaniel.me/' } +} - dependencies { - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" - modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api}" - //fletchingTable.fungible project.fungible +dependencies { + minecraft "com.mojang:minecraft:${stonecutter.current().version()}" + mappings "net.fabricmc:yarn:${property('deps.yarn')}:v2" - modCompileOnly fabricApi.module("fabric-api-base", "${project.fabric_api}") - modCompileOnly fabricApi.module("fabric-resource-loader-v0", "${project.fabric_api}") - modCompileOnly fabricApi.module("fabric-command-api-v2", "${project.fabric_api}") + modImplementation "net.fabricmc:fabric-loader:${property('deps.fabric-loader')}" + modImplementation "net.fabricmc.fabric-api:fabric-api:${property('deps.fabric-api')}" - modImplementation("com.terraformersmc:modmenu:${project.modmenu}") { - exclude(group: "net.fabricmc.fabric-api") - } + modImplementation "com.terraformersmc:modmenu:${property('deps.modmenu')}" + modImplementation "me.shedaniel.cloth:cloth-config-fabric:${property('deps.cloth-config')}" - modImplementation("me.shedaniel.cloth:cloth-config-fabric:${project.cloth}") { - exclude(group: "net.fabricmc.fabric-api") - } - } + include project(":defaults:${stonecutter.current().version()}") +} - fletchingTable { - defaultMixinEnvironment = "auto" - } +fletchingTable { + defaultMixinEnvironment = "auto" +} - processResources { - inputs.property "version", rootProject.version - filteringCharset "UTF-8" +loom { + accessWidenerPath = file("../../src/main/resources/citresewn.accesswidener") - filesMatching("fabric.mod.json") { - expand "version": rootProject.version - } + runConfigs.configureEach { + ideConfigGenerated = true } +} +java { + //withSourcesJar() sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 - java { - archivesBaseName = project.archives_base_name - } - - jar { - archiveClassifier.set "dev" + archivesBaseName = property('mod.jarname') +} - from("LICENSE") { - rename { "${it}_${project.archivesBaseName}" } - } +processResources { + filesMatching('fabric.mod.json') { + expand 'mod_version': version, 'mod_target_mc': project.property('mod.target-mc') } } -apply plugin: 'com.modrinth.minotaur' -apply plugin: 'com.matthewprenger.cursegradle' +jar { + archiveClassifier.set 'dev' -loom { - accessWidenerPath = file("src/main/resources/citresewn.accesswidener") + from rootProject.file('LICENSE') } -dependencies { - afterEvaluate { - include project("defaults:") +if (stonecutter.current().isActiveVersion()) { + plugins.apply 'com.modrinth.minotaur' + plugins.apply 'com.matthewprenger.cursegradle' + + modrinth { + token = TOKEN_MODRINTH + projectId = property('publish.modrinth.id') + uploadFile = remapJar + changelog = java.nio.file.Files.readString(rootProject.file("Changelog.md").toPath()) + versionNumber = version + versionName = "v" + version + //additionalFiles = [sourcesJar.outputs.getFiles().singleFile] + gameVersions = Arrays.asList(property('mod.target-mc-publish').split(",")) } -} - -java { - withSourcesJar() -} - -modrinth { - token = TOKEN_MODRINTH - projectId = "otVJckYQ" - uploadFile = remapJar - changelog = Files.readString(projectDir.toPath().resolve("Changelog.md")) - versionNumber = version - versionName = "v" + version - additionalFiles = [ sourcesJar.outputs.getFiles().singleFile ] - gameVersions = Arrays.asList(project.publish_minecraft_versions.split(",")) -} -curseforge { - apiKey = TOKEN_CURSEFORGE - project { - id = '521427' - changelogType = 'markdown' - changelog = file('Changelog.md') - releaseType = 'release' - mainArtifact(remapJar) { - displayName = "v" + version + curseforge { + apiKey = TOKEN_CURSEFORGE + project { + id = property('publish.curseforge.id') + changelogType = 'markdown' + changelog = rootProject.file('Changelog.md') + releaseType = 'release' + mainArtifact(remapJar) { + displayName = "v" + version + } + addGameVersion 'Fabric' + for (String version : property('mod.target-mc-publish').split(",")) + addGameVersion version + } + options { + forgeGradleIntegration = false } - addGameVersion 'Fabric' - for (String version : project.publish_minecraft_versions.split(",")) - addGameVersion version } - options { - forgeGradleIntegration = false + + rootProject.tasks.register('publish') { + setGroup 'project' + + Task remapJarTask = tasks.getByName 'remapJar' + Task curseforgeTask = tasks.getByName 'curseforge' + Task modrinthTask = tasks.getByName 'modrinth' + + dependsOn remapJarTask, curseforgeTask, modrinthTask + curseforgeTask.mustRunAfter remapJarTask + modrinthTask.mustRunAfter remapJarTask } } - -task publishVersion { - dependsOn 'remapJar', 'curseforge', 'modrinth', ':defaults:modrinth' - tasks.getByName("curseforge").mustRunAfter("remapJar") - tasks.getByName("modrinth").mustRunAfter("remapJar") -} \ No newline at end of file diff --git a/defaults/build.gradle b/defaults/build.gradle index fe1691f..1619154 100644 --- a/defaults/build.gradle +++ b/defaults/build.gradle @@ -1,30 +1,79 @@ -apply plugin: 'com.modrinth.minotaur' +plugins { + id 'fabric-loom' version '1.2-SNAPSHOT' + id 'io.shcm.shsupercm.fabric.fletchingtable' version '1.6' +} + +version = "${property('mod.version')}+${stonecutter.current().version()}" +group = 'shcm.shsupercm.fabric.citresewn.defaults' -archivesBaseName = "citresewn-defaults" +repositories { + maven { url 'https://maven.terraformersmc.com/releases/' } + maven { url 'https://maven.shedaniel.me/' } +} dependencies { - implementation project(path: ":", configuration: "namedElements") + minecraft "com.mojang:minecraft:${stonecutter.current().version()}" + mappings "net.fabricmc:yarn:${property('deps.yarn')}:v2" + + modImplementation "net.fabricmc:fabric-loader:${property('deps.fabric-loader')}" + modImplementation "net.fabricmc.fabric-api:fabric-api:${property('deps.fabric-api')}" + + modImplementation "com.terraformersmc:modmenu:${property('deps.modmenu')}" + modImplementation "me.shedaniel.cloth:cloth-config-fabric:${property('deps.cloth-config')}" + + implementation project(path: ":${stonecutter.current().version()}", configuration: "namedElements") } -java { - withSourcesJar() +fletchingTable { + defaultMixinEnvironment = "auto" } loom { - accessWidenerPath = file("src/main/resources/citresewn-defaults.accesswidener") + accessWidenerPath = file("../../src/main/resources/citresewn-defaults.accesswidener") - runConfigs.configureEach { - ideConfigGenerated = true - } + runConfigs.configureEach { + ideConfigGenerated = true + } } -modrinth { - token = TOKEN_MODRINTH - projectId = "meHXjJBu" - uploadFile = remapJar - versionNumber = version - versionName = "v" + version - additionalFiles = [ sourcesJar.outputs.getFiles().singleFile ] - gameVersions = Arrays.asList(rootProject.publish_minecraft_versions.split(",")) +java { + //withSourcesJar() + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + + archivesBaseName = "${property('mod.jarname')}-defaults" +} + +processResources { + filesMatching('fabric.mod.json') { + expand 'mod_version': version + } +} + +jar { + archiveClassifier.set 'dev' + + from rootProject.file('LICENSE') +} + +if (stonecutter.current().isActiveVersion()) { + plugins.apply 'com.modrinth.minotaur' + + modrinth { + token = TOKEN_MODRINTH + projectId = 'meHXjJBu' + uploadFile = remapJar + versionNumber = version + versionName = "v" + version + //additionalFiles = [sourcesJar.outputs.getFiles().singleFile] + gameVersions = Arrays.asList(property('mod.target-mc-publish').split(",")) + } + + rootProject.tasks.named('publish') { + Task remapJarTask = tasks.getByName 'remapJar' + Task modrinthTask = tasks.getByName 'modrinth' + + dependsOn remapJarTask, modrinthTask + modrinthTask.mustRunAfter remapJarTask + } } -tasks.getByName("modrinth").mustRunAfter(rootProject.tasks.getByName("modrinth")) \ No newline at end of file diff --git a/defaults/src/main/resources/fabric.mod.json b/defaults/src/main/resources/fabric.mod.json index 032c31b..d8522aa 100644 --- a/defaults/src/main/resources/fabric.mod.json +++ b/defaults/src/main/resources/fabric.mod.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "id": "citresewn-defaults", - "version": "${version}", + "version": "${mod_version}", "name": "CIT Resewn: Defaults", "description": "Default types and conditions for CIT Resewn", "authors": [ @@ -28,7 +28,7 @@ } }, "depends": { - "citresewn": "${version}" + "citresewn": "${mod_version}" }, "conflicts": { "eatinganimationid": "<1.9" diff --git a/defaults/stonecutter.gradle b/defaults/stonecutter.gradle new file mode 100644 index 0000000..fa6231a --- /dev/null +++ b/defaults/stonecutter.gradle @@ -0,0 +1,3 @@ +plugins.apply 'io.shcm.shsupercm.fabric.stonecutter' +stonecutter.active '1.20.1' +//-------- !DO NOT EDIT ABOVE THIS LINE! --------\\ diff --git a/defaults/versions/1.20.1/gradle.properties b/defaults/versions/1.20.1/gradle.properties new file mode 100644 index 0000000..da06dfe --- /dev/null +++ b/defaults/versions/1.20.1/gradle.properties @@ -0,0 +1,6 @@ +mod.target-mc=~1.20 +mod.target-mc-publish=1.20,1.20.1 +deps.yarn=1.20.1+build.2 +deps.fabric-api=0.83.1+1.20.1 +deps.modmenu=7.1.0 +deps.cloth-config=11.0.99 \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 500ac2b..efb58c4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,20 +1,17 @@ -# Done to increase the memory available to gradle. -org.gradle.jvmargs=-Xmx1G +# Mostly system specific, if you can handle more or less, change these for your needs +org.gradle.jvmargs=-Xmx2G +org.gradle.workers.max=1 -# Fabric Properties -# check these on https://modmuss50.me/fabric.html -minecraft_version=1.20 -publish_minecraft_versions=1.20 -yarn_mappings=1.20+build.1 -loader_version=0.14.21 -fungible=1.2+mc1.19.3 - -fabric_api=0.83.0+1.20 -modmenu=7.0.1 -cloth=11.0.99 - -# Mod Properties -mod_version=1.1.3 -maven_group=shcm.shsupercm.fabric -archives_base_name=CITResewn +# CIT Resewn +mod.version=1.1.3 +mod.jarname=citresewn +mod.target-mc=[VERSIONED] +mod.target-mc-publish=[VERSIONED] +publish.modrinth.id=otVJckYQ +publish.curseforge.id=521427 +# Dependencies +deps.yarn=[VERSIONED] +deps.fabric-loader=0.14.21 +deps.modmenu=[VERSIONED] +deps.cloth-config=[VERSIONED] \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 4ab5170..7a55f99 100644 --- a/settings.gradle +++ b/settings.gradle @@ -8,4 +8,21 @@ pluginManagement { } } -include 'defaults' \ No newline at end of file +plugins { + id 'io.shcm.shsupercm.fabric.stonecutter' version '1.1' + + id 'com.modrinth.minotaur' version '2.+' apply false + id 'com.matthewprenger.cursegradle' version '1.4.0' apply false +} + +include 'defaults' + +String[] targetMCVersions = [ '1.20.1' ] + +stonecutter.create(rootProject) { + versions targetMCVersions +} + +stonecutter.create(project(':defaults')) { + versions targetMCVersions +} diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index acaa6d8..f7bc1dc 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "id": "citresewn", - "version": "${version}", + "version": "${mod_version}", "name": "CIT Resewn", "description": "Re-implements MCPatcher's CIT", "authors": [ @@ -23,7 +23,7 @@ "depends": { "fabric": "*", "fabricloader": "*", - "minecraft": "~1.20" + "minecraft": "${mod_target_mc}" }, "recommends": { "modmenu": "*", diff --git a/stonecutter.gradle b/stonecutter.gradle new file mode 100644 index 0000000..fa6231a --- /dev/null +++ b/stonecutter.gradle @@ -0,0 +1,3 @@ +plugins.apply 'io.shcm.shsupercm.fabric.stonecutter' +stonecutter.active '1.20.1' +//-------- !DO NOT EDIT ABOVE THIS LINE! --------\\ diff --git a/versions/1.20.1/gradle.properties b/versions/1.20.1/gradle.properties new file mode 100644 index 0000000..da06dfe --- /dev/null +++ b/versions/1.20.1/gradle.properties @@ -0,0 +1,6 @@ +mod.target-mc=~1.20 +mod.target-mc-publish=1.20,1.20.1 +deps.yarn=1.20.1+build.2 +deps.fabric-api=0.83.1+1.20.1 +deps.modmenu=7.1.0 +deps.cloth-config=11.0.99 \ No newline at end of file -- cgit