|
|
|
|
@ -87,6 +87,10 @@ class BootZipCopyAction implements CopyAction {
@@ -87,6 +87,10 @@ class BootZipCopyAction implements CopyAction {
|
|
|
|
|
|
|
|
|
|
private final boolean preserveFileTimestamps; |
|
|
|
|
|
|
|
|
|
private final Integer dirMode; |
|
|
|
|
|
|
|
|
|
private final Integer fileMode; |
|
|
|
|
|
|
|
|
|
private final boolean includeDefaultLoader; |
|
|
|
|
|
|
|
|
|
private final String layerToolsLocation; |
|
|
|
|
@ -107,14 +111,16 @@ class BootZipCopyAction implements CopyAction {
@@ -107,14 +111,16 @@ class BootZipCopyAction implements CopyAction {
|
|
|
|
|
|
|
|
|
|
private final LayerResolver layerResolver; |
|
|
|
|
|
|
|
|
|
BootZipCopyAction(File output, Manifest manifest, boolean preserveFileTimestamps, boolean includeDefaultLoader, |
|
|
|
|
String layerToolsLocation, Spec<FileTreeElement> requiresUnpack, Spec<FileTreeElement> exclusions, |
|
|
|
|
LaunchScriptConfiguration launchScript, Spec<FileCopyDetails> librarySpec, |
|
|
|
|
BootZipCopyAction(File output, Manifest manifest, boolean preserveFileTimestamps, Integer dirMode, Integer fileMode, |
|
|
|
|
boolean includeDefaultLoader, String layerToolsLocation, Spec<FileTreeElement> requiresUnpack, |
|
|
|
|
Spec<FileTreeElement> exclusions, LaunchScriptConfiguration launchScript, Spec<FileCopyDetails> librarySpec, |
|
|
|
|
Function<FileCopyDetails, ZipCompression> compressionResolver, String encoding, |
|
|
|
|
ResolvedDependencies resolvedDependencies, LayerResolver layerResolver) { |
|
|
|
|
this.output = output; |
|
|
|
|
this.manifest = manifest; |
|
|
|
|
this.preserveFileTimestamps = preserveFileTimestamps; |
|
|
|
|
this.dirMode = dirMode; |
|
|
|
|
this.fileMode = fileMode; |
|
|
|
|
this.includeDefaultLoader = includeDefaultLoader; |
|
|
|
|
this.layerToolsLocation = layerToolsLocation; |
|
|
|
|
this.requiresUnpack = requiresUnpack; |
|
|
|
|
@ -240,7 +246,7 @@ class BootZipCopyAction implements CopyAction {
@@ -240,7 +246,7 @@ class BootZipCopyAction implements CopyAction {
|
|
|
|
|
private void processDirectory(FileCopyDetails details) throws IOException { |
|
|
|
|
String name = details.getRelativePath().getPathString(); |
|
|
|
|
ZipArchiveEntry entry = new ZipArchiveEntry(name + '/'); |
|
|
|
|
prepareEntry(entry, name, getTime(details), UnixStat.FILE_FLAG | details.getMode()); |
|
|
|
|
prepareEntry(entry, name, getTime(details), getFileMode(details)); |
|
|
|
|
this.out.putArchiveEntry(entry); |
|
|
|
|
this.out.closeArchiveEntry(); |
|
|
|
|
this.writtenDirectories.add(name); |
|
|
|
|
@ -249,7 +255,7 @@ class BootZipCopyAction implements CopyAction {
@@ -249,7 +255,7 @@ class BootZipCopyAction implements CopyAction {
|
|
|
|
|
private void processFile(FileCopyDetails details) throws IOException { |
|
|
|
|
String name = details.getRelativePath().getPathString(); |
|
|
|
|
ZipArchiveEntry entry = new ZipArchiveEntry(name); |
|
|
|
|
prepareEntry(entry, name, getTime(details), UnixStat.FILE_FLAG | details.getMode()); |
|
|
|
|
prepareEntry(entry, name, getTime(details), getFileMode(details)); |
|
|
|
|
ZipCompression compression = BootZipCopyAction.this.compressionResolver.apply(details); |
|
|
|
|
if (compression == ZipCompression.STORED) { |
|
|
|
|
prepareStoredEntry(details, entry); |
|
|
|
|
@ -273,7 +279,7 @@ class BootZipCopyAction implements CopyAction {
@@ -273,7 +279,7 @@ class BootZipCopyAction implements CopyAction {
|
|
|
|
|
String parentDirectory = getParentDirectory(name); |
|
|
|
|
if (parentDirectory != null && this.writtenDirectories.add(parentDirectory)) { |
|
|
|
|
ZipArchiveEntry entry = new ZipArchiveEntry(parentDirectory + '/'); |
|
|
|
|
prepareEntry(entry, parentDirectory, time, UnixStat.DIR_FLAG | UnixStat.DEFAULT_DIR_PERM); |
|
|
|
|
prepareEntry(entry, parentDirectory, time, getDirMode()); |
|
|
|
|
this.out.putArchiveEntry(entry); |
|
|
|
|
this.out.closeArchiveEntry(); |
|
|
|
|
} |
|
|
|
|
@ -304,7 +310,7 @@ class BootZipCopyAction implements CopyAction {
@@ -304,7 +310,7 @@ class BootZipCopyAction implements CopyAction {
|
|
|
|
|
// Always write loader entries after META-INF directory (see gh-16698)
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
LoaderZipEntries loaderEntries = new LoaderZipEntries(getTime()); |
|
|
|
|
LoaderZipEntries loaderEntries = new LoaderZipEntries(getTime(), getDirMode(), getFileMode()); |
|
|
|
|
this.writtenLoaderEntries = loaderEntries.writeTo(this.out); |
|
|
|
|
if (BootZipCopyAction.this.layerResolver != null) { |
|
|
|
|
for (String name : this.writtenLoaderEntries.getFiles()) { |
|
|
|
|
@ -393,7 +399,7 @@ class BootZipCopyAction implements CopyAction {
@@ -393,7 +399,7 @@ class BootZipCopyAction implements CopyAction {
|
|
|
|
|
private void writeEntry(String name, ZipEntryContentWriter entryWriter, boolean addToLayerIndex, |
|
|
|
|
ZipEntryCustomizer entryCustomizer) throws IOException { |
|
|
|
|
ZipArchiveEntry entry = new ZipArchiveEntry(name); |
|
|
|
|
prepareEntry(entry, name, getTime(), UnixStat.FILE_FLAG | UnixStat.DEFAULT_FILE_PERM); |
|
|
|
|
prepareEntry(entry, name, getTime(), getFileMode()); |
|
|
|
|
entryCustomizer.customize(entry); |
|
|
|
|
this.out.putArchiveEntry(entry); |
|
|
|
|
entryWriter.writeTo(this.out); |
|
|
|
|
@ -437,6 +443,21 @@ class BootZipCopyAction implements CopyAction {
@@ -437,6 +443,21 @@ class BootZipCopyAction implements CopyAction {
|
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private int getDirMode() { |
|
|
|
|
return (BootZipCopyAction.this.dirMode != null) ? BootZipCopyAction.this.dirMode |
|
|
|
|
: UnixStat.DIR_FLAG | UnixStat.DEFAULT_DIR_PERM; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private int getFileMode() { |
|
|
|
|
return (BootZipCopyAction.this.fileMode != null) ? BootZipCopyAction.this.fileMode |
|
|
|
|
: UnixStat.FILE_FLAG | UnixStat.DEFAULT_FILE_PERM; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private int getFileMode(FileCopyDetails details) { |
|
|
|
|
return (BootZipCopyAction.this.fileMode != null) ? BootZipCopyAction.this.fileMode |
|
|
|
|
: UnixStat.FILE_FLAG | details.getMode(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|