diff options
author | SHsuperCM <shsupercm@gmail.com> | 2023-06-21 09:53:19 +0300 |
---|---|---|
committer | SHsuperCM <shsupercm@gmail.com> | 2023-06-21 09:53:19 +0300 |
commit | daa0381b50753f8db9aff2e353872c8d673947b8 (patch) | |
tree | 666fb0af1beb1c89699011a27f544f2cca5550cb | |
parent | 441284a24bd3af732954394b3b6afa73554764de (diff) | |
download | CITResewn-daa0381b50753f8db9aff2e353872c8d673947b8.tar.gz CITResewn-daa0381b50753f8db9aff2e353872c8d673947b8.tar.bz2 CITResewn-daa0381b50753f8db9aff2e353872c8d673947b8.zip |
Buildscript cleanup
-rw-r--r-- | build.gradle | 42 | ||||
-rw-r--r-- | defaults/build.gradle | 21 | ||||
-rw-r--r-- | defaults/gradle.properties | 1 | ||||
-rw-r--r-- | defaults/versions/1.20.1/gradle.properties | 2 | ||||
-rw-r--r-- | gradle.properties | 2 | ||||
-rw-r--r-- | versions/1.20.1/gradle.properties | 2 |
6 files changed, 46 insertions, 24 deletions
diff --git a/build.gradle b/build.gradle index 49d84f0..d450656 100644 --- a/build.gradle +++ b/build.gradle @@ -13,11 +13,11 @@ dependencies { 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')}" + modCompileOnly "net.fabricmc:fabric-loader:${property('deps.fabric-loader')}" + modCompileOnly "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')}" + modCompileOnly "com.terraformersmc:modmenu:${property('deps.modmenu')}" + modCompileOnly "me.shedaniel.cloth:cloth-config-fabric:${property('deps.cloth-config')}" include project(":defaults:${stonecutter.current().version()}") } @@ -29,9 +29,8 @@ fletchingTable { loom { accessWidenerPath = file("../../src/main/resources/citresewn.accesswidener") - runConfigs.configureEach { - ideConfigGenerated = true - } + runConfigs.client.ideConfigGenerated = false + runConfigs.server.ideConfigGenerated = false } java { @@ -55,6 +54,21 @@ jar { } if (stonecutter.current().isActiveVersion()) { + dependencies { + modRuntimeOnly "net.fabricmc:fabric-loader:${property('deps.fabric-loader')}" + modRuntimeOnly "net.fabricmc.fabric-api:fabric-api:${property('deps.fabric-api')}" + modRuntimeOnly "com.terraformersmc:modmenu:${property('deps.modmenu')}" + modRuntimeOnly "me.shedaniel.cloth:cloth-config-fabric:${property('deps.cloth-config')}" + runtimeOnly project(path: ":defaults:${stonecutter.current().version()}", configuration: "namedElements") + } + loom.runConfigs.client.ideConfigGenerated = true + + rootProject.tasks.register('buildActive') { + setGroup 'project' + + dependsOn tasks.getByName('build') + } + plugins.apply 'com.modrinth.minotaur' plugins.apply 'com.matthewprenger.cursegradle' @@ -66,7 +80,7 @@ if (stonecutter.current().isActiveVersion()) { versionNumber = version versionName = "v" + version additionalFiles = [sourcesJar.outputs.getFiles().singleFile] - gameVersions = Arrays.asList(property('mod.target-mc-publish').split(",")) + gameVersions = Arrays.asList(property('publish.target-mc').split(",")) } curseforge { @@ -80,7 +94,7 @@ if (stonecutter.current().isActiveVersion()) { displayName = "v" + version } addGameVersion 'Fabric' - for (String version : property('mod.target-mc-publish').split(",")) + for (String version : property('publish.target-mc').split(",")) addGameVersion version } options { @@ -88,9 +102,17 @@ if (stonecutter.current().isActiveVersion()) { } } - rootProject.tasks.register('publish') { + rootProject.tasks.register('publishActive') { setGroup 'project' + if (gradle.startParameter.taskNames.contains(it.name)) { + System.out.println("Type the task name to confirm (${it.name}): ") + try (BufferedReader input = new BufferedReader(new InputStreamReader(System.in))) { + if (input.readLine() != it.name) + throw new GradleException('Task cancelled by user') + } + } + Task remapJarTask = tasks.getByName 'remapJar' Task curseforgeTask = tasks.getByName 'curseforge' Task modrinthTask = tasks.getByName 'modrinth' diff --git a/defaults/build.gradle b/defaults/build.gradle index 0d080e0..c29ecff 100644 --- a/defaults/build.gradle +++ b/defaults/build.gradle @@ -13,13 +13,13 @@ dependencies { 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')}" + modCompileOnly "net.fabricmc:fabric-loader:${property('deps.fabric-loader')}" + modCompileOnly "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')}" + modCompileOnly "com.terraformersmc:modmenu:${property('deps.modmenu')}" + modCompileOnly "me.shedaniel.cloth:cloth-config-fabric:${property('deps.cloth-config')}" - implementation project(path: ":${stonecutter.current().version()}", configuration: "namedElements") + compileOnly project(path: ":${stonecutter.current().version()}", configuration: "namedElements") } fletchingTable { @@ -29,9 +29,8 @@ fletchingTable { loom { accessWidenerPath = file("../../src/main/resources/citresewn-defaults.accesswidener") - runConfigs.configureEach { - ideConfigGenerated = true - } + runConfigs.client.ideConfigGenerated = false + runConfigs.server.ideConfigGenerated = false } java { @@ -59,15 +58,15 @@ if (stonecutter.current().isActiveVersion()) { modrinth { token = TOKEN_MODRINTH - projectId = 'meHXjJBu' + projectId = property('publish.modrinth.defaults.id') uploadFile = remapJar versionNumber = version versionName = "v" + version additionalFiles = [sourcesJar.outputs.getFiles().singleFile] - gameVersions = Arrays.asList(property('mod.target-mc-publish').split(",")) + gameVersions = Arrays.asList(property('publish.target-mc').split(",")) } - rootProject.tasks.named('publish') { + rootProject.tasks.named('publishActive') { Task remapJarTask = tasks.getByName 'remapJar' Task modrinthTask = tasks.getByName 'modrinth' diff --git a/defaults/gradle.properties b/defaults/gradle.properties new file mode 100644 index 0000000..4d6c940 --- /dev/null +++ b/defaults/gradle.properties @@ -0,0 +1 @@ +publish.modrinth.defaults.id=meHXjJBu
\ No newline at end of file diff --git a/defaults/versions/1.20.1/gradle.properties b/defaults/versions/1.20.1/gradle.properties index da06dfe..2bf73dc 100644 --- a/defaults/versions/1.20.1/gradle.properties +++ b/defaults/versions/1.20.1/gradle.properties @@ -1,5 +1,5 @@ mod.target-mc=~1.20 -mod.target-mc-publish=1.20,1.20.1 +publish.target-mc=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 diff --git a/gradle.properties b/gradle.properties index efb58c4..4293b9c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ org.gradle.workers.max=1 mod.version=1.1.3 mod.jarname=citresewn mod.target-mc=[VERSIONED] -mod.target-mc-publish=[VERSIONED] +publish.target-mc=[VERSIONED] publish.modrinth.id=otVJckYQ publish.curseforge.id=521427 diff --git a/versions/1.20.1/gradle.properties b/versions/1.20.1/gradle.properties index da06dfe..2bf73dc 100644 --- a/versions/1.20.1/gradle.properties +++ b/versions/1.20.1/gradle.properties @@ -1,5 +1,5 @@ mod.target-mc=~1.20 -mod.target-mc-publish=1.20,1.20.1 +publish.target-mc=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 |