Refactor Mixin build setup

This commit is contained in:
Zoë 2022-07-06 00:26:42 -07:00
parent 29e1d05c71
commit 36ceabd749
13 changed files with 75 additions and 89 deletions

View File

@ -45,6 +45,9 @@ fun Project.configureDependencies() {
maven ("https://maven.quiltmc.org/repository/release/") {
name = "Quilt"
}
maven("https://jitpack.io") {
name = "JitPack"
}
}
dependencies {

View File

@ -18,20 +18,18 @@ object Versions {
}
object Fabric {
const val fabricLoader = "0.14.2"
const val fabricAPI = "0.56.0+1.19"
const val mixin = "0.11.2+mixin.0.8.5"
const val loom = "0.12-SNAPSHOT"
const val minotaur = "1.1.0"
const val fabricLoader = "0.14.8"
const val fabricAPI = "0.57.0+1.19"
}
object Quilt {
const val quiltLoader = "0.17.0"
const val loom = "0.12.+"
const val fabricApi = "2.0.0-beta.4+0.57.0-1.19"
}
object Mod {
const val mixin = "0.11.2+mixin.0.8.5"
const val minecraft = "1.19"
const val yarn = "$minecraft+build.1"
const val fabricLoader = "0.14.2"
@ -40,10 +38,12 @@ object Versions {
const val architecturyPlugin = "3.4-SNAPSHOT"
const val loomQuiltflower = "1.7.1"
const val lazyDfu = "0.1.2"
}
object Forge {
const val forge = "${Mod.minecraft}-41.0.38"
const val forge = "${Mod.minecraft}-41.0.63"
const val burningwave = "12.53.0"
}
@ -64,5 +64,6 @@ object Versions {
const val nbt = "6.1"
const val logback = "1.2.9"
const val commonsIO = "2.7"
const val guava = "31.0.1-jre"
}
}

View File

@ -2,10 +2,6 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
version = version("1.0.0")
repositories {
maven { url = uri("https://jitpack.io/") }
}
dependencies {
api("commons-io:commons-io:2.7")
api("com.github.Querz:NBT:6.1")

View File

@ -2,18 +2,15 @@ plugins {
application
}
repositories {
maven { url = uri("https://jitpack.io/") }
}
val javaMainClass = "com.dfsek.terra.cli.TerraCLI"
dependencies {
shadedApi("commons-io:commons-io:${Versions.CLI.commonsIO}")
shadedApi("com.github.Querz:NBT:${Versions.CLI.nbt}")
shadedApi(project(":common:implementation:base"))
shadedImplementation("com.google.guava:guava:31.0.1-jre")
shadedApi("commons-io:commons-io:${Versions.CLI.commonsIO}")
shadedApi("com.github.Querz:NBT:${Versions.CLI.nbt}")
shadedImplementation("com.google.guava:guava:${Versions.CLI.guava}")
shadedImplementation("ch.qos.logback:logback-classic:${Versions.CLI.logback}")

View File

@ -1,26 +1,22 @@
plugins {
id("fabric-loom") version Versions.Fabric.loom
id("dev.architectury.loom") version Versions.Mod.architecuryLoom
id("architectury-plugin") version Versions.Mod.architecturyPlugin
id("io.github.juuxel.loom-quiltflower") version Versions.Mod.loomQuiltflower
}
configurations {
val common by creating
compileClasspath.get().extendsFrom(common)
runtimeClasspath.get().extendsFrom(common)
architectury {
platformSetupLoomIde()
loader("fabric")
}
dependencies {
shadedApi(project(":common:implementation:base"))
compileOnly("net.fabricmc:sponge-mixin:${Versions.Fabric.mixin}")
annotationProcessor("net.fabricmc:sponge-mixin:${Versions.Fabric.mixin}")
annotationProcessor("net.fabricmc:fabric-loom:${Versions.Fabric.loom}")
"common"(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false }
implementation(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false }
"developmentFabric"(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false }
shaded(project(path = ":platforms:mixin-common", configuration = "transformProductionFabric")) { isTransitive = false }
"common"(project(path = ":platforms:mixin-lifecycle", configuration = "namedElements")) { isTransitive = false }
implementation(project(path = ":platforms:mixin-lifecycle", configuration = "namedElements")) { isTransitive = false }
"developmentFabric"(project(path = ":platforms:mixin-lifecycle", configuration = "namedElements")) { isTransitive = false }
shaded(project(path = ":platforms:mixin-lifecycle", configuration = "transformProductionFabric")) { isTransitive = false }
@ -37,15 +33,25 @@ dependencies {
modImplementation("cloud.commandframework", "cloud-fabric", Versions.Libraries.cloud)
include("cloud.commandframework", "cloud-fabric", Versions.Libraries.cloud)
modLocalRuntime("com.github.astei:lazydfu:${Versions.Mod.lazyDfu}")
}
loom {
accessWidenerPath.set(project(":platforms:mixin-common").file("terra.accesswidener"))
accessWidenerPath.set(project(":platforms:mixin-common").file("src/main/resources/terra.accesswidener"))
mixin {
defaultRefmapName.set("terra.fabric.refmap.json")
}
launches {
named("client") {
property("fabric.log.level", "debug")
}
named("server") {
property("fabric.log.level", "debug")
}
}
}
@ -57,11 +63,8 @@ tasks {
}
remapJar {
injectAccessWidener.set(true)
inputFile.set(shadowJar.get().archiveFile)
archiveFileName.set("${rootProject.name.capitalize()}-${project.version}.jar")
}
processResources {
from(project(":platforms:mixin-common").file("terra.accesswidener"))
}
}

View File

@ -0,0 +1 @@
loom.platform=fabric

View File

@ -29,6 +29,5 @@
"fabricloader": ">=0.14.2",
"java": ">=17",
"minecraft": "1.19.x"
},
"accessWidener": "terra.accesswidener"
}
}

View File

@ -6,26 +6,16 @@ plugins {
architectury {
platformSetupLoomIde()
forge()
}
configurations {
val common by creating
compileClasspath.get().extendsFrom(common)
runtimeClasspath.get().extendsFrom(common)
loader("forge")
}
dependencies {
shadedApi(project(":common:implementation:base"))
"forgeRuntimeLibrary"(project(":common:implementation:base"))
"common"(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false }
implementation(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false }
"developmentForge"(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false }
shaded(project(path = ":platforms:mixin-common", configuration = "transformProductionForge")) { isTransitive = false }
"developmentForge"(project(path = ":platforms:mixin-common", configuration = "namedElements")) {
isTransitive = false
}
forge(group = "net.minecraftforge", name = "forge", version = Versions.Forge.forge)
@ -38,12 +28,21 @@ dependencies {
}
loom {
accessWidenerPath.set(project(":platforms:mixin-common").file("terra.accesswidener"))
accessWidenerPath.set(project(":platforms:mixin-common").file("src/main/resources/terra.accesswidener"))
mixin {
defaultRefmapName.set("terra.forge.refmap.json")
}
launches {
named("client") {
property("fabric.log.level", "debug")
}
named("server") {
property("fabric.log.level", "debug")
}
}
forge {
convertAccessWideners.set(true)
mixinConfig("terra.common.mixins.json")
@ -66,17 +65,9 @@ tasks {
)
}
}
shadowJar {
exclude("fabric.mod.json")
}
remapJar {
inputFile.set(shadowJar.get().archiveFile)
archiveFileName.set("${rootProject.name.capitalize()}-${project.version}.jar")
}
processResources {
from(project(":platforms:mixin-common").file("terra.accesswidener"))
}
}

View File

@ -5,7 +5,7 @@ plugins {
}
loom {
accessWidenerPath.set(file("terra.accesswidener"))
accessWidenerPath.set(file("src/main/resources/terra.accesswidener"))
mixin {
defaultRefmapName.set("terra.common.refmap.json")
@ -15,7 +15,8 @@ loom {
dependencies {
shadedApi(project(":common:implementation:base"))
modImplementation("net.fabricmc:fabric-loader:${Versions.Mod.fabricLoader}")
compileOnly("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}")
annotationProcessor("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}")
minecraft("com.mojang:minecraft:${Versions.Mod.minecraft}")
mappings("net.fabricmc:yarn:${Versions.Mod.yarn}:v2")

View File

@ -4,32 +4,20 @@ plugins {
id("io.github.juuxel.loom-quiltflower") version Versions.Mod.loomQuiltflower
}
architectury {
platformSetupLoomIde()
fabric()
}
configurations {
val common by creating
compileClasspath.get().extendsFrom(common)
runtimeClasspath.get().extendsFrom(common)
}
dependencies {
shadedApi(project(":common:implementation:base"))
compileOnly("net.fabricmc:sponge-mixin:${Versions.Fabric.mixin}")
annotationProcessor("net.fabricmc:sponge-mixin:${Versions.Fabric.mixin}")
annotationProcessor("net.fabricmc:fabric-loom:${Versions.Fabric.loom}")
compileOnly("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}")
annotationProcessor("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}")
"common"(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false }
implementation(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false }
minecraft("com.mojang:minecraft:${Versions.Mod.minecraft}")
mappings("net.fabricmc:yarn:${Versions.Mod.yarn}:v2")
}
loom {
accessWidenerPath.set(project(":platforms:mixin-common").file("terra.accesswidener"))
accessWidenerPath.set(project(":platforms:mixin-common").file("src/main/resources/terra.accesswidener"))
mixin {
defaultRefmapName.set("terra.lifecycle.refmap.json")
@ -44,10 +32,6 @@ tasks {
remapJar {
inputFile.set(shadowJar.get().archiveFile)
}
processResources {
from(project(":platforms:mixin-common").file("terra.accesswidener"))
}
}
architectury {

View File

@ -1,6 +1,7 @@
plugins {
id("dev.architectury.loom") version Versions.Mod.architecuryLoom
id("architectury-plugin") version Versions.Mod.architecturyPlugin
id("io.github.juuxel.loom-quiltflower") version Versions.Mod.loomQuiltflower
}
architectury {
@ -18,7 +19,6 @@ dependencies {
"developmentQuilt"(project(path = ":platforms:mixin-lifecycle", configuration = "namedElements")) { isTransitive = false }
shaded(project(path = ":platforms:mixin-lifecycle", configuration = "transformProductionQuilt")) { isTransitive = false }
minecraft("com.mojang:minecraft:${Versions.Mod.minecraft}")
mappings("net.fabricmc:yarn:${Versions.Mod.yarn}:v2")
@ -34,14 +34,28 @@ dependencies {
exclude("net.fabricmc")
exclude("net.fabricmc.fabric-api")
}
modLocalRuntime("com.github.astei:lazydfu:${Versions.Mod.lazyDfu}") {
exclude("net.fabricmc")
exclude("net.fabricmc.fabric-api")
}
}
loom {
accessWidenerPath.set(project(":platforms:mixin-common").file("terra.accesswidener"))
accessWidenerPath.set(project(":platforms:mixin-common").file("src/main/resources/terra.accesswidener"))
mixin {
defaultRefmapName.set("terra.quilt.refmap.json")
}
launches {
named("client") {
property("fabric.log.level", "debug")
}
named("server") {
property("fabric.log.level", "debug")
}
}
}
@ -53,11 +67,8 @@ tasks {
}
remapJar {
injectAccessWidener.set(true)
inputFile.set(shadowJar.get().archiveFile)
archiveFileName.set("${rootProject.name.capitalize()}-${project.version}.jar")
}
processResources {
from(project(":platforms:mixin-common").file("terra.accesswidener"))
}
}

View File

@ -47,6 +47,5 @@
"terra.quilt.mixins.json",
"terra.lifecycle.mixins.json",
"terra.common.mixins.json"
],
"accessWidener": "terra.accesswidener"
]
}