File tree Expand file tree Collapse file tree 2 files changed +31
-4
lines changed
functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow Expand file tree Collapse file tree 2 files changed +31
-4
lines changed Original file line number Diff line number Diff line change @@ -89,15 +89,13 @@ If it is desired to inherit a manifest from a JAR task other than the standard `
89
89
on the ` shadowJar.manifest ` object can be used to configure the upstream.
90
90
91
91
``` groovy
92
- tasks.register('testJar', Jar) {
92
+ def testJar = tasks.register('testJar', Jar) {
93
93
manifest {
94
94
attributes 'Description': 'This is an application JAR'
95
95
}
96
96
}
97
97
98
98
tasks.named('shadowJar', com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
99
- manifest {
100
- inheritFrom(project.tasks.testJar.manifest)
101
- }
99
+ manifest.inheritFrom(testJar.get().manifest)
102
100
}
103
101
```
Original file line number Diff line number Diff line change @@ -619,4 +619,33 @@ class JavaPluginTest : BasePluginTest() {
619
619
)
620
620
}
621
621
}
622
+
623
+ @Test
624
+ fun canInheritFromOtherManifest () {
625
+ projectScriptPath.appendText(
626
+ """
627
+ jar {
628
+ manifest {
629
+ attributes 'Foo-Attr': 'Foo-Value'
630
+ }
631
+ }
632
+ def testJar = tasks.register('testJar', Jar) {
633
+ manifest {
634
+ attributes 'Bar-Attr': 'Bar-Value'
635
+ }
636
+ }
637
+ $shadowJar {
638
+ manifest.inheritFrom(testJar.get().manifest)
639
+ }
640
+ """ .trimIndent(),
641
+ )
642
+
643
+ run (shadowJarTask)
644
+
645
+ assertThat(outputShadowJar).useAll {
646
+ transform { it.manifest.mainAttributes }.isNotEmpty()
647
+ getMainAttr(" Foo-Attr" ).isEqualTo(" Foo-Value" )
648
+ getMainAttr(" Bar-Attr" ).isEqualTo(" Bar-Value" )
649
+ }
650
+ }
622
651
}
You can’t perform that action at this time.
0 commit comments