@@ -46,15 +46,21 @@ dependencies {
4646 testRuntimeOnly(libs. bundles. junit. runtime)
4747}
4848
49- Files . list(Paths . get(projectDir. absolutePath))
50- .filter(Files ::isRegularFile)
51- .filter(path -> path. getFileName(). toString(). endsWith(' -installer.jar' ))
52- .findFirst()
53- .ifPresent(path -> {
54- var firstFile = path. toFile()
55- logger. lifecycle(" Detected test installer: ${ firstFile.name} " )
56- dependencies. implementation(files(firstFile))
57- })
49+ // This isn't great, but it alows us to drop a existing jar file into the root folder and do some debugging
50+ def testJars = fileTree(dir : projectDir). matching{ include ' *-installer.jar' }
51+ if (testJars. files. size() == 1 ) {
52+ logger. lifecycle(" Detected test installer: ${ testJars.singleFile.name} " )
53+ def testData = tasks. register(' testData' , Jar ) {
54+ from(zipTree(testJars. singleFile)) {
55+ exclude(' **/*.class' )
56+ exclude(' META-INF/**' )
57+ exclude(' joptsimple/**' )
58+ }
59+ includeEmptyDirs = false
60+ archiveClassifier = ' test-data'
61+ }
62+ dependencies. implementation(files(testData))
63+ }
5864
5965tasks. named(' jar' , Jar ) {
6066 manifest {
@@ -93,6 +99,21 @@ tasks.named('shadowJar', ShadowJar) {
9399
94100 archiveClassifier = ' fatjar'
95101 minimize()
102+
103+ // Meta stuff we don't need
104+ exclude(' com/google/errorprone/**' )
105+ exclude(' META-INF/maven/**' )
106+ exclude(' META-INF/proguard/**' )
107+
108+ // We shouldn't ever need to care about conflicts as this is an executable jar, but just be safe
109+ relocate(' joptsimple' , ' net.minecraftforge.installer.shadow.joptsimple' )
110+ relocate(' com.google.gson' , ' net.minecraftforge.installer.shadow.gson' )
111+
112+ // Rewrite JOpt's message files, so that help text is displayed nicely.
113+ transform(com.github.jengelman.gradle.plugins.shadow.transformers.PropertiesFileTransformer ) {
114+ paths = [ ' Messages.properties$' ]
115+ keyTransformer = { key -> ' net.minecraftforge.installer.shadow.' + key }
116+ }
96117}
97118
98119tasks. withType(JavaCompile ). configureEach {
0 commit comments