Commit Graph

92 Commits

Author SHA1 Message Date
john0030710 08fe019dc0 Use proper exception handling with Exception.nonFatalCatch.opt
- Replace try-catch with Exception.nonFatalCatch.opt for cleaner code
- Follows Scala best practices for non-fatal exception handling
- More functional and idiomatic approach
- Avoids catching fatal exceptions like VirtualMachineError
2026-01-10 00:23:05 +01:00
john0030710 6a63565b0e Improve symlink optimization using FileConverter
- Use config.fileConverter.toPath() instead of string manipulation
- Avoid hardcoded '/' prefix removal
- More robust and maintainable approach
- Fix IO.read() to include UTF-8 charset parameter
2026-01-10 00:20:32 +01:00
john0030710 d998161a6e Fix #8429: Add symlink optimization to ActionCache.get
- Check for symlinked value files before reading AC JSON
- When symlink exists and is valid, read directly from it
- Fallback to original AC file reading if symlink read fails
- Improves performance by avoiding unnecessary AC file reads
- All existing tests pass
2026-01-09 15:11:09 +01:00
Eugene Yokota 7d76f8f33e [2.x] fix: Workaround for NoSuchFileException
**Problem**
In some scripted tests, we've seen NoSuchFileException.

**Solution**
Catch the exceptions related to caching.
2025-12-25 04:38:43 -05:00
Eugene Yokota c8edb171ee [2.x] Adds cleanExpunge command
**Problem**
We might want to clear the disk cache.

**Solution**
This adds cleanExpunge command.
2025-11-22 23:12:18 -05:00
Eugene Yokota 4265b92aa4 perf: Cache content hash of binary files
**Problem**
sha256 is currently a bottleneck for no-op compilation.

**Solution**
This adds a local, in-memory cache of sha256 hashes of binary files
using their timestamp and file size.
The size of the digest cache can be configured using localDigestCacheByteSize,
which is set to 1MB by default.
2025-11-11 15:59:42 -05:00
Matt Dziuban 77ca8ea29a Add test for recovering from invalid JSON in disk cache. 2025-10-07 14:01:38 -04:00
Matt Dziuban c660c56644 Move `IO.read` and `Parser.parseUnsafe` calls inside `try`. 2025-10-07 13:28:10 -04:00
xuwei-k 14b7ddf867 remove redundant `val` modifier 2025-10-06 09:28:27 +09:00
Eugene Yokota 2fa3159f18 Update to Contraband 0.8.0 2025-09-19 00:46:34 -04:00
xuwei-k 708fffa290 delete unused "internal" package code 2025-09-06 19:41:12 +09:00
Eugene Yokota 353ee59cdb fix: Workaround syncFile issue
**Problem**
We get non-deterministic NoSuchFileException.

**Solution**
Catch the exception.
2025-08-21 08:13:49 +02:00
Eugene Yokota be5152dbfb sjson-new 0.14.0-M4 2025-08-15 22:12:06 -04:00
Eugene Yokota 6a7b56a645 Default to cached task
This flips the default `:=` operation to the cached task.
To opt out of the cache, use `Def.uncached(...)` or
mark the key with `@cacheLevel(include = Array.empty)`
2025-06-21 08:54:51 +09:00
Eugene Yokota 3b4547718e Remove deprecated methods 2025-05-11 05:23:41 -04:00
Eugene Yokota 967ecb49bc deps: Scala 3.7.0 2025-05-11 01:30:07 -04:00
xuwei-k fa6daec812 remove unused imports 2025-05-09 16:46:48 +09:00
eugene yokota 4c0ab346a7
Merge pull request #8101 from eed3si9n/wip/scalacoptions
[2.x] Scala compiler plugin support
2025-05-04 01:25:35 -04:00
Eugene Yokota d10e5b6f48 Add test for cache hits 2025-05-02 03:23:29 -04:00
Eugene Yokota 537359eb9b fix: Fix action cache
**Problem**
Action cache is capturing absolute path.

**Solution**
Use virtial path.
2025-04-28 03:16:18 -04:00
xuwei-k 5d660ab8b5 remove unnecessary `case`
- 3ca3633505/rules/src/main/scala/fix/RemoveParameterUntuplingCase.scala
- https://docs.scala-lang.org/scala3/reference/other-new-features/parameter-untupling.html
- https://docs.scala-lang.org/scala3/reference/other-new-features/parameter-untupling-spec.html
2025-02-22 08:48:29 +09:00
xuwei-k da26f3078b use withFilter instead of filter 2025-01-04 09:10:36 +09:00
xuwei-k 13d6626564 update .scalafmt.conf. enforce new scala 3 syntax 2025-01-02 11:25:34 +09:00
xuwei-k d7ec1013da remove unused type params 2025-01-01 18:42:59 +09:00
xuwei-k 2167a72ac3 correspond file name and class name 2025-01-01 16:12:30 +09:00
Eugene Yokota 799bd65ba5 fix: Retry create directory
**Problem**
Files.createDirectories can fail.

**Solution**
Use IO version, which retries.
2024-12-29 03:18:18 -05:00
xuwei-k f11d9d76f0 remove more implicit. use given and using 2024-11-18 14:39:00 +09:00
xuwei-k d193c990d1 remove implicit params. change to using 2024-11-18 06:49:22 +09:00
xuwei-k c5b7038f3a use `given` instead of `implicit val` 2024-11-17 17:35:23 +09:00
Eugene Yokota 56941dac04 refactor: Update Scala 3 syntax 2024-10-27 23:55:30 -04:00
Eugene Yokota 14f7d29afc Contraband 0.7.0 2024-10-27 16:21:18 -04:00
xuwei-k 6bf5b8b30f Update contraband sources 2024-10-18 20:34:44 +09:00
Adrien Piquerez f08f272d23 [2.x] Fix scripted cache tests 2024-09-18 10:28:11 +02:00
eugene yokota 2cb36bcaa8
[2.x] fix: fallback to file copy (#7668)
**Problem**
Disk cache currently uses symbolic links, which won't
work on Windows without the Administrator privileges or
Developer Mode.

**Solution**
This falls back to using file copy.
2024-09-15 13:03:07 -04:00
Eugene Yokota 291778086d findActionResult can return Either 2024-09-12 02:01:28 -04:00
Eugene Yokota 2aba06bb90 Refactor ActionCache to split into smaller functions 2024-09-08 14:42:24 -04:00
Eugene Yokota 721f202ae5 Hermetic incremental test
**Problem**
Current implementation of testQuick depends on the concept of timestamp,
which probably won't work well with the new consistent analysis store or
the idea of remote caching.

**Solution**
This is a step towards cached testing by making the incrementality hermetic
(no longer depends on the timestamp). Instead this calculates the aggregated
SHA-256 of the class files involved in the test.
2024-09-08 12:50:45 -04:00
Eugene Yokota d6a65d71e0 Set dirzip to 2010 timestamp 2024-08-21 02:43:36 -04:00
Eugene Yokota c9e5924b09 Implement on after sync event
When the disk cache syncs dirzip file, it compares the
item hashes against the existing files, and synchronizes them
using the disk cache.
2024-08-18 12:57:29 -04:00
Eugene Yokota 987ab5f214 Add Def.declareOutputDirectory function 2024-08-18 12:57:29 -04:00
Eugene Yokota c8ddbaed0e Implement InternalActionResult 2024-08-18 12:57:29 -04:00
Eugene Yokota fbd1fb8398 Check the digest during sync
**Problem**
Currently `syncBlobs` delete the existing files in the out directory when remote cache kicks in.

**Solution**
1. This refactors `Digest(...)` and adds support for `Digest.apply(Path)` and `Digest.sameDigest(...)`
2. This uses the `sameDigest` to compare the digest and replace the existing out files only when it needs to
2024-08-13 02:39:12 -04:00
Eugene Yokota c81d269ed2 Merge branch '1.10.x' into wip/merge-1.10.x 2024-05-07 04:39:25 -04:00
Adrien Piquerez 2e439cab1e [2.x] report cache errors
Report a cache error if the output file of a task is not cacheable
2024-04-24 10:41:56 +02:00
Adrien Piquerez 7c51ba2f64 Revert "Use fileConverter in cacheStore" 2024-04-17 09:30:44 +02:00
Adrien Piquerez 1765fde1ba Revert "Fix ActionCacheTest"
This reverts commit 763383cadb.
2024-04-17 09:01:29 +02:00
Adrien Piquerez 763383cadb Fix ActionCacheTest 2024-04-15 10:30:38 +02:00
eugene yokota 9bc0ba5f5b Update util-cache/src/main/scala/sbt/util/ActionCacheStore.scala
Co-authored-by: adpi2 <adrien.piquerez@gmail.com>
2024-04-14 14:58:13 -04:00
Eugene Yokota 86cf7c3a0c Remote caching support
This implements Bazel-compat remote caching support via a plugin.
2024-04-11 13:55:29 +02:00
Adrien Piquerez eda67a05fc Use fileConverter in cacheStore
Otherwise the store cannot sync files that are not in the out folder.
2024-04-09 16:09:44 +02:00