1- import net.darkhax.curseforgegradle.Constants
2- import net.darkhax.curseforgegradle.TaskPublishCurseForge
3- import java.time.LocalDateTime
4-
5- val repository: String by extra
6- val mod_name: String by extra
7- val mod_author: String by extra
8- val mod_id: String by extra
9- val release_type: String by extra
10- val modrinth_project_id: String by extra
11- val curseforge_project_id: String by extra
12- val minecraft_version: String by extra
13- val parchment_version: String by extra
14- val maven_group: String by extra
15- val neoforge_version: String by extra
16-
17- val mod_version = System .getenv(" RELEASE_VERSION" ) ? : extra[" mod_version" ] as String
18-
191plugins {
20- java
21- `maven- publish`
22- alias(libs.plugins.neoforge)
23- alias(libs.plugins.spotless)
24- alias(libs.plugins.sonarqube)
25- alias(libs.plugins.minotaur)
26- alias(libs.plugins.cursegradle)
27- }
28-
29- base {
30- archivesName = " $mod_name $minecraft_version -$mod_version "
31- }
32-
33- java {
34- toolchain.languageVersion = JavaLanguageVersion .of(21 )
35- withSourcesJar()
2+ id(" com.possible-triangle.neoforge" )
363}
374
38- minecraft {
39- accessTransformers {
40- file(" src/main/resources/META-INF/accesstransformer.cfg" )
41- }
5+ mod {
6+ mods.include(libs.galena.hats)
427}
438
44- subsystems {
45- parchment {
46- minecraftVersion = minecraft_version
47- mappingsVersion = parchment_version
48- }
49- }
50-
51- runs {
52- create(" client" )
53-
54- create(" server" ) {
55- workingDirectory(" run/server" )
56- }
57-
58- create(" data" ) {
59- workingDirectory(" run/data" )
60-
61- val existingMods = listOf (
62- " blueprint" ,
63- " shieldexp" ,
64- " dye_depot" ,
65- )
66-
67- arguments(
68- listOf (
69- " --mod" ,
70- mod_id,
71- " --all" ,
72- " --output" ,
73- file(" src/generated/resources/" ).path,
74- " --existing" ,
75- file(" src/main/resources/" ).path,
76- ) + existingMods.flatMap {
77- listOf (" --existing-mod" , it)
78- })
9+ neoforge {
10+ dataGen {
11+ existing(" blueprint" )
12+ existing(" shieldexp" )
13+ existing(" dye_depot" )
7914 }
8015}
8116
82- sourceSets.main {
83- resources.srcDir( " src/generated/resources " )
17+ base {
18+ archivesName = " ${mod.name.get()} ${mod.minecraftVersion.get()} - ${mod.version.get()} "
8419}
8520
8621repositories {
87- mavenLocal()
88-
8922 maven {
9023 url = uri(" https://maven.teamabnormals.com/" )
9124 content {
@@ -98,12 +31,6 @@ repositories {
9831 includeGroup(" mezz.jei" )
9932 }
10033 }
101- maven {
102- url = uri(" https://api.modrinth.com/maven" )
103- content {
104- includeGroup(" maven.modrinth" )
105- }
106- }
10734 maven {
10835 url = uri(" https://maven.tterrag.com/" )
10936 content {
@@ -119,8 +46,7 @@ repositories {
11946 }
12047 }
12148
122- maven {
123- url = uri(" https://registry.somethingcatchy.net/repository/maven-public/" )
49+ nexus {
12450 content {
12551 includeGroup(" dev.galena" )
12652 includeGroup(" com.possible-triangle" )
@@ -129,183 +55,59 @@ repositories {
12955 }
13056}
13157
132- jarJar.enable()
133-
13458dependencies {
135- implementation(" net.neoforged:neoforge:${neoforge_version} " )
136- implementation(libs.blueprint)
59+ modApi(libs.blueprint)
13760
138- implementation(jarJar(libs.galena.hats.get().copy()) {
139- version {
140- strictly(" [${version} ,)" )
141- prefer(version!! )
142- }
143- })
144-
145- implementation(libs.multikulti.datagen)
61+ modImplementation(libs.multikulti.datagen)
14662
14763 // Compatibilities
148- implementation(pack.modrinth.farmers.delight)
149- // implementation(pack.modrinth.nethers.delight)
150- // implementation(pack.modrinth.shield.expansion)
151- implementation(variantOf(libs.create) {
152- classifier(" all" )
153- }) {
64+ modImplementation(pack.modrinth.farmers.delight)
65+ // modApi(pack.modrinth.nethers.delight)
66+ // modApi(pack.modrinth.shield.expansion)
67+ modImplementation(
68+ variantOf(libs.create) {
69+ classifier(" all" )
70+ },
71+ ) {
15472 isTransitive = false
15573 }
156- implementation (pack.modrinth.supplementaries)
74+ modImplementation (pack.modrinth.supplementaries)
15775
15876 // For dev testing
15977 // runtimeOnly(pack.modrinth.scannable)
16078 // runtimeOnly(pack.modrinth.architectury.api)
161- runtimeOnly (pack.modrinth.moonlight)
162- runtimeOnly (libs.dye.depot)
163- runtimeOnly (pack.modrinth.jade)
164- runtimeOnly (pack.modrinth.biolith)
165- runtimeOnly (pack.modrinth.no.mans.land)
79+ modRuntimeOnly (pack.modrinth.moonlight)
80+ modRuntimeOnly (libs.dye.depot)
81+ modRuntimeOnly (pack.modrinth.jade)
82+ modRuntimeOnly (pack.modrinth.biolith)
83+ modRuntimeOnly (pack.modrinth.no.mans.land)
16684
167- compileOnly (libs.jei.common.api)
168- compileOnly (libs.jei.neoforge.api)
169- runtimeOnly (libs.jei.neoforge)
85+ modCompileOnly (libs.jei.common.api)
86+ modCompileOnly (libs.jei.neoforge.api)
87+ modRuntimeOnly (libs.jei.neoforge)
17088}
17189
172- tasks.withType<Jar > {
173- val now = LocalDateTime .now().toString()
174- manifest {
175- attributes(
176- mapOf (
177- " Specification-Title" to mod_name,
178- " Specification-Vendor" to mod_author,
179- " Specification-Version" to mod_version,
180- " Implementation-Title" to mod_name,
181- " Implementation-Version" to mod_version,
182- " Implementation-Vendor" to mod_author,
183- " Implementation-Timestamp" to now,
184- " Built-On-Java" to " ${System .getProperty(" java.vm.version" )} (${System .getProperty(" java.vm.vendor" )} )" ,
185- " Build-On-Minecraft" to minecraft_version
186- )
187- )
188- }
189- }
190-
191- tasks.withType<ProcessResources > {
192- filesMatching(
193- listOfNotNull(
194- " META-INF/mods.toml" ,
195- " META-INF/neoforge.mods.toml" ,
196- " pack.mcmeta" ,
197- " fabric.mod.json" ,
198- " ${mod_id} *.mixins.json" ,
199- )
200- ) {
201- expand(
202- mapOf (
203- " mod_version" to mod_version,
204- " mod_name" to mod_name,
205- " mod_id" to mod_id,
206- " mod_author" to mod_author,
207- " repository" to repository,
208- )
209- )
90+ upload {
91+ maven {
92+ nexus()
21093 }
211- }
212-
213- tasks.jar {
214- archiveClassifier.set(" slim" )
215- }
216-
217- tasks.jarJar {
218- archiveClassifier.set(" " )
219- }
220-
221- val upload = tasks.jarJar.get().archiveFile.get()
22294
223- publishing {
224- publications {
225- create<MavenPublication >(" maven" ) {
226- groupId = maven_group
227- artifactId = mod_id
228- version = mod_version
229-
230- artifact(tasks.getByName(" sourcesJar" ))
231- artifact(tasks.jar)
232- artifact(tasks.jarJar)
233-
234- pom.withXml {
235- val node = asNode()
236- val list = node.get(" dependencies" ) as groovy.util.NodeList
237- list.forEach { node.remove(it as groovy.util.Node ) }
238- }
95+ modrinth {
96+ dependencies {
97+ required(" blueprint" )
23998 }
24099 }
241- repositories {
242- mavenLocal()
243100
244- val nexusToken = System .getenv(" NEXUS_TOKEN" )
245- val nexusUser = System .getenv(" NEXUS_USER" )
246- if (nexusToken != null && nexusUser != null ) {
247- maven {
248- url = uri(" https://registry.somethingcatchy.net/repository/maven-releases/" )
249- credentials {
250- username = nexusUser
251- password = nexusToken
252- }
253- }
101+ curseforge {
102+ dependencies {
103+ required(" blueprint" , 382216 )
254104 }
255105 }
256- }
257-
258- tasks.withType<GenerateModuleMetadata > {
259- enabled = false
260- }
261-
262- spotless {
263- java {
264- importOrder()
265- removeUnusedImports()
266- }
267-
268- kotlinGradle {
269- ktlint()
270- suppressLintsFor { shortCode = " standard:property-naming" }
271- }
272-
273- json {
274- target(" src/main/**/*.json" )
275- gson().indentWithSpaces(2 )
276- }
277- }
278106
279- sonar {
280- properties {
281- property(" sonar.projectKey" , mod_id)
282- property(" sonar.gradle.skipCompile" , " true" )
283- property(" sonar.links.scm" , " https://github.com/${repository} " )
107+ forEach {
108+ versionName = " ${mod.name.get()} ${mod.version.get()} "
284109 }
285110}
286111
287- modrinth {
288- projectId = modrinth_project_id
289- versionNumber = mod_version
290- versionName = " $mod_name $mod_version "
291- versionType = release_type
292- uploadFile = upload
293- gameVersions = listOf (minecraft_version)
294- changelog = System .getenv(" CHANGELOG" )
295- dependencies {
296- required.project(" blueprint" )
297- }
298- }
299-
300- tasks.register<TaskPublishCurseForge >(" curseforge" ) {
301- apiToken = System .getenv(" CURSEFORGE_TOKEN" )
302- upload(curseforge_project_id, upload) {
303- changelogType = Constants .CHANGELOG_MARKDOWN
304- changelog = System .getenv(" CHANGELOG" )
305- releaseType = release_type
306- displayName = " $mod_name $mod_version "
307- addGameVersion(minecraft_version)
308- addModLoader(" NeoForge" )
309- addRelation(" blueprint" , Constants .RELATION_REQUIRED , " 382216" )
310- }
311- }
112+ enableSpotless()
113+ enableSonarQube()
0 commit comments