@@ -13,18 +13,26 @@ if (buildNumber) {
13
13
try {
14
14
ant. tar(destfile : uploadFile, compression : " bzip2" , longfile : " gnu" ) {
15
15
fileset(dir : projectDir) {
16
- fileTree(projectDir)
17
- .include(" **/*.hprof" )
18
- .include(" **/reaper.log" )
19
- .include(" **/build/testclusters/**" )
20
- .exclude(" **/build/testclusters/**/data/**" )
21
- .exclude(" **/build/testclusters/**/distro/**" )
22
- .exclude(" **/build/testclusters/**/repo/**" )
23
- .exclude(" **/build/testclusters/**/extract/**" )
24
- .filter { Files . isRegularFile(it. toPath()) }
25
- .each {
26
- include(name : projectDir. toPath(). relativize(it. toPath()))
16
+ Set<File > fileSet = fileTree(projectDir) {
17
+ include(" **/*.hprof" )
18
+ include(" **/reaper.log" )
19
+ include(" **/build/testclusters/**" )
20
+ exclude(" **/build/testclusters/**/data/**" )
21
+ exclude(" **/build/testclusters/**/distro/**" )
22
+ exclude(" **/build/testclusters/**/repo/**" )
23
+ exclude(" **/build/testclusters/**/extract/**" )
24
+ }
25
+ .files
26
+ .findAll { Files . isRegularFile(it. toPath()) }
27
+
28
+ if (fileSet. empty) {
29
+ // In cases where we don't match any workspace files, exclude everything
30
+ ant. exclude(name : " **/*" )
31
+ } else {
32
+ fileSet. each {
33
+ ant. include(name : projectDir. toPath(). relativize(it. toPath()))
27
34
}
35
+ }
28
36
}
29
37
30
38
fileset(dir : " ${ gradle.gradleUserHomeDir} /daemon/${ gradle.gradleVersion} " , followsymlinks : false ) {
0 commit comments