|
26 | 26 | import java.io.StringReader;
|
27 | 27 | import java.lang.reflect.InvocationTargetException;
|
28 | 28 | import java.lang.reflect.Method;
|
| 29 | +import java.nio.file.attribute.FileTime; |
29 | 30 | import java.util.ArrayList;
|
30 | 31 | import java.util.Collections;
|
31 |
| -import java.util.Date; |
32 | 32 | import java.util.List;
|
33 | 33 | import java.util.Map;
|
34 | 34 |
|
@@ -128,7 +128,7 @@ public File createArchive(
|
128 | 128 | final AssemblerConfigurationSource configSource,
|
129 | 129 | boolean recompressZippedFiles,
|
130 | 130 | String mergeManifestMode,
|
131 |
| - Date outputTimestamp) |
| 131 | + FileTime outputTimestamp) |
132 | 132 | throws ArchiveCreationException, AssemblyFormattingException, InvalidAssemblerConfigurationException {
|
133 | 133 | validate(assembly);
|
134 | 134 |
|
@@ -271,21 +271,25 @@ protected Archiver createArchiver(
|
271 | 271 | final List<ContainerDescriptorHandler> containerHandlers,
|
272 | 272 | boolean recompressZippedFiles,
|
273 | 273 | String mergeManifestMode,
|
274 |
| - Date outputTimestamp) |
| 274 | + FileTime outputTimestamp) |
275 | 275 | throws NoSuchArchiverException {
|
276 | 276 | Archiver archiver;
|
277 |
| - if ("txz".equals(format) |
278 |
| - || "tgz".equals(format) |
279 |
| - || "tbz2".equals(format) |
280 |
| - || "tzst".equals(format) |
281 |
| - || format.startsWith("tar")) { |
282 |
| - archiver = createTarArchiver(format, TarLongFileMode.valueOf(configSource.getTarLongFileMode())); |
283 |
| - } else if ("war".equals(format)) { |
284 |
| - archiver = createWarArchiver(); |
| 277 | + |
| 278 | + // one missing alias in plexus-archiver |
| 279 | + if ("tzst".equals(format)) { |
| 280 | + archiver = createTarZstArchiver(); |
285 | 281 | } else {
|
286 | 282 | archiver = archiverManager.getArchiver(format);
|
287 | 283 | }
|
288 | 284 |
|
| 285 | + if (archiver instanceof TarArchiver) { |
| 286 | + ((TarArchiver) archiver).setLongfile(TarLongFileMode.valueOf(configSource.getTarLongFileMode())); |
| 287 | + } |
| 288 | + |
| 289 | + if (archiver instanceof WarArchiver) { |
| 290 | + ((WarArchiver) archiver).setExpectWebXml(false); |
| 291 | + } |
| 292 | + |
289 | 293 | if (archiver instanceof AbstractZipArchiver) {
|
290 | 294 | ((AbstractZipArchiver) archiver).setRecompressAddedZips(recompressZippedFiles);
|
291 | 295 | }
|
@@ -323,13 +327,12 @@ protected Archiver createArchiver(
|
323 | 327 | archiver = new DryRunArchiver(archiver, LOGGER);
|
324 | 328 | }
|
325 | 329 |
|
326 |
| - archiver.setUseJvmChmod(configSource.isUpdateOnly()); |
327 | 330 | archiver.setIgnorePermissions(configSource.isIgnorePermissions());
|
328 | 331 | archiver.setForced(!configSource.isUpdateOnly());
|
329 | 332 |
|
330 | 333 | // configure for Reproducible Builds based on outputTimestamp value
|
331 | 334 | if (outputTimestamp != null) {
|
332 |
| - archiver.configureReproducible(outputTimestamp); |
| 335 | + archiver.configureReproducibleBuild(outputTimestamp); |
333 | 336 | }
|
334 | 337 |
|
335 | 338 | if (configSource.getOverrideUid() != null) {
|
@@ -460,49 +463,9 @@ private Object[] getContainerRealm() {
|
460 | 463 | }
|
461 | 464 | }
|
462 | 465 |
|
463 |
| - protected Archiver createWarArchiver() throws NoSuchArchiverException { |
464 |
| - final WarArchiver warArchiver = (WarArchiver) archiverManager.getArchiver("war"); |
465 |
| - warArchiver.setIgnoreWebxml(false); // See MNG-1274 |
466 |
| - |
467 |
| - return warArchiver; |
468 |
| - } |
469 |
| - |
470 |
| - protected Archiver createTarArchiver(final String format, final TarLongFileMode tarLongFileMode) |
471 |
| - throws NoSuchArchiverException { |
| 466 | + protected Archiver createTarZstArchiver() throws NoSuchArchiverException { |
472 | 467 | final TarArchiver tarArchiver = (TarArchiver) archiverManager.getArchiver("tar");
|
473 |
| - final int index = format.indexOf('.'); |
474 |
| - if (index >= 0) { |
475 |
| - TarArchiver.TarCompressionMethod tarCompressionMethod; |
476 |
| - // TODO: this should accept gz and bz2 as well so we can skip |
477 |
| - // TODO: over the switch |
478 |
| - final String compression = format.substring(index + 1); |
479 |
| - if ("gz".equals(compression)) { |
480 |
| - tarCompressionMethod = TarArchiver.TarCompressionMethod.gzip; |
481 |
| - } else if ("bz2".equals(compression)) { |
482 |
| - tarCompressionMethod = TarArchiver.TarCompressionMethod.bzip2; |
483 |
| - } else if ("xz".equals(compression)) { |
484 |
| - tarCompressionMethod = TarArchiver.TarCompressionMethod.xz; |
485 |
| - } else if ("snappy".equals(compression)) { |
486 |
| - tarCompressionMethod = TarArchiver.TarCompressionMethod.snappy; |
487 |
| - } else if ("zst".equals(compression)) { |
488 |
| - tarCompressionMethod = TarArchiver.TarCompressionMethod.zstd; |
489 |
| - } else { |
490 |
| - // TODO: better handling |
491 |
| - throw new IllegalArgumentException("Unknown compression format: " + compression); |
492 |
| - } |
493 |
| - tarArchiver.setCompression(tarCompressionMethod); |
494 |
| - } else if ("tgz".equals(format)) { |
495 |
| - tarArchiver.setCompression(TarArchiver.TarCompressionMethod.gzip); |
496 |
| - } else if ("tbz2".equals(format)) { |
497 |
| - tarArchiver.setCompression(TarArchiver.TarCompressionMethod.bzip2); |
498 |
| - } else if ("txz".equals(format)) { |
499 |
| - tarArchiver.setCompression(TarArchiver.TarCompressionMethod.xz); |
500 |
| - } else if ("tzst".equals(format)) { |
501 |
| - tarArchiver.setCompression(TarArchiver.TarCompressionMethod.zstd); |
502 |
| - } |
503 |
| - |
504 |
| - tarArchiver.setLongfile(tarLongFileMode); |
505 |
| - |
| 468 | + tarArchiver.setCompression(TarArchiver.TarCompressionMethod.zstd); |
506 | 469 | return tarArchiver;
|
507 | 470 | }
|
508 | 471 | }
|
0 commit comments