11plugins {
22 id " architectury-plugin" version " 3.4-SNAPSHOT"
3- id " dev.architectury.loom" version " 1.2 -SNAPSHOT" apply false
3+ id " dev.architectury.loom" version " 1.3 -SNAPSHOT" apply false
44 id " maven-publish"
55 id ' com.matthewprenger.cursegradle' version ' 1.4.0' apply false
66 id ' com.palantir.git-version' version ' 1.0.0'
77 id ' org.ajoberstar.grgit' version ' 5.2.0'
88 id ' se.bjurr.gitchangelog.git-changelog-gradle-plugin' version ' 1.79.0'
99 id " com.modrinth.minotaur" version " 2.+" apply false
1010 id(" com.diffplug.spotless" ) version " 6.18.0" apply false
11+ id ' modernfix.common-conventions' apply false
1112}
1213
1314architectury {
@@ -16,147 +17,7 @@ architectury {
1617
1718ext. archives_base_name = ' modernfix'
1819
19- allprojects {
20- apply plugin : " java"
21- apply plugin : " architectury-plugin"
22- apply plugin : " maven-publish"
23- apply plugin : " com.diffplug.spotless"
24-
25- spotless {
26- java {
27- removeUnusedImports()
28- }
29- }
30-
31- architectury {
32- compileOnly()
33- }
34-
35- group = ' org.embeddedt'
36- // extract base version from tag, generate other metadata ourselves
37- def details = versionDetails()
38- def plusIndex = details. lastTag. indexOf(" +" )
39- if (plusIndex == -1 ) {
40- plusIndex = details. lastTag. length()
41- }
42- def baseVersion = details. lastTag. substring(0 , plusIndex)
43- def dirtyMarker = grgit. status(). clean ? " " : " .dirty"
44- def commitHashMarker = details. commitDistance > 0 ? (" ." + details. gitHash. substring(0 , Math . min(4 , details. gitHash. length()))) : " "
45- def preMarker = (details. commitDistance > 0 || ! details. isCleanTag) ? (" -beta." + details. commitDistance) : " "
46- if (preMarker. length() > 0 ) {
47- // bump to next patch release
48- def versionParts = baseVersion. tokenize(" ." )
49- baseVersion = " ${ versionParts[0]} .${ versionParts[1]} .${ versionParts[2].toInteger() + 1} "
50- }
51- def versionString = " ${ baseVersion}${ preMarker} +mc${ minecraft_version}${ commitHashMarker}${ dirtyMarker} "
52- version = versionString
53- archivesBaseName = rootProject. archives_base_name + ' -' + project. name
54-
55- sourceCompatibility = targetCompatibility = JavaVersion . VERSION_17
56-
57- repositories {
58- maven { url ' https://modmaven.dev/' }
59- maven {
60- url " https://cursemaven.com"
61- content {
62- includeGroup " curse.maven"
63- }
64- }
65- exclusiveContent {
66- forRepository {
67- maven {
68- name = " Modrinth"
69- url = " https://api.modrinth.com/maven"
70- }
71- }
72- filter {
73- includeGroup " maven.modrinth"
74- }
75- }
76- maven {
77- name = ' ParchmentMC'
78- url = ' https://maven.parchmentmc.org'
79- }
80- maven {
81- // Shedaniel's maven (Architectury API)
82- url = " https://maven.architectury.dev"
83- content {
84- includeGroup " me.shedaniel"
85- }
86- }
87-
88- maven {
89- // saps.dev Maven (KubeJS and Rhino)
90- url = " https://maven.saps.dev/minecraft"
91- content {
92- includeGroup " dev.latvian.mods"
93- }
94- }
95- maven { // CTM
96- url " https://maven.tterrag.com/"
97- }
98- maven { url ' https://maven.blamejared.com' }
99- repositories {
100- maven {
101- name = " Fuzs Mod Resources"
102- url = " https://raw.githubusercontent.com/Fuzss/modresources/main/maven/"
103- }
104- }
105- maven {
106- url ' https://maven.terraformersmc.com/releases'
107- }
108- maven { url = " https://jitpack.io" }
109- }
110- }
111-
112- configure(subprojects. findAll {it. name == " common" || it. name == " forge" || it. name == " fabric" }) {
113- apply plugin : " dev.architectury.loom"
114-
115- loom {
116- silentMojangMappingsLicense()
117- }
118-
119- dependencies {
120- minecraft " com.mojang:minecraft:${ rootProject.minecraft_version} "
121- mappings loom. layered() {
122- officialMojangMappings()
123- if (rootProject. hasProperty(" parchment_version" )) {
124- parchment(" org.parchmentmc.data:parchment-${ minecraft_version} :${ parchment_version} @zip" )
125- }
126- }
127- }
128-
129- processResources {
130- def mixinFileList = []
131- def mixinDirectory = file(" src/main/java/org/embeddedt/modernfix/" + project. name + " /mixin" )
132- fileTree(mixinDirectory). visit { FileVisitDetails details ->
133- if (details. file. isFile()) {
134- def fileName = mixinDirectory. relativePath(details. file). toString(). replaceFirst(/ \. java$/ , " " ). replace(' /' , ' .' )
135- mixinFileList << fileName
136- }
137- }
138-
139- def mixinClassesStringB = new StringBuilder ()
140- for (int i = 0 ; i < mixinFileList. size(); i++ ) {
141- mixinClassesStringB. append(" \" " )
142- mixinClassesStringB. append(mixinFileList. get(i))
143- mixinClassesStringB. append(' "' )
144- if (i < (mixinFileList. size() - 1 ))
145- mixinClassesStringB. append(' ,' )
146- mixinClassesStringB. append(' \n ' )
147- }
148-
149- def replacements = [
150- mixin_classes : mixinClassesStringB. toString()
151- ]
152-
153- inputs. properties replacements
154- def filePattern = " modernfix-" + project. name + " .mixins.json"
155- filesMatching(filePattern) {
156- expand replacements
157- }
158- }
159- }
20+ apply plugin : ' modernfix.common-conventions'
16021
16122tasks. withType(JavaCompile ). configureEach {
16223 // ensure that the encoding is set to UTF-8, no matter what the system default is
@@ -203,74 +64,4 @@ tasks.register('checkCleanTag') {
20364 }
20465}
20566
206- configure(subprojects. findAll {it. name == " forge" || it. name == " fabric" }) {
207- apply plugin : ' com.matthewprenger.cursegradle'
208- apply plugin : ' com.modrinth.minotaur'
209-
210- loom {
211- mods {
212- main { // to match the default mod generated for Forge
213- sourceSet project. sourceSets. main
214- sourceSet project(' :common' ). sourceSets. main
215- }
216- }
217- runs {
218- client {
219- vmArgs " -Xmx1G"
220- vmArgs " -Xms1G"
221- property(" mixin.debug.export" , " true" )
222- }
223- }
224- }
225-
226- def copyJarNameConsistent = tasks. register(' copyJarNameConsistent' , Copy ) {
227- from remapJar // shortcut for createJar.outputs.files
228- into project. file(" build/libs" )
229- rename { name -> " modernfix-" + project. name + " -latest.jar" }
230- }
231-
232- def copyJarToBin = tasks. register(' copyJarToBin' , Copy ) {
233- from remapJar // shortcut for createJar.outputs.files
234- into rootProject. file(" bin" )
235- mustRunAfter " copyJarNameConsistent"
236- }
237-
238- tasks. build. dependsOn(copyJarToBin, copyJarNameConsistent)
239-
240- def isBeta = project. version. toString(). contains(" beta" )
241-
242- curseforge {
243- if (System . getenv(" CURSEFORGE_TOKEN" ) != null ) {
244- apiKey = System . getenv(" CURSEFORGE_TOKEN" )
245- project {
246- id = " 790626"
247- changelog = file(' ../CHANGELOG.md' )
248- changelogType = " markdown"
249- releaseType = isBeta ? " beta" : " release"
250- addGameVersion project. name. capitalize()
251- gameVersionStrings. addAll(supported_minecraft_versions. tokenize(" ," ))
252- mainArtifact remapJar
253- }
254- }
255- }
256-
257- modrinth {
258- token = System . getenv(" MODRINTH_TOKEN" )
259- projectId = " modernfix" // This can be the project ID or the slug. Either will work!
260- versionType = isBeta ? " beta" : " release" // This is the default -- can also be `beta` or `alpha`
261- uploadFile = remapJar
262- gameVersions = supported_minecraft_versions. tokenize(" ," )
263- loaders = [project. name]
264- changelog. set(provider { file(" CHANGELOG.md" ). getText(' UTF-8' ) })
265- }
266-
267- tasks. curseforge. dependsOn(rootProject. generateChangelog)
268- tasks. modrinth. dependsOn(rootProject. generateChangelog)
269-
270- tasks. register(' publishToModSites' ) {
271- publishToModSites. dependsOn(tasks. modrinth)
272- publishToModSites. dependsOn(tasks. curseforge)
273- }
274- }
275-
27667println " ModernFix: " + version
0 commit comments