Skip to content

Recreate timestamp preservation fix on current master - #512

Merged
cstamas merged 1 commit into
apache:masterfrom
cowwoc:reopen-pr-387
Jul 21, 2026
Merged

Recreate timestamp preservation fix on current master#512
cstamas merged 1 commit into
apache:masterfrom
cowwoc:reopen-pr-387

Conversation

@cowwoc

@cowwoc cowwoc commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Recreates the timestamp-preservation fix from #387 on current master after the original PR was reverted.

  • Preserves file, nested-directory, and extraction-root timestamps in cached ZIPs.
  • Defers directory timestamp restoration until extraction completes.
  • Preserves newer master CacheUtils helpers and existing ZIP API callers.
  • Bumps the cache implementation namespace to v1.2 for the archive-format change.
  • Keeps CacheConfig implementations binary-compatible.
  • Adds focused timestamp coverage and documents the configuration using valid XML.

Validation

  • Maven 3.9.16: mvn -Drat.skip=true test — 86 passed, 4 skipped.
  • Spotless check passed.
  • RAT passed: mvn -ntp apache-rat:check — 0 unapproved, 0 unknown, and 242 approved licenses

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/unzip to optionally preserve file + directory timestamps, deferring directory timestamp restoration until after extraction completes.
  • Add preserveTimestamps to the generated config model and CacheConfig API (defaulting to true) and thread it through CacheControllerImpl ZIP/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
cstamas requested a review from gnodet July 20, 2026 10:31
@cstamas cstamas added the enhancement New feature or request label Jul 20, 2026
@cstamas
cstamas merged commit 9b05c60 into apache:master Jul 21, 2026
22 checks passed
@github-actions github-actions Bot added this to the 1.2.4 milestone Jul 21, 2026
@cowwoc
cowwoc deleted the reopen-pr-387 branch July 21, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants