Skip to content

Commit

Permalink
Update build scripts (#156)
Browse files Browse the repository at this point in the history
* Update dependency gradle to v8.11.1

* Update dependency org.projectlombok:lombok to v1.18.36

* Update plugin me.fallenbreath.yamlang to v1.4.1

* Update plugin org.ajoberstar.grgit to v5.3.0

* Update plugin architectury-loom to 1.9-SNAPSHOT

* Update plugin com.replaymod.preprocess to 9d21b33

* Using root project as project graph root node

* Move build.gradle to the real project graph root node

* Set mapping for each node on project graph, even if it is empty

---------

Signed-off-by: Hendrix-Shen <[email protected]>
  • Loading branch information
Hendrix-Shen authored Jan 17, 2025
1 parent c22a2ce commit bfe4b00
Show file tree
Hide file tree
Showing 20 changed files with 42 additions and 49 deletions.
30 changes: 16 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ plugins {
}

preprocess {
strictExtraMappings.set(false)

// Fabric
Node mc11404_fabric = createNode("1.14.4-fabric", 1_14_04, "mojang")
Node mc11502_fabric = createNode("1.15.2-fabric", 1_15_02, "mojang")
Expand All @@ -25,24 +27,24 @@ preprocess {
Node mc12103_fabric = createNode("1.21.3-fabric", 1_21_03, "mojang")
Node mc12104_fabric = createNode("1.21.4-fabric", 1_21_04, "mojang")

mc11404_fabric.link(mc11502_fabric, null)
mc11502_fabric.link(mc11605_fabric, file("versions/mapping-fabric-1.15.2-1.16.5.txt"))
mc11605_fabric.link(mc11701_fabric, null)
mc11701_fabric.link(mc11802_fabric, null)
mc11802_fabric.link(mc11902_fabric, null)
mc11502_fabric.link(mc11404_fabric, file("versions/mapping-fabric-1.15.2-1.14.4.txt"))
mc11605_fabric.link(mc11502_fabric, file("versions/mapping-fabric-1.16.5-1.15.2.txt"))
mc11605_fabric.link(mc11701_fabric, file("versions/mapping-fabric-1.16.5-1.17.1.txt"))
mc11701_fabric.link(mc11802_fabric, file("versions/mapping-fabric-1.17.1-1.18.2.txt"))
mc11802_fabric.link(mc11902_fabric, file("versions/mapping-fabric-1.18.2-1.19.2.txt"))
mc11902_fabric.link(mc11903_fabric, file("versions/mapping-fabric-1.19.2-1.19.3.txt"))
mc11903_fabric.link(mc11904_fabric, null)
mc11904_fabric.link(mc12001_fabric, null)
mc12001_fabric.link(mc12002_fabric, null)
mc12002_fabric.link(mc12004_fabric, null)
mc12004_fabric.link(mc12006_fabric, null)
mc12006_fabric.link(mc12101_fabric, null)
mc12101_fabric.link(mc12103_fabric, null)
mc12103_fabric.link(mc12104_fabric, null)
mc11903_fabric.link(mc11904_fabric, file("versions/mapping-fabric-1.19.3-1.19.4.txt"))
mc11904_fabric.link(mc12001_fabric, file("versions/mapping-fabric-1.19.4-1.20.1.txt"))
mc12001_fabric.link(mc12002_fabric, file("versions/mapping-fabric-1.20.1-1.20.2.txt"))
mc12002_fabric.link(mc12004_fabric, file("versions/mapping-fabric-1.20.2-1.20.4.txt"))
mc12004_fabric.link(mc12006_fabric, file("versions/mapping-fabric-1.20.4-1.20.6.txt"))
mc12006_fabric.link(mc12101_fabric, file("versions/mapping-fabric-1.20.6-1.21.1.txt"))
mc12101_fabric.link(mc12103_fabric, file("versions/mapping-fabric-1.21.1-1.21.3.txt"))
mc12103_fabric.link(mc12104_fabric, file("versions/mapping-fabric-1.21.3-1.21.4.txt"))

// NeoForge
Node mc12101_neoforge = createNode("1.21.1-neoforge", 1_21_01, "mojang")
mc12101_fabric.link(mc12101_neoforge, null)
mc12101_fabric.link(mc12101_neoforge, file("versions/mapping-1.21.1-fabric-neoforge.txt"))
}

ext {
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ mod.version=4.0

# Dependency Versions
## Annotation processor
dependencies.lombok_version=1.18.34
dependencies.lombok_version=1.18.36
## MagicLib
dependencies.magiclib_dependency=0.8.655
dependencies.magiclib_version=0.8.655-beta

# Gradle Plugins
architectury_loom_version=1.7-SNAPSHOT
grgit_version=5.2.2
preprocessor_version=ce1aeb2b
architectury_loom_version=1.9-SNAPSHOT
grgit_version=5.3.0
preprocessor_version=9d21b33
replace_token_version=1.1.2
yamlang_version=1.4.0
yamlang_version=1.4.1
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
17 changes: 15 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,22 @@ Map<String, List<String>> settings = file("settings.json").withReader {
new JsonSlurper().parse(it) as Map<String, List<String>>
}

for (String version : settings.get("versions")) {
List<String> versions = settings.get("versions") as List<String>
File mainProjectFile = file("versions/mainProject")

if (!mainProjectFile.exists()) {
throw new IllegalArgumentException("Missing mainProject file: ${mainProjectFile.absolutePath}")
}

String mainProject = new String(mainProjectFile.readBytes()).trim()

if (!versions.contains(mainProject)) {
throw new IllegalArgumentException("Invalid main project: ${mainProject}")
}

for (String version : versions) {
include(":$version")
ProjectDescriptor proj = project(":$version")
proj.setProjectDir(file("versions/$version"))
proj.setBuildFileName("../${settings.versions.get(0)}/build.gradle")
proj.setBuildFileName("../${mainProject}/build.gradle")
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import java.util.regex.Matcher
import java.util.regex.Pattern

plugins {
id("maven-publish")

Expand Down Expand Up @@ -149,21 +146,13 @@ dependencies {
}

loom {
// accessWidenerPath.set(file("src/main/resources/${project.parent.property("mod.id")}.accesswidener"))
enableTransitiveAccessWideners.set(false)

interfaceInjection {
enableDependencyInterfaceInjection.set(false)
isEnabled.set(false)
}

if (modPlatform == "forge") {
forge {
convertAccessWideners.set(true)
mixinConfig("${project.parent.property("mod.id")}.mixins.json")
}
}

runConfigs.configureEach {
// Dump modified classes automatically.
property("mixin.debug.export", "true")
Expand Down Expand Up @@ -214,8 +203,8 @@ loom {
defaultCharacterEncoding("UTF-8")

doFirst {
file("${projectDir}/run/client/config").mkdirs()
file("${projectDir}/run/client/options.txt").with { File f ->
file("${project.projectDir}/run/client/config").mkdirs()
file("${project.projectDir}/run/client/options.txt").with { File f ->
{
if (!f.exists()) {
f.parentFile.mkdirs()
Expand Down Expand Up @@ -243,7 +232,7 @@ loom {

doFirst {
// Agree eula before server init.
file("${projectDir}/run/server/eula.txt").with { File f ->
file("${project.projectDir}/run/server/eula.txt").with { File f ->
{
if (!f.exists()) {
f.parentFile.mkdirs()
Expand Down Expand Up @@ -283,18 +272,6 @@ java {
withSourcesJar()
}

remapJar {
if (forgeLike) {
if (modPlatform == "neoforge") {
// atAccessWideners.add("${project.parent.property("mod.id")}.accesswidener")
}

exclude("${project.parent.property("mod.id")}.accesswidener")
}

setRemapperIsolation(true)
}

replaceToken {
targetSourceSets.set([sourceSets.main])
replace("@MOD_IDENTIFIER@", project.parent.property("mod.id").toString().replace("-", "_"))
Expand Down
Empty file.
1 change: 1 addition & 0 deletions versions/mapping-fabric-1.15.2-1.14.4.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
com.mojang.serialization.Dynamic com.mojang.datafixers.Dynamic
1 change: 0 additions & 1 deletion versions/mapping-fabric-1.15.2-1.16.5.txt

This file was deleted.

1 change: 1 addition & 0 deletions versions/mapping-fabric-1.16.5-1.15.2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
com.mojang.serialization.Dynamic com.mojang.datafixers.Dynamic
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.

0 comments on commit bfe4b00

Please sign in to comment.