Skip to content

Commit b37b3f5

Browse files
build: new include/shadow setup (#563)
* wip * exclude fabric loader * fix * dont relocate mixin extras on fabric * stop remapjar from including the fabric loader * fix shadow jar wrong path? * fix: including elementa in shadowed dep [no ci] * fix: missing cloud annotations dep [no ci] * Revert "stop remapjar from including the fabric loader" This reverts commit c72f56b. * fix cloud fabric not included correctly * dont relocate coroutines on fabric * fix: including coroutines when provided by FLK [no ci] * relocate included builds --------- Signed-off-by: Sychic <[email protected]> Co-authored-by: sychic <[email protected]>
1 parent 01e757e commit b37b3f5

File tree

3 files changed

+76
-56
lines changed

3 files changed

+76
-56
lines changed

mod/build.gradle.kts

Lines changed: 75 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,20 @@ loom {
9696
}
9797
}
9898

99-
val shadowMe: Configuration by configurations.creating {
100-
configurations.implementation.get().extendsFrom(this)
99+
val include: Configuration = if (platform.isLegacyForge) {
100+
val config: Configuration by configurations.creating {
101+
configurations.implementation.get().extendsFrom(this)
102+
}
103+
config
104+
} else {
105+
configurations.include.get()
101106
}
102107

103-
val shadowMeMod: Configuration by configurations.creating {
104-
configurations.modImplementation.get().extendsFrom(this)
105-
}
108+
val relocated: Configuration by configurations.creating
106109

107110
dependencies {
108111
if (platform.isForge) {
109-
shadowMe("gg.essential:loader-launchwrapper:1.2.3")
112+
include("gg.essential:loader-launchwrapper:1.2.3")
110113
} else {
111114
include(modRuntimeOnly("gg.essential:loader-fabric:1.2.3")!!)
112115
modImplementation("net.fabricmc.fabric-api:fabric-api") {
@@ -128,90 +131,102 @@ dependencies {
128131
exclude(module = "universalcraft-1.20.6-fabric")
129132
}
130133
modCompileOnly("gg.essential:universalcraft-${if (!isLegacyFabric) platform.toString() else "${platform.mcVersionStr}-forge"}:406")
131-
shadowMe("gg.essential:elementa-unstable-layoutdsl:708")
132-
shadowMe("com.github.Skytils.Vigilance:vigilance-${if (!isLegacyFabric) if (platform.mcVersion >= 11801) "1.18.1-${platform.loaderStr}" else platform.toString() else "${platform.mcVersionStr}-forge"}:afb0909442") {
134+
relocated(implementation("gg.essential:elementa-unstable-layoutdsl:710") {
135+
excludeKotlin()
136+
exclude(module = "fabric-loader")
137+
})
138+
relocated(implementation("com.github.Skytils.Vigilance:vigilance-${if (!isLegacyFabric) if (platform.mcVersion >= 11801) "1.18.1-${platform.loaderStr}" else platform.toString() else "${platform.mcVersionStr}-forge"}:afb0909442") {
133139
isTransitive = false
134-
}
140+
})
135141

136-
shadowMe("dev.dediamondpro:minemark-elementa:1.2.3") {
142+
include(implementation("dev.dediamondpro:minemark-elementa:1.2.3") {
137143
excludeKotlin()
138144
exclude(module = "elementa-1.8.9-forge")
139-
}
145+
})
140146

141-
shadowMeMod("com.github.Skytils:AsmHelper:91ecc2bd9c") {
147+
include(modImplementation("com.github.Skytils:AsmHelper:91ecc2bd9c") {
142148
exclude(module = "kotlin-reflect")
143149
exclude(module = "kotlin-stdlib-jdk8")
144150
exclude(module = "kotlin-stdlib-jdk7")
145151
exclude(module = "kotlin-stdlib")
146152
exclude(module = "kotlinx-coroutines-core")
147-
}
153+
})
148154

149-
shadowMe(platform(kotlin("bom")))
150-
shadowMe(platform(ktor("bom", "2.3.13", addSuffix = false)))
155+
relocated(implementation(platform(kotlin("bom")))!!)
156+
relocated(implementation(platform(ktor("bom", "2.3.13", addSuffix = false)))!!)
151157

152-
shadowMe(ktor("serialization-kotlinx-json")) { excludeKotlin() }
158+
relocated(implementation(ktor("serialization-kotlinx-json")) { excludeKotlin() })
153159

154-
shadowMe("org.jetbrains.kotlinx:kotlinx-serialization-json") {
160+
relocated(implementation("org.jetbrains.kotlinx:kotlinx-serialization-json") {
155161
version {
156162
strictly("[1.5.1,)")
157163
prefer("1.6.2")
158164
}
159165
excludeKotlin()
166+
})
167+
168+
relocated(implementation(ktorClient("core")) { excludeKotlin() })
169+
relocated(implementation(ktorClient("cio")) { excludeKotlin() })
170+
relocated(implementation(ktorClient("content-negotiation")) { excludeKotlin() })
171+
relocated(implementation(ktorClient("encoding")) { excludeKotlin() })
172+
173+
relocated(implementation(ktorServer("core")) { excludeKotlin() })
174+
relocated(implementation(ktorServer("cio")) { excludeKotlin() })
175+
relocated(implementation(ktorServer("content-negotiation")) { excludeKotlin() })
176+
relocated(implementation(ktorServer("compression")) { excludeKotlin() })
177+
relocated(implementation(ktorServer("cors")) { excludeKotlin() })
178+
relocated(implementation(ktorServer("conditional-headers")) { excludeKotlin() })
179+
relocated(implementation(ktorServer("auto-head-response")) { excludeKotlin() })
180+
relocated(implementation(ktorServer("default-headers")) { excludeKotlin() })
181+
relocated(implementation(ktorServer("host-common")) { excludeKotlin() })
182+
relocated(implementation(ktorServer("auth")) { excludeKotlin() })
183+
184+
include(implementation("org.brotli:dec:0.1.2")!!)
185+
include(implementation("com.aayushatharva.brotli4j:brotli4j:1.18.0")!!)
186+
187+
implementation(project(":events:$platform", configuration = "namedElements"))
188+
relocated(project(":events:$platform")) {
189+
excludeKotlin()
190+
exclude(module = "fabric-loader")
160191
}
192+
relocated(implementation(project(":vigilance")) {
193+
isTransitive = false
194+
excludeKotlin()
195+
exclude(module = "fabric-loader")
196+
})
197+
relocated(implementation("gg.skytils.hypixel.types:types") { excludeKotlin() })
198+
relocated(implementation("gg.skytils.skytilsws.shared:ws-shared") { excludeKotlin() })
161199

162-
shadowMe(ktorClient("core")) { excludeKotlin() }
163-
shadowMe(ktorClient("cio")) { excludeKotlin() }
164-
shadowMe(ktorClient("content-negotiation")) { excludeKotlin() }
165-
shadowMe(ktorClient("encoding")) { excludeKotlin() }
166-
167-
shadowMe(ktorServer("core")) { excludeKotlin() }
168-
shadowMe(ktorServer("cio")) { excludeKotlin() }
169-
shadowMe(ktorServer("content-negotiation")) { excludeKotlin() }
170-
shadowMe(ktorServer("compression")) { excludeKotlin() }
171-
shadowMe(ktorServer("cors")) { excludeKotlin() }
172-
shadowMe(ktorServer("conditional-headers")) { excludeKotlin() }
173-
shadowMe(ktorServer("auto-head-response")) { excludeKotlin() }
174-
shadowMe(ktorServer("default-headers")) { excludeKotlin() }
175-
shadowMe(ktorServer("host-common")) { excludeKotlin() }
176-
shadowMe(ktorServer("auth")) { excludeKotlin() }
177-
178-
shadowMe("org.brotli:dec:0.1.2")
179-
shadowMe("com.aayushatharva.brotli4j:brotli4j:1.18.0")
180-
181-
shadowMe(project(":events:$platform", configuration = "namedElements")) { excludeKotlin() }
182-
shadowMe(project(":vigilance")) { excludeKotlin() }
183-
shadowMe("gg.skytils.hypixel.types:types") { excludeKotlin() }
184-
shadowMe("gg.skytils.skytilsws.shared:ws-shared") { excludeKotlin() }
185-
186-
shadowMe("org.bouncycastle:bcpg-jdk18on:1.78.1") {
200+
include(implementation("org.bouncycastle:bcpg-jdk18on:1.78.1") {
187201
exclude(module = "bcprov-jdk18on")
188-
}
202+
})
189203
compileOnly("org.bouncycastle:bcprov-jdk18on:1.78.1")
190204

191205
if (platform.isFabric && !isLegacyFabric) {
192-
include(modImplementation("org.incendo:cloud-fabric:2.0.0-beta.10")!!)
206+
modImplementation("org.incendo:cloud-fabric:2.0.0-beta.10")
207+
include("org.incendo:cloud-fabric:2.0.0-beta.10")
208+
include(implementation("org.incendo:cloud-annotations:2.0.0")!!)
193209
modLocalRuntime("net.fabricmc:fabric-language-kotlin:1.13.3+kotlin.2.1.21")
194210
}
195211
annotationProcessor(
196-
shadowMe("org.incendo:cloud-kotlin-coroutines-annotations:2.0.0") { excludeKotlin() }
212+
include(implementation("org.incendo:cloud-kotlin-coroutines-annotations:2.0.0") { excludeKotlin() })!!
197213
)
198-
shadowMe("org.incendo:cloud-kotlin-extensions:2.0.0") { excludeKotlin() }
214+
include(implementation("org.incendo:cloud-kotlin-extensions:2.0.0") { excludeKotlin() })
199215

200216
if (platform.isLegacyForge) {
201217
compileOnly("net.hypixel:mod-api-forge:1.0.1.2") {
202218
exclude(group = "me.djtheredstoner", module = "DevAuth-forge-legacy")
203219
}
204-
shadowMe("net.hypixel:mod-api-forge-tweaker:1.0.1.2")
220+
relocated(include(implementation("net.hypixel:mod-api-forge-tweaker:1.0.1.2")!!)!!)
205221
} else {
206222
compileOnly("net.hypixel:mod-api:1.0.1")
207223
}
208224

209225
val mixinExtrasVersion = "0.5.0-rc.2"
210-
annotationProcessor("io.github.llamalad7:mixinextras-common:${mixinExtrasVersion}")
211226
if (platform.isFabric) {
212-
include(implementation("io.github.llamalad7:mixinextras-fabric:${mixinExtrasVersion}")!!)
227+
include(implementation(annotationProcessor("io.github.llamalad7:mixinextras-fabric:${mixinExtrasVersion}")!!)!!)
213228
} else {
214-
shadowMe("io.github.llamalad7:mixinextras-common:${mixinExtrasVersion}")
229+
relocated(implementation(annotationProcessor("io.github.llamalad7:mixinextras-common:${mixinExtrasVersion}")!!)!!)
215230
}
216231
annotationProcessor("org.spongepowered:mixin:0.8.7:processor")
217232
compileOnly("org.spongepowered:mixin:0.8.5")
@@ -264,7 +279,7 @@ tasks {
264279
}
265280
named<RemapJarTask>("remapJar") {
266281
archiveBaseName.set("Skytils")
267-
inputFile.set(shadowJar.get().archiveFile)
282+
inputFile.set(shadowJar.flatMap { it.archiveFile })
268283
doLast {
269284
MessageDigest.getInstance("SHA-256").digest(archiveFile.get().asFile.readBytes())
270285
.let {
@@ -276,16 +291,22 @@ tasks {
276291
archiveBaseName.set("Skytils")
277292
archiveClassifier.set("dev")
278293
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
279-
configurations = listOf(shadowMe, shadowMeMod)
294+
configurations = if (platform.isLegacyForge) listOf(include, relocated) else listOf(relocated)
280295

281296
relocate("dev.falsehonesty.asmhelper", "gg.skytils.asmhelper")
282-
relocate("com.llamalad7.mixinextras", "gg.skytils.mixinextras")
283297
relocate("io.ktor", "gg.skytils.ktor")
284298
relocate("kotlinx.serialization", "gg.skytils.ktx-serialization")
285-
relocate("kotlinx.coroutines", "gg.skytils.ktx-coroutines")
286299
relocate("gg.essential.vigilance", "gg.skytils.vigilance")
300+
relocate("gg.essential.elementa.unstable", "gg.skytils.elementa.unstable")
287301
relocate("net.hypixel.modapi.tweaker", "gg.skytils.hypixel-net.modapi.tweaker")
288302

303+
if (platform.isLegacyForge) {
304+
relocate("com.llamalad7.mixinextras", "gg.skytils.mixinextras")
305+
relocate("kotlinx.coroutines", "gg.skytils.ktx-coroutines")
306+
} else {
307+
exclude("kotlinx/coroutines/**")
308+
}
309+
289310
exclude(
290311
"**/LICENSE_MixinExtras",
291312
"**/LICENSE.md",

mod/root.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ plugins {
2020
id("gg.essential.multi-version.root")
2121
}
2222

23-
version = "2.0.0"
23+
version = "2.0.0-beta.1"
2424

2525
preprocess {
2626
val forge10809 = createNode("1.8.9-forge", 10809, "mcp")

mod/src/main/kotlin/gg/skytils/skytilsmod/core/Config.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import com.fasterxml.jackson.databind.annotation.JsonAppend.Prop
2121
import gg.essential.api.EssentialAPI
2222
import gg.essential.elementa.state.v2.ReferenceHolder
2323
import gg.essential.elementa.unstable.state.v2.effect
24-
import gg.essential.elementa.unstable.state.v2.onChange
2524
import gg.essential.elementa.utils.withAlpha
2625
import gg.essential.universal.UChat
2726
import gg.essential.universal.UDesktop

0 commit comments

Comments
 (0)