Skip to content

Commit 375c978

Browse files
committed
Merge remote-tracking branch 'origin/1.18' into 1.19.2
2 parents adac112 + 3beef4d commit 375c978

File tree

11 files changed

+221
-214
lines changed

11 files changed

+221
-214
lines changed

build.gradle

Lines changed: 3 additions & 201 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
plugins {
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

1314
architectury {
@@ -16,136 +17,7 @@ architectury {
1617

1718
ext.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-
maven {
66-
name = 'ParchmentMC'
67-
url = 'https://maven.parchmentmc.org'
68-
}
69-
maven {
70-
// Shedaniel's maven (Architectury API)
71-
url = "https://maven.architectury.dev"
72-
content {
73-
includeGroup "me.shedaniel"
74-
}
75-
}
76-
77-
maven {
78-
// saps.dev Maven (KubeJS and Rhino)
79-
url = "https://maven.saps.dev/minecraft"
80-
content {
81-
includeGroup "dev.latvian.mods"
82-
}
83-
}
84-
maven { // CTM
85-
url "https://maven.tterrag.com/"
86-
}
87-
maven { url 'https://maven.blamejared.com' }
88-
repositories {
89-
maven {
90-
name = "Fuzs Mod Resources"
91-
url = "https://raw.githubusercontent.com/Fuzss/modresources/main/maven/"
92-
}
93-
}
94-
maven {
95-
url 'https://maven.terraformersmc.com/releases'
96-
}
97-
maven { url = "https://jitpack.io" }
98-
}
99-
}
100-
101-
configure(subprojects.findAll {it.name == "common" || it.name == "forge" || it.name == "fabric"}) {
102-
apply plugin: "dev.architectury.loom"
103-
104-
loom {
105-
silentMojangMappingsLicense()
106-
}
107-
108-
dependencies {
109-
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
110-
mappings loom.layered() {
111-
officialMojangMappings()
112-
if(rootProject.hasProperty("parchment_version")) {
113-
parchment("org.parchmentmc.data:parchment-${minecraft_version}:${parchment_version}@zip")
114-
}
115-
}
116-
}
117-
118-
processResources {
119-
def mixinFileList = []
120-
def mixinDirectory = file("src/main/java/org/embeddedt/modernfix/" + project.name + "/mixin")
121-
fileTree(mixinDirectory).visit { FileVisitDetails details ->
122-
if(details.file.isFile()) {
123-
def fileName = mixinDirectory.relativePath(details.file).toString().replaceFirst(/\.java$/, "").replace('/', '.')
124-
mixinFileList << fileName
125-
}
126-
}
127-
128-
def mixinClassesStringB = new StringBuilder()
129-
for(int i = 0; i < mixinFileList.size(); i++) {
130-
mixinClassesStringB.append(" \"")
131-
mixinClassesStringB.append(mixinFileList.get(i))
132-
mixinClassesStringB.append('"')
133-
if(i < (mixinFileList.size() - 1))
134-
mixinClassesStringB.append(',')
135-
mixinClassesStringB.append('\n')
136-
}
137-
138-
def replacements = [
139-
mixin_classes: mixinClassesStringB.toString()
140-
]
141-
142-
inputs.properties replacements
143-
def filePattern = "modernfix-" + project.name + ".mixins.json"
144-
filesMatching(filePattern) {
145-
expand replacements
146-
}
147-
}
148-
}
20+
apply plugin: 'modernfix.common-conventions'
14921

15022
tasks.withType(JavaCompile).configureEach {
15123
// ensure that the encoding is set to UTF-8, no matter what the system default is
@@ -192,74 +64,4 @@ tasks.register('checkCleanTag') {
19264
}
19365
}
19466

195-
configure(subprojects.findAll {it.name == "forge" || it.name == "fabric"}) {
196-
apply plugin: 'com.matthewprenger.cursegradle'
197-
apply plugin: 'com.modrinth.minotaur'
198-
199-
loom {
200-
mods {
201-
main { // to match the default mod generated for Forge
202-
sourceSet project.sourceSets.main
203-
sourceSet project(':common').sourceSets.main
204-
}
205-
}
206-
runs {
207-
client {
208-
vmArgs "-Xmx1G"
209-
vmArgs "-Xms1G"
210-
property("mixin.debug.export", "true")
211-
}
212-
}
213-
}
214-
215-
def copyJarNameConsistent = tasks.register('copyJarNameConsistent', Copy) {
216-
from remapJar // shortcut for createJar.outputs.files
217-
into project.file("build/libs")
218-
rename { name -> "modernfix-" + project.name + "-latest.jar" }
219-
}
220-
221-
def copyJarToBin = tasks.register('copyJarToBin', Copy) {
222-
from remapJar // shortcut for createJar.outputs.files
223-
into rootProject.file("bin")
224-
mustRunAfter "copyJarNameConsistent"
225-
}
226-
227-
tasks.build.dependsOn(copyJarToBin, copyJarNameConsistent)
228-
229-
def isBeta = project.version.toString().contains("beta")
230-
231-
curseforge {
232-
if (System.getenv("CURSEFORGE_TOKEN") != null) {
233-
apiKey = System.getenv("CURSEFORGE_TOKEN")
234-
project {
235-
id = "790626"
236-
changelog = file('../CHANGELOG.md')
237-
changelogType = "markdown"
238-
releaseType = isBeta ? "beta" : "release"
239-
addGameVersion project.name.capitalize()
240-
gameVersionStrings.addAll(supported_minecraft_versions.tokenize(","))
241-
mainArtifact remapJar
242-
}
243-
}
244-
}
245-
246-
modrinth {
247-
token = System.getenv("MODRINTH_TOKEN")
248-
projectId = "modernfix" // This can be the project ID or the slug. Either will work!
249-
versionType = isBeta ? "beta" : "release" // This is the default -- can also be `beta` or `alpha`
250-
uploadFile = remapJar
251-
gameVersions = supported_minecraft_versions.tokenize(",")
252-
loaders = [project.name]
253-
changelog.set(provider { file("CHANGELOG.md").getText('UTF-8') })
254-
}
255-
256-
tasks.curseforge.dependsOn(rootProject.generateChangelog)
257-
tasks.modrinth.dependsOn(rootProject.generateChangelog)
258-
259-
tasks.register('publishToModSites') {
260-
publishToModSites.dependsOn(tasks.modrinth)
261-
publishToModSites.dependsOn(tasks.curseforge)
262-
}
263-
}
264-
26567
println "ModernFix: " + version

buildSrc/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
plugins {
2+
id 'groovy-gradle-plugin'
3+
}

buildSrc/settings.gradle

Whitespace-only changes.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
plugins {
2+
id 'java'
3+
id 'architectury-plugin'
4+
id 'maven-publish'
5+
id 'com.diffplug.spotless'
6+
}
7+
8+
spotless {
9+
java {
10+
removeUnusedImports()
11+
}
12+
}
13+
14+
architectury {
15+
compileOnly()
16+
}
17+
18+
group = 'org.embeddedt'
19+
// extract base version from tag, generate other metadata ourselves
20+
def details = versionDetails()
21+
def plusIndex = details.lastTag.indexOf("+")
22+
if(plusIndex == -1) {
23+
plusIndex = details.lastTag.length()
24+
}
25+
def baseVersion = details.lastTag.substring(0, plusIndex)
26+
def dirtyMarker = grgit.status().clean ? "" : ".dirty"
27+
def commitHashMarker = details.commitDistance > 0 ? ("." + details.gitHash.substring(0, Math.min(4, details.gitHash.length()))) : ""
28+
def preMarker = (details.commitDistance > 0 || !details.isCleanTag) ? ("-beta." + details.commitDistance) : ""
29+
if(preMarker.length() > 0) {
30+
// bump to next patch release
31+
def versionParts = baseVersion.tokenize(".")
32+
baseVersion = "${versionParts[0]}.${versionParts[1]}.${versionParts[2].toInteger() + 1}"
33+
}
34+
def versionString = "${baseVersion}${preMarker}+mc${minecraft_version}${commitHashMarker}${dirtyMarker}"
35+
version = versionString
36+
archivesBaseName = rootProject.archives_base_name + '-' + project.name
37+
38+
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17
39+
40+
repositories {
41+
maven { url 'https://modmaven.dev/' }
42+
maven {
43+
url "https://cursemaven.com"
44+
content {
45+
includeGroup "curse.maven"
46+
}
47+
}
48+
maven {
49+
name = 'ParchmentMC'
50+
url = 'https://maven.parchmentmc.org'
51+
}
52+
maven {
53+
// Shedaniel's maven (Architectury API)
54+
url = "https://maven.architectury.dev"
55+
content {
56+
includeGroup "me.shedaniel"
57+
}
58+
}
59+
60+
maven {
61+
// saps.dev Maven (KubeJS and Rhino)
62+
url = "https://maven.saps.dev/minecraft"
63+
content {
64+
includeGroup "dev.latvian.mods"
65+
}
66+
}
67+
maven { // CTM
68+
url "https://maven.tterrag.com/"
69+
}
70+
maven { url 'https://maven.blamejared.com' }
71+
repositories {
72+
maven {
73+
name = "Fuzs Mod Resources"
74+
url = "https://raw.githubusercontent.com/Fuzss/modresources/main/maven/"
75+
}
76+
}
77+
maven {
78+
url 'https://maven.terraformersmc.com/releases'
79+
}
80+
maven { url = "https://jitpack.io" }
81+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
plugins {
2+
id 'modernfix.common-conventions'
3+
id 'dev.architectury.loom'
4+
}
5+
6+
loom {
7+
silentMojangMappingsLicense()
8+
accessWidenerPath = file("${rootDir}/common/src/main/resources/modernfix.accesswidener")
9+
}
10+
11+
dependencies {
12+
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
13+
mappings loom.layered() {
14+
officialMojangMappings()
15+
if(rootProject.hasProperty("parchment_version")) {
16+
parchment("org.parchmentmc.data:parchment-${minecraft_version}:${parchment_version}@zip")
17+
}
18+
}
19+
}
20+
21+
tasks {
22+
processResources {
23+
def mixinFileList = []
24+
def mixinDirectory = file("src/main/java/org/embeddedt/modernfix/" + project.name + "/mixin")
25+
fileTree(mixinDirectory).visit { FileVisitDetails details ->
26+
if(details.file.isFile()) {
27+
def fileName = mixinDirectory.relativePath(details.file).toString().replaceFirst(/\.java$/, "").replace('/', '.')
28+
mixinFileList << fileName
29+
}
30+
}
31+
32+
def mixinClassesStringB = new StringBuilder()
33+
for(int i = 0; i < mixinFileList.size(); i++) {
34+
mixinClassesStringB.append(" \"")
35+
mixinClassesStringB.append(mixinFileList.get(i))
36+
mixinClassesStringB.append('"')
37+
if(i < (mixinFileList.size() - 1))
38+
mixinClassesStringB.append(',')
39+
mixinClassesStringB.append('\n')
40+
}
41+
42+
def replacements = [
43+
mixin_classes: mixinClassesStringB.toString()
44+
]
45+
46+
inputs.properties replacements
47+
def filePattern = "modernfix-" + project.name + ".mixins.json"
48+
filesMatching(filePattern) {
49+
expand replacements
50+
}
51+
}
52+
}

0 commit comments

Comments
 (0)