Skip to content

Commit 3dbe9b6

Browse files
committed
Create an embedded jar for metadata
This jar DOES NOT relocate packages due to exposing API dependencies. It should only be used by the Gradle plugin. Do not use this.
1 parent 8724cf2 commit 3dbe9b6

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

metadata/build.gradle

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2+
3+
plugins {
4+
alias libs.plugins.shadow
5+
}
6+
17
dependencies {
28
api libs.maven.artifact
39
api libs.gson
@@ -7,3 +13,15 @@ dependencies {
713
api libs.slf4j.api
814
runtimeOnly libs.slf4j.simple
915
}
16+
17+
// NOTE: This shadow jar cannot have relocation as consuming projects would be unaware of the package changes of API dependencies.
18+
// You should not use this. This is for the Gradle plugin, which uses it in an classloader-isolated task action.
19+
tasks.named('shadowJar', ShadowJar) {
20+
archiveClassifier = 'fatjar'
21+
}
22+
23+
// TODO [JarJarMetadata] Delete once the following PR is merged and included in a release
24+
// https://github.com/GradleUp/shadow/pull/1766
25+
tasks.named({'assemble'.equals(it)} as Spec<String>).configureEach {
26+
it.dependsOn(tasks.named('shadowJar', ShadowJar))
27+
}

settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ dependencyResolutionManagement {
3232
plugin 'gradleutils', 'net.minecraftforge.gradleutils' version '3.3.0'
3333
plugin 'changelog', 'net.minecraftforge.changelog' version '3.1.1'
3434
plugin 'licenser', 'net.minecraftforge.licenser' version '1.2.0'
35+
plugin 'shadow', 'com.gradleup.shadow' version '9.1.1-SNAPSHOT'
3536

3637
library 'maven-artifact', 'org.apache.maven', 'maven-artifact' version '3.8.1'
3738

0 commit comments

Comments
 (0)