Skip to content

Commit cac9bc5

Browse files
committed
LPD-68592 Use 7z so we get a progress indicator on creating our archives and to avoid any limitations in Java's zip implementation
1 parent f000d97 commit cac9bc5

File tree

1 file changed

+32
-28
lines changed

1 file changed

+32
-28
lines changed

build.gradle

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -122,38 +122,42 @@ tasks.register("importDocumentLibraryStructure") {
122122
}
123123
}
124124

125-
tasks.register("shareWorkspace", Zip) {
126-
archiveFileName = provider {
127-
"workspace_${config.namespace}_${timestamp}.zip"
128-
}
129-
130-
destinationDirectory = file 'shared_workspaces'
131-
125+
tasks.register("shareWorkspace") {
132126
doLast {
133-
logger.lifecycle "\nWorkspace zip: ${archiveFile.get()}\n"
134-
}
135-
136-
exclude ".gitkeep"
137-
exclude ".gitignore"
138-
exclude ".git"
139-
exclude ".gradle"
140-
exclude "binds"
141-
exclude "dumps/*"
142-
exclude "shared_workspaces"
143-
exclude {
144-
FileTreeElement fileTreeElement ->
145-
146-
fileTreeElement.relativePath.pathString.startsWith("exported_data/") &&
147-
!fileTreeElement.relativePath.pathString.startsWith(config.dataDirectory)
148-
}
127+
String fileListFileName = "shared_workspaces/workspace_${config.namespace}_${timestamp}.txt"
128+
String archiveFileName = "shared_workspaces/workspace_${config.namespace}_${timestamp}.zip"
129+
130+
file(fileListFileName).text = fileTree('.') {
131+
exclude ".gitkeep"
132+
exclude ".gitignore"
133+
exclude ".git"
134+
exclude ".gradle"
135+
exclude "binds"
136+
exclude "buildSrc/build"
137+
exclude "buildSrc/.gradle"
138+
exclude "dumps/*"
139+
exclude "shared_workspaces"
140+
exclude {
141+
FileTreeElement fileTreeElement ->
142+
143+
fileTreeElement.relativePath.pathString.startsWith("exported_data/") &&
144+
!fileTreeElement.relativePath.pathString.startsWith(config.dataDirectory)
145+
}
149146

150-
from '.'
147+
include "${config.dataDirectory}/**"
148+
include "**/*"
149+
}.files.collect {
150+
File file ->
151151

152-
include "${config.dataDirectory}/**"
153-
include "**/*"
152+
project.relativePath(file)
153+
}.join("\n")
154154

155-
outputs.upToDateWhen {
156-
false
155+
try {
156+
waitForCommand("7z a -bsp2 ${archiveFileName} -i@${fileListFileName}")
157+
}
158+
finally {
159+
file(fileListFileName).delete()
160+
}
157161
}
158162
}
159163

0 commit comments

Comments
 (0)