Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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})"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -57,7 +59,9 @@ class CachingTest : BasePluginTest() {
.trimMargin()
)

assertCompositeExecutions { containsOnly(*entriesInAB, *manifestEntries) }
assertCompositeExecutions {
containsOnly(*entriesInAB, "META-INF/", "META-INF/MANIFEST.MF")
}

projectScript.appendText(
"""
Expand All @@ -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")
}
}

Expand Down Expand Up @@ -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(
Expand All @@ -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(
Expand All @@ -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(
"""
Expand All @@ -238,7 +257,13 @@ class CachingTest : BasePluginTest() {
)

assertCompositeExecutions {
containsOnly("my/", mainClassEntry, main2ClassEntry, *manifestEntries)
containsOnly(
"my/",
mainClassEntry,
main2ClassEntry,
"META-INF/",
"META-INF/MANIFEST.MF",
)
}
}

Expand All @@ -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(
Expand All @@ -269,7 +300,9 @@ class CachingTest : BasePluginTest() {
.trimMargin()
)

assertCompositeExecutions { containsOnly("my/", mainClassEntry, *manifestEntries) }
assertCompositeExecutions {
containsOnly("my/", mainClassEntry, "META-INF/", "META-INF/MANIFEST.MF")
}
}

@Test
Expand All @@ -293,7 +326,8 @@ class CachingTest : BasePluginTest() {
"client/Client.class",
"server/Server.class",
*junitEntries,
*manifestEntries,
"META-INF/",
"META-INF/MANIFEST.MF",
)
}

Expand All @@ -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",
)
}
}

Expand All @@ -328,7 +368,7 @@ class CachingTest : BasePluginTest() {
containsOnly(
"client/Used.class",
"server/Server.class",
manifestEntry,
"META-INF/MANIFEST.MF",
)
}

Expand All @@ -340,7 +380,7 @@ class CachingTest : BasePluginTest() {
"client/Used.class",
"client/Reflective.class",
"server/Server.class",
manifestEntry,
"META-INF/MANIFEST.MF",
)
}
assertExecutionsFromCacheAndUpToDate()
Expand All @@ -362,7 +402,7 @@ class CachingTest : BasePluginTest() {
containsOnly(
"client/Used.class",
"server/Server.class",
manifestEntry,
"META-INF/MANIFEST.MF",
)
}

Expand All @@ -376,7 +416,7 @@ class CachingTest : BasePluginTest() {
"client/Reflective.class",
"server/Server.class",
"META-INF/proguard/client.pro",
manifestEntry,
"META-INF/MANIFEST.MF",
)
}
assertExecutionsFromCacheAndUpToDate()
Expand All @@ -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(
Expand All @@ -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",
)
}
}

Expand All @@ -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")
Expand All @@ -445,15 +507,25 @@ 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",
)
}
}

@Test
fun serviceFileTransformerPropsChanged() {
val mainClassEntry = writeClass()
val assertions = {
assertCompositeExecutions { containsOnly("my/", mainClassEntry, *manifestEntries) }
assertCompositeExecutions {
containsOnly("my/", mainClassEntry, "META-INF/", "META-INF/MANIFEST.MF")
}
}

assertions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
}
}

Expand Down Expand Up @@ -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")
}
Expand Down Expand Up @@ -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")
Expand All @@ -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")
}
}

Expand All @@ -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")
Expand Down
Loading