Skip to content

Commit 4765ba7

Browse files
committed
Use JarInJar for jar shading
1 parent 5067f63 commit 4765ba7

1 file changed

Lines changed: 10 additions & 19 deletions

File tree

neoforge/build.gradle

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ repositories {
1313
}
1414

1515
base {
16-
archivesName = mod_id
16+
archivesName = mod_id + "-neoforge"
1717
}
1818

1919
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
@@ -119,21 +119,27 @@ dependencies {
119119

120120
// implementation "net.neoforged:neoforge:${neo_version}"
121121

122-
implementation ("net.kyori:adventure-api:4.17.0") {
122+
jarJar(implementation("net.kyori:adventure-api:4.17.0")) {
123123
exclude(module: "adventure-bom")
124124
exclude(module: "annotations")
125125
}
126-
implementation ("net.kyori:adventure-text-serializer-gson:4.17.0") {
126+
jarJar(implementation("net.kyori:adventure-text-serializer-gson:4.17.0")) {
127127
exclude(module: "adventure-bom")
128128
exclude(module: "adventure-api")
129129
exclude(module: "annotations")
130130
exclude(module: "auto-service-annotations")
131131
exclude(module: "gson")
132132
}
133133

134-
implementation project(path: ":common", configuration: "shadow")
134+
jarJar(implementation(project(path: ":common", configuration: "shadow")))
135+
136+
// additionalRuntimeClasspath("com.cssbham:common:.*")
137+
additionalRuntimeClasspath("net.kyori:adventure-api:4.17.0")
138+
additionalRuntimeClasspath("net.kyori:adventure-text-serializer-gson:4.17.0")
135139
}
136140

141+
tasks.shadowJar.enabled = false
142+
137143
// This block of code expands all declared replace properties in the specified resource targets.
138144
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
139145
var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) {
@@ -169,18 +175,3 @@ idea {
169175
downloadJavadoc = true
170176
}
171177
}
172-
173-
shadowJar {
174-
dependencies {
175-
include(project(":common"))
176-
include(dependency("net.kyori:.*"))
177-
exclude(dependency("net.neoforged:.*"))
178-
exclude(dependency("io.github.llamalad7:mixinextras-neoforge:.*"))
179-
}
180-
181-
relocate "net.kyori", "com.cssbham.cssminecraft.lib.adventure"
182-
183-
archiveFileName = "cssminecraft-neoforge-${project.version}.jar"
184-
185-
minimize()
186-
}

0 commit comments

Comments
 (0)