Skip to content

Commit

Permalink
Make the boot jars in jib respect current timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
Malandril committed Aug 12, 2024
1 parent a1b4e8a commit b401c5a
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -540,15 +540,20 @@ private JibContainerBuilder createContainerBuilderFromFastJar(String baseJvmImag

FileEntriesLayer.Builder bootLibsLayerBuilder = FileEntriesLayer.builder().setName("fast-jar-boot-libs");
Path bootLibPath = componentsPath.resolve(JarResultBuildStep.LIB).resolve(JarResultBuildStep.BOOT_LIB);
try (Stream<Path> boolLibPaths = Files.list(bootLibPath)) {
boolLibPaths.forEach(lib -> {
try (Stream<Path> bootLibPaths = Files.list(bootLibPath)) {
bootLibPaths.forEach(lib -> {
try {
AbsoluteUnixPath libPathInContainer = workDirInContainer.resolve(JarResultBuildStep.LIB)
.resolve(JarResultBuildStep.BOOT_LIB)
.resolve(lib.getFileName());
// the boot lib jars need to preserve the modification time because otherwise AppCDS won't work
bootLibsLayerBuilder.addEntry(lib, libPathInContainer,
Files.getLastModifiedTime(lib).toInstant());
Instant bootLibModificationTime;
if (appCDSResult.isPresent()) {
// the boot lib jars need to preserve the modification time because otherwise AppCDS won't work
bootLibModificationTime = Files.getLastModifiedTime(lib).toInstant();
} else {
bootLibModificationTime = modificationTime;
}
bootLibsLayerBuilder.addEntry(lib, libPathInContainer, bootLibModificationTime);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
Expand Down

0 comments on commit b401c5a

Please sign in to comment.