Recreate timestamp preservation fix on current master - #512
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reintroduces the timestamp-preservation fix (previously in #387) on current master, updating the cache ZIP format and wiring a new preserveTimestamps configuration option so cached output extraction can restore file, directory, and extraction-root timestamps reliably.
Changes:
- Extend
CacheUtils.zip/unzipto optionally preserve file + directory timestamps, deferring directory timestamp restoration until after extraction completes. - Add
preserveTimestampsto the generated config model andCacheConfigAPI (defaulting totrue) and thread it throughCacheControllerImplZIP/unzip call sites. - Add focused timestamp regression tests and update site docs with valid XML configuration for attached outputs.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/java/org/apache/maven/buildcache/CacheUtilsTimestampTest.java | Adds regression coverage for timestamp preservation enabled/disabled. |
| src/site/markdown/parameters.md | Documents preserveTimestamps and corrects attachedOutputs XML to element form. |
| src/main/mdo/build-cache-config.mdo | Adds preserveTimestamps to the AttachedOutputs configuration model (default true). |
| src/main/java/org/apache/maven/buildcache/xml/CacheConfigImpl.java | Implements isPreserveTimestamps() backed by <attachedOutputs>. |
| src/main/java/org/apache/maven/buildcache/xml/CacheConfig.java | Adds default isPreserveTimestamps() to keep binary compatibility. |
| src/main/java/org/apache/maven/buildcache/checksum/MavenProjectInput.java | Bumps cache implementation namespace to v1.2 for the archive-format change. |
| src/main/java/org/apache/maven/buildcache/CacheUtils.java | Implements timestamp-aware ZIP creation/extraction including deferred directory timestamp restoration. |
| src/main/java/org/apache/maven/buildcache/CacheControllerImpl.java | Passes preserveTimestamps through to ZIP/unzip operations during save/restore. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cstamas
approved these changes
Jul 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Recreates the timestamp-preservation fix from #387 on current master after the original PR was reverted.
Validation
mvn -Drat.skip=true test— 86 passed, 4 skipped.mvn -ntp apache-rat:check— 0 unapproved, 0 unknown, and 242 approved licenses