diff --git a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/ApplicationPluginTest.kt b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/ApplicationPluginTest.kt index e18978cc2..43bd49982 100644 --- a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/ApplicationPluginTest.kt +++ b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/ApplicationPluginTest.kt @@ -345,7 +345,7 @@ class ApplicationPluginTest : BasePluginTest() { classPathAttr: String? = null, ) { assertThat(jarPath).useAll { - containsOnly(*entriesContained, *manifestEntries) + containsOnly(*entriesContained, "META-INF/", "META-INF/MANIFEST.MF") getMainAttr(mainClassAttributeKey).isEqualTo(mainClassAttr) getMainAttr(classPathAttributeKey).isEqualTo(classPathAttr) } diff --git a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/BasePluginTest.kt b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/BasePluginTest.kt index e0e0ccb76..0ebb4e52d 100644 --- a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/BasePluginTest.kt +++ b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/BasePluginTest.kt @@ -430,8 +430,6 @@ abstract class BasePluginTest { "junit/swingui/icons/hierarchy.gif", "junit/swingui/icons/ok.gif", ) - const val manifestEntry = "META-INF/MANIFEST.MF" - val manifestEntries = arrayOf("META-INF/", manifestEntry) val shadowJarTask: String = "tasks.named('$SHADOW_JAR_TASK_NAME', ${ShadowJar::class.java.name})" diff --git a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/CachingTest.kt b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/CachingTest.kt index 13d4cb3fc..8231f804b 100644 --- a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/CachingTest.kt +++ b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/CachingTest.kt @@ -37,12 +37,14 @@ class CachingTest : BasePluginTest() { .trimMargin() ) - assertCompositeExecutions { containsOnly(*entriesInAB, *manifestEntries) } + assertCompositeExecutions { + containsOnly(*entriesInAB, "META-INF/", "META-INF/MANIFEST.MF") + } val replaced = projectScript.readText().replace("implementation 'my:b:1.0'", "") projectScript.writeText(replaced) - assertCompositeExecutions { containsOnly(*entriesInA, *manifestEntries) } + assertCompositeExecutions { containsOnly(*entriesInA, "META-INF/", "META-INF/MANIFEST.MF") } } @Test @@ -57,7 +59,9 @@ class CachingTest : BasePluginTest() { .trimMargin() ) - assertCompositeExecutions { containsOnly(*entriesInAB, *manifestEntries) } + assertCompositeExecutions { + containsOnly(*entriesInAB, "META-INF/", "META-INF/MANIFEST.MF") + } projectScript.appendText( """ @@ -70,7 +74,7 @@ class CachingTest : BasePluginTest() { assertExecutionsFromCacheAndUpToDate() assertThat(jarPath("build/libs/foo-1.0-all.jar")).useAll { - containsOnly(*entriesInAB, *manifestEntries) + containsOnly(*entriesInAB, "META-INF/", "META-INF/MANIFEST.MF") } } @@ -198,7 +202,14 @@ class CachingTest : BasePluginTest() { ) assertCompositeExecutions { - containsOnly("my/", mainClassEntry, main2ClassEntry, *entriesInAB, *manifestEntries) + containsOnly( + "my/", + mainClassEntry, + main2ClassEntry, + *entriesInAB, + "META-INF/", + "META-INF/MANIFEST.MF", + ) } projectScript.appendText( @@ -212,7 +223,13 @@ class CachingTest : BasePluginTest() { ) assertCompositeExecutions { - containsOnly("my/", mainClassEntry, main2ClassEntry, *manifestEntries) + containsOnly( + "my/", + mainClassEntry, + main2ClassEntry, + "META-INF/", + "META-INF/MANIFEST.MF", + ) } projectScript.appendText( @@ -225,7 +242,9 @@ class CachingTest : BasePluginTest() { .trimMargin() ) - assertCompositeExecutions { containsOnly("my/", mainClassEntry, *manifestEntries) } + assertCompositeExecutions { + containsOnly("my/", mainClassEntry, "META-INF/", "META-INF/MANIFEST.MF") + } projectScript.appendText( """ @@ -238,7 +257,13 @@ class CachingTest : BasePluginTest() { ) assertCompositeExecutions { - containsOnly("my/", mainClassEntry, main2ClassEntry, *manifestEntries) + containsOnly( + "my/", + mainClassEntry, + main2ClassEntry, + "META-INF/", + "META-INF/MANIFEST.MF", + ) } } @@ -255,7 +280,13 @@ class CachingTest : BasePluginTest() { ) assertCompositeExecutions { - containsOnly("my/", mainClassEntry, *junitEntries, *manifestEntries) + containsOnly( + "my/", + mainClassEntry, + *junitEntries, + "META-INF/", + "META-INF/MANIFEST.MF", + ) } projectScript.appendText( @@ -269,7 +300,9 @@ class CachingTest : BasePluginTest() { .trimMargin() ) - assertCompositeExecutions { containsOnly("my/", mainClassEntry, *manifestEntries) } + assertCompositeExecutions { + containsOnly("my/", mainClassEntry, "META-INF/", "META-INF/MANIFEST.MF") + } } @Test @@ -293,7 +326,8 @@ class CachingTest : BasePluginTest() { "client/Client.class", "server/Server.class", *junitEntries, - *manifestEntries, + "META-INF/", + "META-INF/MANIFEST.MF", ) } @@ -310,7 +344,13 @@ class CachingTest : BasePluginTest() { ) assertCompositeExecutions(jarPathProvider = { outputServerShadowedJar }) { - containsOnly("server/", "server/Server.class", *junitEntries, *manifestEntries) + containsOnly( + "server/", + "server/Server.class", + *junitEntries, + "META-INF/", + "META-INF/MANIFEST.MF", + ) } } @@ -328,7 +368,7 @@ class CachingTest : BasePluginTest() { containsOnly( "client/Used.class", "server/Server.class", - manifestEntry, + "META-INF/MANIFEST.MF", ) } @@ -340,7 +380,7 @@ class CachingTest : BasePluginTest() { "client/Used.class", "client/Reflective.class", "server/Server.class", - manifestEntry, + "META-INF/MANIFEST.MF", ) } assertExecutionsFromCacheAndUpToDate() @@ -362,7 +402,7 @@ class CachingTest : BasePluginTest() { containsOnly( "client/Used.class", "server/Server.class", - manifestEntry, + "META-INF/MANIFEST.MF", ) } @@ -376,7 +416,7 @@ class CachingTest : BasePluginTest() { "client/Reflective.class", "server/Server.class", "META-INF/proguard/client.pro", - manifestEntry, + "META-INF/MANIFEST.MF", ) } assertExecutionsFromCacheAndUpToDate() @@ -398,7 +438,13 @@ class CachingTest : BasePluginTest() { val mainClassEntry = writeClass(withImports = true) assertCompositeExecutions { - containsOnly("my/", mainClassEntry, *junitEntries, *manifestEntries) + containsOnly( + "my/", + mainClassEntry, + *junitEntries, + "META-INF/", + "META-INF/MANIFEST.MF", + ) } projectScript.appendText( @@ -413,7 +459,15 @@ class CachingTest : BasePluginTest() { junitEntries.map { it.replace("junit/framework/", "foo/junit/framework/") }.toTypedArray() assertCompositeExecutions { - containsOnly("my/", "foo/", "foo/junit/", mainClassEntry, *relocatedEntries, *manifestEntries) + containsOnly( + "my/", + "foo/", + "foo/junit/", + mainClassEntry, + *relocatedEntries, + "META-INF/", + "META-INF/MANIFEST.MF", + ) } } @@ -436,7 +490,15 @@ class CachingTest : BasePluginTest() { junitEntries.map { it.replace("junit/framework/", "foo/junit/framework/") }.toTypedArray() assertCompositeExecutions { - containsOnly("my/", "foo/", "foo/junit/", mainClassEntry, *fooEntries, *manifestEntries) + containsOnly( + "my/", + "foo/", + "foo/junit/", + mainClassEntry, + *fooEntries, + "META-INF/", + "META-INF/MANIFEST.MF", + ) } val replaced = projectScript.readText().replace("foo.junit.framework", "bar.junit.framework") @@ -445,7 +507,15 @@ class CachingTest : BasePluginTest() { junitEntries.map { it.replace("junit/framework/", "bar/junit/framework/") }.toTypedArray() assertCompositeExecutions { - containsOnly("my/", "bar/", "bar/junit/", mainClassEntry, *barEntries, *manifestEntries) + containsOnly( + "my/", + "bar/", + "bar/junit/", + mainClassEntry, + *barEntries, + "META-INF/", + "META-INF/MANIFEST.MF", + ) } } @@ -453,7 +523,9 @@ class CachingTest : BasePluginTest() { fun serviceFileTransformerPropsChanged() { val mainClassEntry = writeClass() val assertions = { - assertCompositeExecutions { containsOnly("my/", mainClassEntry, *manifestEntries) } + assertCompositeExecutions { + containsOnly("my/", mainClassEntry, "META-INF/", "META-INF/MANIFEST.MF") + } } assertions() diff --git a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/FilteringTest.kt b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/FilteringTest.kt index e378ef552..7b7fa5b55 100644 --- a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/FilteringTest.kt +++ b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/FilteringTest.kt @@ -30,7 +30,9 @@ class FilteringTest : BasePluginTest() { fun includeAllDependencies() { runWithSuccess(shadowJarPath) - assertThat(outputShadowedJar).useAll { containsOnly(*entriesInAB, *manifestEntries) } + assertThat(outputShadowedJar).useAll { + containsOnly(*entriesInAB, "META-INF/", "META-INF/MANIFEST.MF") + } } @Test @@ -47,7 +49,7 @@ class FilteringTest : BasePluginTest() { runWithSuccess(shadowJarPath) assertThat(outputShadowedJar).useAll { - containsOnly("a.properties", "b.properties", *manifestEntries) + containsOnly("a.properties", "b.properties", "META-INF/", "META-INF/MANIFEST.MF") } } @@ -111,7 +113,13 @@ class FilteringTest : BasePluginTest() { runWithSuccess(shadowJarPath) assertThat(outputShadowedJar).useAll { - containsOnly("d.properties", "my/", "my/Passed.class", *manifestEntries) + containsOnly( + "d.properties", + "my/", + "my/Passed.class", + "META-INF/", + "META-INF/MANIFEST.MF", + ) classLoader { loadClass("my.Passed") } @@ -175,7 +183,8 @@ class FilteringTest : BasePluginTest() { "server/", "client/Client.class", "server/Server.class", - *manifestEntries, + "META-INF/", + "META-INF/MANIFEST.MF", ) classLoader { loadClass("client.Client") @@ -200,7 +209,7 @@ class FilteringTest : BasePluginTest() { runWithSuccess(shadowJarPath) assertThat(outputShadowedJar).useAll { - containsOnly("a.properties", "b.properties", *manifestEntries) + containsOnly("a.properties", "b.properties", "META-INF/", "META-INF/MANIFEST.MF") } } @@ -224,19 +233,25 @@ class FilteringTest : BasePluginTest() { runWithSuccess(shadowJarPath) assertThat(outputShadowedJar).useAll { - containsOnly("f.properties", *entriesInAB, *manifestEntries) + containsOnly("f.properties", *entriesInAB, "META-INF/", "META-INF/MANIFEST.MF") } } private fun commonAssertions() { assertThat(outputShadowedJar).useAll { - containsOnly("c.properties", *entriesInAB, *manifestEntries) + containsOnly("c.properties", *entriesInAB, "META-INF/", "META-INF/MANIFEST.MF") } } private fun commonServerAssertions() { assertThat(outputServerShadowedJar).useAll { - containsOnly("server/", "server/Server.class", *junitEntries, *manifestEntries) + containsOnly( + "server/", + "server/Server.class", + *junitEntries, + "META-INF/", + "META-INF/MANIFEST.MF", + ) classLoader { loadClass("server.Server") loadClass("junit.framework.Test") diff --git a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/JavaPluginsTest.kt b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/JavaPluginsTest.kt index 7ab046680..c9cfc9b5f 100644 --- a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/JavaPluginsTest.kt +++ b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/JavaPluginsTest.kt @@ -149,7 +149,8 @@ class JavaPluginsTest : BasePluginTest() { "client/Client.class", "server/Server.class", *junitEntries, - *manifestEntries, + "META-INF/", + "META-INF/MANIFEST.MF", ) } } @@ -163,7 +164,7 @@ class JavaPluginsTest : BasePluginTest() { runWithSuccess(":server:jar") assertThat(jarPath("server/build/libs/server-1.0.jar")).useAll { - containsOnly("server/", "server/Server.class", *manifestEntries) + containsOnly("server/", "server/Server.class", "META-INF/", "META-INF/MANIFEST.MF") } assertThat(jarPath("client/build/libs/client-1.0-all.jar")).useAll { containsOnly( @@ -171,7 +172,8 @@ class JavaPluginsTest : BasePluginTest() { "client/junit/", "client/Client.class", *relocatedEntries, - *manifestEntries, + "META-INF/", + "META-INF/MANIFEST.MF", ) } } @@ -192,7 +194,8 @@ class JavaPluginsTest : BasePluginTest() { "client/Client.class", "server/Server.class", *relocatedEntries, - *manifestEntries, + "META-INF/", + "META-INF/MANIFEST.MF", ) } assertThat(jarPath("client/build/libs/client-1.0-all.jar")).useAll { @@ -201,7 +204,8 @@ class JavaPluginsTest : BasePluginTest() { "client/junit/", "client/Client.class", *relocatedEntries, - *manifestEntries, + "META-INF/", + "META-INF/MANIFEST.MF", ) } } @@ -280,7 +284,7 @@ class JavaPluginsTest : BasePluginTest() { // The fact that server compiled successfully against `client.junit.framework.Test` // means it consumed the shadowed artifact during compilation. assertThat(jarPath("server/build/libs/server-1.0.jar")).useAll { - containsOnly("server/", "server/Server.class", *manifestEntries) + containsOnly("server/", "server/Server.class", "META-INF/", "META-INF/MANIFEST.MF") } } @@ -385,7 +389,8 @@ class JavaPluginsTest : BasePluginTest() { "client/Custom2.class", "server/Server.class", *junitEntries, - *manifestEntries, + "META-INF/", + "META-INF/MANIFEST.MF", ) } } @@ -447,7 +452,9 @@ class JavaPluginsTest : BasePluginTest() { runWithSuccess(shadowJarPath) - assertThat(outputShadowedJar).useAll { containsOnly("META-INF/a.properties", *manifestEntries) } + assertThat(outputShadowedJar).useAll { + containsOnly("META-INF/a.properties", "META-INF/", "META-INF/MANIFEST.MF") + } } @Test @@ -465,7 +472,9 @@ class JavaPluginsTest : BasePluginTest() { runWithSuccess(shadowJarPath) - assertThat(outputShadowedJar).useAll { containsOnly(*entriesInA, *manifestEntries) } + assertThat(outputShadowedJar).useAll { + containsOnly(*entriesInA, "META-INF/", "META-INF/MANIFEST.MF") + } } @Test @@ -503,7 +512,8 @@ class JavaPluginsTest : BasePluginTest() { "implementation.properties", "runtime-only.properties", *entriesInB, - *manifestEntries, + "META-INF/", + "META-INF/MANIFEST.MF", ) } } @@ -590,7 +600,9 @@ class JavaPluginsTest : BasePluginTest() { runWithSuccess(shadowJarPath) - assertThat(outputShadowedJar).useAll { containsOnly(*junitEntries, *manifestEntries) } + assertThat(outputShadowedJar).useAll { + containsOnly(*junitEntries, "META-INF/", "META-INF/MANIFEST.MF") + } } @Test // #459, #852 @@ -625,7 +637,8 @@ class JavaPluginsTest : BasePluginTest() { "META-INF/gradle-plugins/", "META-INF/gradle-plugins/my.plugin.properties", *entriesInA, - *manifestEntries, + "META-INF/", + "META-INF/MANIFEST.MF", ) } } @@ -681,7 +694,7 @@ class JavaPluginsTest : BasePluginTest() { runWithSuccess(testShadowJarTask) assertThat(jarPath("build/libs/my-1.0-test.jar")).useAll { - containsOnly("my/", mainClassEntry, *junitEntries, *manifestEntries) + containsOnly("my/", mainClassEntry, *junitEntries, "META-INF/", "META-INF/MANIFEST.MF") getMainAttr(mainClassAttributeKey).isEqualTo("my.Main") classLoader { runMain("my.Main", "foo") @@ -730,7 +743,7 @@ class JavaPluginsTest : BasePluginTest() { assertThat(result.output).contains("Has ShadowPlugin: false", "Has ShadowBasePlugin: false") assertThat(jarPath("build/libs/my-1.0-test.jar")).useAll { - containsOnly("my/", mainClassEntry, *junitEntries, *manifestEntries) + containsOnly("my/", mainClassEntry, *junitEntries, "META-INF/", "META-INF/MANIFEST.MF") getMainAttr(mainClassAttributeKey).isEqualTo("my.Main") classLoader { runMain("my.Main", "foo") @@ -767,11 +780,11 @@ class JavaPluginsTest : BasePluginTest() { runWithSuccess("jar", dependencyShadowJar) assertThat(jarPath("build/libs/my-1.0.jar")).useAll { - containsOnly("my/", mainClassEntry, *manifestEntries) + containsOnly("my/", mainClassEntry, "META-INF/", "META-INF/MANIFEST.MF") transform { it.mainAttrSize }.isEqualTo(1) } assertThat(jarPath("build/libs/my-1.0-dep.jar")).useAll { - containsOnly(*junitEntries, *manifestEntries) + containsOnly(*junitEntries, "META-INF/", "META-INF/MANIFEST.MF") transform { it.mainAttrSize }.isEqualTo(1) } } @@ -881,10 +894,11 @@ class JavaPluginsTest : BasePluginTest() { "my/", "Bar/", "Bar/Foo", + "META-INF/", + "META-INF/MANIFEST.MF", "META-INF/a-1.0.jar", "META-INF/b.properties", mainClassEntry, - *manifestEntries, ) getContent("Bar/Foo").isEqualTo("Foo") getContent("META-INF/b.properties").isEqualTo("b") @@ -917,7 +931,7 @@ class JavaPluginsTest : BasePluginTest() { runWithSuccess(shadowJarPath) assertThat(outputShadowedJar).useAll { - containsOnly("a-1.0.jar", "b-1.0.jar", *manifestEntries) + containsOnly("a-1.0.jar", "b-1.0.jar", "META-INF/", "META-INF/MANIFEST.MF") } } @@ -943,7 +957,7 @@ class JavaPluginsTest : BasePluginTest() { runWithSuccess(shadowJarPath) assertThat(outputShadowedJar).useAll { - containsOnly("module-info.class", "my/", mainClassEntry, *manifestEntries) + containsOnly("module-info.class", "my/", mainClassEntry, "META-INF/", "META-INF/MANIFEST.MF") getContent("module-info.class").all { isNotEmpty() // It's the compiled class instead of the original content. @@ -985,7 +999,9 @@ class JavaPluginsTest : BasePluginTest() { runWithSuccess(shadowJarPath) - assertThat(outputShadowedJar).useAll { containsOnly(*entriesInAB, *manifestEntries) } + assertThat(outputShadowedJar).useAll { + containsOnly(*entriesInAB, "META-INF/", "META-INF/MANIFEST.MF") + } } @Test @@ -1166,7 +1182,8 @@ class JavaPluginsTest : BasePluginTest() { "com/company/", "com/company/Main.class", "com/company/Utils.class", - *manifestEntries, + "META-INF/", + "META-INF/MANIFEST.MF", ) } } @@ -1255,7 +1272,8 @@ class JavaPluginsTest : BasePluginTest() { "Foo.txt", "bar.class", "Bar.class", - *manifestEntries, + "META-INF/", + "META-INF/MANIFEST.MF", ) getBytes("Bar.class").isEqualTo(createEmptyClassBytes("Bar")) getBytes("bar.class").isEqualTo(createEmptyClassBytes("bar")) diff --git a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/KotlinPluginsTest.kt b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/KotlinPluginsTest.kt index 5105912fa..8b91765da 100644 --- a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/KotlinPluginsTest.kt +++ b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/KotlinPluginsTest.kt @@ -53,7 +53,8 @@ class KotlinPluginsTest : BasePluginTest() { "META-INF/my_my.kotlin_module", mainClassEntry, *junitEntries, - *manifestEntries, + "META-INF/", + "META-INF/MANIFEST.MF", ) if (excludeStdlib) { containsOnly(*entries) @@ -104,7 +105,8 @@ class KotlinPluginsTest : BasePluginTest() { "META-INF/my_my.kotlin_module", mainClassEntry, *entriesInAB, - *manifestEntries, + "META-INF/", + "META-INF/MANIFEST.MF", ) if (excludeStdlib) { containsOnly(*entries) @@ -148,7 +150,8 @@ class KotlinPluginsTest : BasePluginTest() { runWithSuccess(shadowJarPath) assertThat(outputShadowedJar).useAll { - val entries = arrayOf("my/", mainClassEntry, *entriesInAB, *manifestEntries) + val entries = + arrayOf("my/", mainClassEntry, *entriesInAB, "META-INF/", "META-INF/MANIFEST.MF") containsAtLeast(*entries) classLoader { loadClass("my.Main") diff --git a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/MinimizeTest.kt b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/MinimizeTest.kt index cfc2f0836..4f91912b3 100644 --- a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/MinimizeTest.kt +++ b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/MinimizeTest.kt @@ -36,7 +36,8 @@ class MinimizeTest : BasePluginTest() { "api/UnusedEntity.class", "lib/LibEntity.class", *junitResourceEntries, - *manifestEntries, + "META-INF/", + "META-INF/MANIFEST.MF", ) classLoader { loadClass("impl.SimpleEntity") @@ -78,7 +79,8 @@ class MinimizeTest : BasePluginTest() { "api/UnusedEntity.class", "lib/LibEntity.class", "lib/UnusedLibEntity.class", - *manifestEntries, + "META-INF/", + "META-INF/MANIFEST.MF", ) classLoader { loadClass("impl.SimpleEntity") @@ -120,7 +122,8 @@ class MinimizeTest : BasePluginTest() { "client/Client.class", "server/Server.class", *junitResourceEntries, - *manifestEntries, + "META-INF/", + "META-INF/MANIFEST.MF", ) classLoader { loadClass("client.Client") @@ -152,7 +155,8 @@ class MinimizeTest : BasePluginTest() { "server/", "server/Server.class", *junitEntries, - *manifestEntries, + "META-INF/", + "META-INF/MANIFEST.MF", ) classLoader { loadClass("server.Server") @@ -186,7 +190,8 @@ class MinimizeTest : BasePluginTest() { "client/Client.class", "server/Server.class", *junitEntries, - *manifestEntries, + "META-INF/", + "META-INF/MANIFEST.MF", ) classLoader { loadClass("client.Client") @@ -232,7 +237,8 @@ class MinimizeTest : BasePluginTest() { "client/Client.class", "server/Server.class", *junitEntries, - *manifestEntries, + "META-INF/", + "META-INF/MANIFEST.MF", ) classLoader { loadClass("client.Client") @@ -258,7 +264,8 @@ class MinimizeTest : BasePluginTest() { "client/Client.class", "server/Server.class", *junitEntries, - *manifestEntries, + "META-INF/", + "META-INF/MANIFEST.MF", ) classLoader { loadClass("client.Client") @@ -288,7 +295,7 @@ class MinimizeTest : BasePluginTest() { runWithSuccess(shadowJarPath) assertThat(outputShadowedJar).useAll { - containsOnly("e.properties", "f.properties", *manifestEntries) + containsOnly("e.properties", "f.properties", "META-INF/", "META-INF/MANIFEST.MF") } } @@ -317,7 +324,8 @@ class MinimizeTest : BasePluginTest() { "api/UnusedEntity.class", "lib/LibEntity.class", *junitResourceEntries, - *manifestEntries, + "META-INF/", + "META-INF/MANIFEST.MF", ) } } diff --git a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/PublishingTest.kt b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/PublishingTest.kt index 4aaf12455..7af0a92f6 100644 --- a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/PublishingTest.kt +++ b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/PublishingTest.kt @@ -317,7 +317,7 @@ class PublishingTest : BasePluginTest() { publish() assertThat(repoJarPath("my/maven/1.0/maven-1.0-tests.jar")).useAll { - containsOnly(*junitEntries, *manifestEntries) + containsOnly(*junitEntries, "META-INF/", "META-INF/MANIFEST.MF") } } @@ -491,9 +491,11 @@ class PublishingTest : BasePluginTest() { "maven-all-1.0.pom.sha512", ) - assertThat(repoJarPath("my/maven/1.0/maven-1.0.jar")).useAll { containsOnly(*manifestEntries) } + assertThat(repoJarPath("my/maven/1.0/maven-1.0.jar")).useAll { + containsOnly("META-INF/", "META-INF/MANIFEST.MF") + } assertThat(repoJarPath("my/maven/1.0/maven-1.0-all.jar")).useAll { - containsOnly(*entriesInAB, *manifestEntries) + containsOnly(*entriesInAB, "META-INF/", "META-INF/MANIFEST.MF") } assertPomCommon(repoPath("my/maven/1.0/maven-1.0.pom"), arrayOf("my:a:1.0", "my:b:1.0")) diff --git a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/R8MinimizationTest.kt b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/R8MinimizationTest.kt index 6f43b9505..1f88bf4c4 100644 --- a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/R8MinimizationTest.kt +++ b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/R8MinimizationTest.kt @@ -46,7 +46,7 @@ class R8MinimizationTest : BasePluginTest() { containsExactly( "app/App.class", "lib/Used.class", - manifestEntry, + "META-INF/MANIFEST.MF", ) classLoader { loadClass("app.App") @@ -79,7 +79,7 @@ class R8MinimizationTest : BasePluginTest() { "app/App.class", "service/DefaultGreeter.class", "service/Greeter.class", - manifestEntry, + "META-INF/MANIFEST.MF", "META-INF/services/service.Greeter", ) getContent("META-INF/services/service.Greeter").isEqualTo("service.DefaultGreeter\n") @@ -112,7 +112,7 @@ class R8MinimizationTest : BasePluginTest() { "app/App.class", "lib/Reflective.class", "lib/Used.class", - manifestEntry, + "META-INF/MANIFEST.MF", ) classLoader { loadClass("app.App") @@ -157,7 +157,7 @@ class R8MinimizationTest : BasePluginTest() { assertThat(outputAppShadowedJar).useAll { containsExactly( "lib/Reflective.class", - manifestEntry, + "META-INF/MANIFEST.MF", ) classLoader { loadClass("lib.Reflective") @@ -197,7 +197,8 @@ class R8MinimizationTest : BasePluginTest() { containsExactly( "app/App.class", "lib/Used.class", - *manifestEntries, + "META-INF/", + "META-INF/MANIFEST.MF", "app/", "lib/", ) @@ -273,7 +274,7 @@ class R8MinimizationTest : BasePluginTest() { "app/App.class", "lib/Reflective.class", "lib/Used.class", - manifestEntry, + "META-INF/MANIFEST.MF", "META-INF/proguard/lib.pro", ) classLoader { @@ -334,7 +335,7 @@ class R8MinimizationTest : BasePluginTest() { "lib/Reflective.class", "lib/Unused.class", "lib/Used.class", - manifestEntry, + "META-INF/MANIFEST.MF", "META-INF/proguard/lib.pro", ) classLoader { @@ -366,7 +367,7 @@ class R8MinimizationTest : BasePluginTest() { containsExactly( "a/a.class", "app/App.class", - manifestEntry, + "META-INF/MANIFEST.MF", ) classLoader { loadClass("app.App") @@ -394,7 +395,7 @@ class R8MinimizationTest : BasePluginTest() { assertThat(outputAppShadowedJar).useAll { containsExactly( "app/App.class", - manifestEntry, + "META-INF/MANIFEST.MF", ) } } @@ -420,7 +421,7 @@ class R8MinimizationTest : BasePluginTest() { "lib/Reflective.class", "lib/Unused.class", "lib/Used.class", - manifestEntry, + "META-INF/MANIFEST.MF", ) classLoader { loadClass("app.App") @@ -474,7 +475,7 @@ class R8MinimizationTest : BasePluginTest() { "app/App.class", "lib/Used.class", *junitEntries.filterNot { it.endsWith('/') }.toTypedArray(), - manifestEntry, + "META-INF/MANIFEST.MF", ) classLoader { loadClass("app.App") @@ -559,7 +560,7 @@ class R8MinimizationTest : BasePluginTest() { containsExactly( "app/App.class", "lib/Used.class", - manifestEntry, + "META-INF/MANIFEST.MF", ) classLoader { loadClass("lib.Used") diff --git a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/RelocationTest.kt b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/RelocationTest.kt index 225c73d53..8ec589ce7 100644 --- a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/RelocationTest.kt +++ b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/RelocationTest.kt @@ -59,7 +59,13 @@ class RelocationTest : BasePluginTest() { val result = runWithSuccess(shadowJarPath, infoArgument) assertThat(outputShadowedJar).useAll { - containsOnly("my/", mainClassEntry, *relocatedEntries, *manifestEntries) + containsOnly( + "my/", + mainClassEntry, + *relocatedEntries, + "META-INF/", + "META-INF/MANIFEST.MF", + ) classLoader { val pkg = relocationPrefix.replace('/', '.') loadClass("my.Main") @@ -106,7 +112,8 @@ class RelocationTest : BasePluginTest() { *runnerEntries, *frameworkEntries, *otherJunitEntries, - *manifestEntries, + "META-INF/", + "META-INF/MANIFEST.MF", ) classLoader { loadClass("a.BaseTestRunner") @@ -159,7 +166,8 @@ class RelocationTest : BasePluginTest() { *runnerEntries, *frameworkEntries, *otherJunitEntries, - *manifestEntries, + "META-INF/", + "META-INF/MANIFEST.MF", ) classLoader { loadClass("junit.runner.BaseTestRunner") @@ -203,7 +211,14 @@ class RelocationTest : BasePluginTest() { runWithSuccess(shadowJarPath) assertThat(outputShadowedJar).useAll { - containsOnly("my/", "shadow/", "my/MyTest.class", *relocatedEntries, *manifestEntries) + containsOnly( + "my/", + "shadow/", + "my/MyTest.class", + *relocatedEntries, + "META-INF/", + "META-INF/MANIFEST.MF", + ) classLoader { val myTest = loadClass("my.MyTest") val test = loadClass("shadow.junit.Test") @@ -238,7 +253,8 @@ class RelocationTest : BasePluginTest() { "bar/Foo.class", "bar/foo.properties", "bar/dep.properties", - *manifestEntries, + "META-INF/", + "META-INF/MANIFEST.MF", ) classLoader { loadClass("bar.Foo") @@ -361,7 +377,12 @@ class RelocationTest : BasePluginTest() { runWithSuccess(shadowJarPath) assertThat(outputShadowedJar).useAll { - containsOnly("kotlin/", "kotlin/kotlin.kotlin_builtins", *manifestEntries) + containsOnly( + "kotlin/", + "kotlin/kotlin.kotlin_builtins", + "META-INF/", + "META-INF/MANIFEST.MF", + ) } } @@ -396,9 +417,13 @@ class RelocationTest : BasePluginTest() { assertThat(outputShadowedJar).useAll { if (exclude) { - containsOnly(*junitEntries, *manifestEntries) + containsOnly(*junitEntries, "META-INF/", "META-INF/MANIFEST.MF") } else { - containsOnly("foo/", "foo/$manifestEntry", *junitEntries.map { "foo/$it" }.toTypedArray()) + containsOnly( + "foo/", + "foo/META-INF/MANIFEST.MF", + *junitEntries.map { "foo/$it" }.toTypedArray(), + ) } } } @@ -422,7 +447,13 @@ class RelocationTest : BasePluginTest() { runWithSuccess(shadowJarPath) assertThat(outputShadowedJar).useAll { - containsOnly("foo/", "foo/my/", "foo/META-INF/", "foo/$mainClassEntry", "foo/$manifestEntry") + containsOnly( + "foo/", + "foo/my/", + "foo/META-INF/", + "foo/$mainClassEntry", + "foo/META-INF/MANIFEST.MF", + ) } } @@ -580,12 +611,12 @@ class RelocationTest : BasePluginTest() { if (enableKotlinModuleRemapping) { assertThat(outputShadowedJar).useAll { - containsOnly(relocatedModuleFilePath, *manifestEntries) + containsOnly(relocatedModuleFilePath, "META-INF/", "META-INF/MANIFEST.MF") getBytes(relocatedModuleFilePath).isNotEqualTo(originalModuleFileBytes) } } else { assertThat(outputShadowedJar).useAll { - containsOnly(originalModuleFilePath, *manifestEntries) + containsOnly(originalModuleFilePath, "META-INF/", "META-INF/MANIFEST.MF") getBytes(originalModuleFilePath).isEqualTo(originalModuleFileBytes) } return @@ -635,7 +666,7 @@ class RelocationTest : BasePluginTest() { containsOnly( "my/Main.class", "relocated/foo/Foo.class", - manifestEntry, + "META-INF/MANIFEST.MF", ) classLoader { loadClass("my.Main") @@ -671,7 +702,8 @@ class RelocationTest : BasePluginTest() { "shadow/foo/", "shadow/foo/Bar.class", "shadow/foo/bar.class", - *manifestEntries, + "META-INF/", + "META-INF/MANIFEST.MF", ) val upperBytes = getBytes("shadow/foo/Bar.class") diff --git a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/ProGuardFilesResourceTransformerTest.kt b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/ProGuardFilesResourceTransformerTest.kt index 146c81b14..cd0a64cdf 100644 --- a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/ProGuardFilesResourceTransformerTest.kt +++ b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/ProGuardFilesResourceTransformerTest.kt @@ -41,7 +41,8 @@ class ProGuardFilesResourceTransformerTest : BaseTransformerTest() { "META-INF/proguard/rules.pro", "META-INF/proguard/client.pro", "META-INF/proguard/server.pro", - *manifestEntries, + "META-INF/", + "META-INF/MANIFEST.MF", ) getContent("META-INF/proguard/rules.pro") .isEqualTo( @@ -113,7 +114,8 @@ class ProGuardFilesResourceTransformerTest : BaseTransformerTest() { "relocated/foo/FooDriver.class", "META-INF/proguard/", "META-INF/proguard/rules.pro", - *manifestEntries, + "META-INF/", + "META-INF/MANIFEST.MF", ) getContent("META-INF/proguard/rules.pro") .isEqualTo( diff --git a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/ServiceFileTransformerTest.kt b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/ServiceFileTransformerTest.kt index 19967b958..2818cd30f 100644 --- a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/ServiceFileTransformerTest.kt +++ b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/ServiceFileTransformerTest.kt @@ -91,7 +91,8 @@ class ServiceFileTransformerTest : BaseTransformerTest() { "relocated/foo/FooDriver.class", "META-INF/services/", "META-INF/services/relocated.com.example.Driver", - *manifestEntries, + "META-INF/", + "META-INF/MANIFEST.MF", ) getContent("META-INF/services/relocated.com.example.Driver") .isEqualTo( @@ -154,7 +155,7 @@ class ServiceFileTransformerTest : BaseTransformerTest() { "relocated/com/example/Driver.class", "relocated/foo/FooDriver.class", "META-INF/services/relocated.com.example.Driver", - manifestEntry, + "META-INF/MANIFEST.MF", ) getContent("META-INF/services/relocated.com.example.Driver") .isEqualTo( diff --git a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/TransformersTest.kt b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/TransformersTest.kt index 8f901d4bc..d20d763ea 100644 --- a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/TransformersTest.kt +++ b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/TransformersTest.kt @@ -154,7 +154,7 @@ class TransformersTest : BaseTransformerTest() { runWithSuccess(shadowJarPath) assertThat(outputShadowedJar).useAll { - containsOnly("foo/", "foo/bar", "foo/baz", *manifestEntries) + containsOnly("foo/", "foo/bar", "foo/baz", "META-INF/", "META-INF/MANIFEST.MF") getContent("foo/bar").isEqualTo("bar1") getContent("foo/baz").isEqualTo("baz3") } @@ -178,7 +178,9 @@ class TransformersTest : BaseTransformerTest() { runWithSuccess(shadowJarPath) - assertThat(outputShadowedJar).useAll { containsOnly(*entriesInAB, *manifestEntries) } + assertThat(outputShadowedJar).useAll { + containsOnly(*entriesInAB, "META-INF/", "META-INF/MANIFEST.MF") + } } @Test @@ -194,7 +196,7 @@ class TransformersTest : BaseTransformerTest() { runWithSuccess(shadowJarPath) assertThat(outputShadowedJar).useAll { - containsOnly("foo/", "foo/Bar.txt", "foo/bar.txt", *manifestEntries) + containsOnly("foo/", "foo/Bar.txt", "foo/bar.txt", "META-INF/", "META-INF/MANIFEST.MF") getContent("foo/Bar.txt").isEqualTo("Bar") getContent("foo/bar.txt").isEqualTo("bar") } @@ -219,7 +221,7 @@ class TransformersTest : BaseTransformerTest() { runWithSuccess(shadowJarPath) assertThat(outputShadowedJar).useAll { - containsOnly("META-INF/LICENSE", *manifestEntries) + containsOnly("META-INF/LICENSE", "META-INF/", "META-INF/MANIFEST.MF") getContent("META-INF/LICENSE") .isEqualTo( """ @@ -379,7 +381,11 @@ class TransformersTest : BaseTransformerTest() { runWithSuccess(shadowJarPath) assertThat(outputShadowedJar).useAll { - containsOnly("META-INF/kotlin-stdlib.shadow.kotlin_module", *manifestEntries) + containsOnly( + "META-INF/kotlin-stdlib.shadow.kotlin_module", + "META-INF/", + "META-INF/MANIFEST.MF", + ) getBytes("META-INF/kotlin-stdlib.shadow.kotlin_module").isNotEqualTo(moduleBytes) } }