DefaultPersistentDirectoryCacheTest.groovy

Clone Tools
  • last updated a few seconds ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Remove --recompile-scripts option

The corresponding `StartParameter` property is now deprecated.

Resolves #6306.

    • -36
    • +11
    ./DefaultPersistentDirectoryCacheTest.groovy
  1. … 23 more files in changeset.
Remove --recompile-scripts option

The corresponding `StartParameter` property is now deprecated.

Resolves #6306.

    • -36
    • +11
    ./DefaultPersistentDirectoryCacheTest.groovy
  1. … 23 more files in changeset.
Use ProgressLogger so cache cleanup is visible

    • -12
    • +14
    ./DefaultPersistentDirectoryCacheTest.groovy
  1. … 10 more files in changeset.
Avoid reinitializing DefaultPersistentDirectoryStores

Prior to this commit, adding a `CleanupAction` when building a

`PersistentCache` using `CacheBuilder.withCleanup()` caused the used

implementation class to be changed from

`DefaultPersistentDirectoryStore` to `DefaultPersistentDirectoryCache`.

The latter adds initialization logic and has a very strict check in

place that verifies whether the lock file has been unlocked cleanly. If

not, it will delete all files in the cache in order to reinitialize it.

Since the mere addition of a cleanup action should not change such a

fundamental behavior, this commit moves the cleanup logic to the

`DefaultPersistentDirectoryStore` class and instantiates it when a

cleanup action is configured but no initialization related properties.

    • -94
    • +1
    ./DefaultPersistentDirectoryCacheTest.groovy
  1. … 6 more files in changeset.
Enable incremental cache cleanup

Instead of computing the complete list of eligible files at once,

SingleDepthFileFinder now returns an Iterable that creates an

Iterator that will incrementally walk the file tree.

In addition, the CleanupAction.clean() operation now takes a

CountdownTimer and implementations periodically check whether the timer

has expired. If so, the current cleanup will be aborted.

DefaultPersistentDirectoryCache now uses a timeout of 20 seconds which

is well below the file locking timeout of 60 seconds.

The marker file (gc.properties) will only be updated if the complete

cleanup was able to finish without expiring the timeout.

    • -4
    • +8
    ./DefaultPersistentDirectoryCacheTest.groovy
  1. … 13 more files in changeset.
Clean up least recently used entries in external resources file store

The files in the external resources file store cache are now

automatically cleaned up based on a least recently used strategy. The

structure in the cache is as follows:

- modules-2

- resources-2.1

- 0

- hash 1 (*)

- hash 2 (*)

- ...

- ...

The cache now keeps track of files accessed inside the marked hash

directories. The cleanup action then deletes all such files that have

not been accessed in the last 30 days.

    • -1
    • +2
    ./DefaultPersistentDirectoryCacheTest.groovy
  1. … 29 more files in changeset.
Handle missing cache.properties

Prior to this commit, the check whether initialization is required

threw a `FileNotFoundException` when cache.properties did not exist.

Since the file is only created when `DefaultPersistentDirectoryCache`

is used instead of `DefaultPersistentDirectoryStore`, this can happen

when re-using an existing cache directory that used to be accessed

using the latter but from now on will be accessed using the former.

For instance, when adding a cleanup action, `DefaultCacheFactory` will

no longer return a plain store but a Ccache.

The missing properties file will now be ignored when the cache is not

using any properties. Otherwise, it will cause the cache to be

re-initialized, i.e. all contained files will be deleted.

In addition, this commit fixes a `NullPointerException` that occurred

when a property was present in the cache's new properties but missing

in the existing cache.properties file.

    • -3
    • +83
    ./DefaultPersistentDirectoryCacheTest.groovy
  1. … 2 more files in changeset.
Detangle PersistentCache cleanup action dependencies

- Introduce a new CleanupAction

- Decorate CleanupActions via CleanupActionFactory

- Remove the special case for keeping .part files

- Ask PersistentCache for "reserved" files, these files should never be cleaned up

- Reduce the number of build operations produced when cleaning a PersistentCache

Signed-off-by: Sterling Greene <sterling@gradle.com>

    • -4
    • +5
    ./DefaultPersistentDirectoryCacheTest.groovy
  1. … 23 more files in changeset.
Move org.gradle.cache.internal to persistent-cache project

+review REVIEW-6562

    • -0
    • +290
    ./DefaultPersistentDirectoryCacheTest.groovy
  1. … 184 more files in changeset.