Fix cases where we would unintentionally tar the entire build workspace (#49130)

Fix cases where we would unintentionally tar the entire build workspace
This commit is contained in:
Mark Vieira 2019-11-15 06:50:40 -08:00
parent de8107e350
commit 69e69f5bff
No known key found for this signature in database
GPG Key ID: CA947EF7E6D4B105
1 changed files with 19 additions and 11 deletions

View File

@ -13,18 +13,26 @@ if (buildNumber) {
try {
ant.tar(destfile: uploadFile, compression: "bzip2", longfile: "gnu") {
fileset(dir: projectDir) {
fileTree(projectDir)
.include("**/*.hprof")
.include("**/reaper.log")
.include("**/build/testclusters/**")
.exclude("**/build/testclusters/**/data/**")
.exclude("**/build/testclusters/**/distro/**")
.exclude("**/build/testclusters/**/repo/**")
.exclude("**/build/testclusters/**/extract/**")
.filter { Files.isRegularFile(it.toPath()) }
.each {
include(name: projectDir.toPath().relativize(it.toPath()))
Set<File> fileSet = fileTree(projectDir) {
include("**/*.hprof")
include("**/reaper.log")
include("**/build/testclusters/**")
exclude("**/build/testclusters/**/data/**")
exclude("**/build/testclusters/**/distro/**")
exclude("**/build/testclusters/**/repo/**")
exclude("**/build/testclusters/**/extract/**")
}
.files
.findAll { Files.isRegularFile(it.toPath()) }
if (fileSet.empty) {
// In cases where we don't match any workspace files, exclude everything
ant.exclude(name: "**/*")
} else {
fileSet.each {
ant.include(name: projectDir.toPath().relativize(it.toPath()))
}
}
}
fileset(dir: "${gradle.gradleUserHomeDir}/daemon/${gradle.gradleVersion}", followsymlinks: false) {