@@ -51,11 +51,44 @@ dependencies {
51
51
}
52
52
}
53
53
54
+ // Must configure a single task for these test jars to ensure they are unzipped to the same directory
55
+ tasks. register(" force-collision" , Jar ) {
56
+ destinationDirectory = file(" ${ buildDir} /testrepo/org/other/gradle/collision-test/0.0.1/" )
57
+
58
+ doFirst {
59
+ def destDir = destinationDirectory. get(). asFile
60
+ def shareDir = new File (temporaryDir, " jar1" )
61
+ shareDir. mkdirs()
62
+
63
+ def jarFile1 = new File (destDir, " dummy-license-file.jar" )
64
+ def jarFile2 = new File (destDir, " dummy-license-dir.jar" )
65
+
66
+ // dummy-license-file.jar unpacks a META-INF/LICENSE file
67
+ def metaInf1 = new File (shareDir, " META-INF" )
68
+ metaInf1. mkdirs()
69
+ new File (metaInf1, " LICENSE" ). text = " Test License Content"
70
+
71
+ // dummy-license-dir.jar unpacks a META-INF/LICENSE/content.txt file
72
+ def licenseDir = new File (shareDir, " META-INF/LICENSE" )
73
+ licenseDir. mkdirs()
74
+ new File (licenseDir, " content.txt" ). text = " Test Content"
75
+
76
+ ant. jar(destfile : jarFile1) {
77
+ fileset(dir : shareDir)
78
+ }
79
+
80
+ ant. jar(destfile : jarFile2) {
81
+ fileset(dir : shareDir)
82
+ }
83
+ }
84
+ }
85
+
54
86
tasks. register(" jarhellJdk" , Jar ) {
55
87
destinationDirectory = file(" ${ buildDir} /testrepo/org/other/gradle/jarhellJdk/0.0.1/" )
56
88
archiveFileName = " jarhellJdk-0.0.1.jar"
57
89
from sourceSets. main. output
58
90
include " **/String.class"
59
91
into " java/lang"
60
92
}
61
- build. dependsOn(" jarhellJdk" )
93
+
94
+ build. dependsOn(" jarhellJdk" , " force-collision" )
0 commit comments