Skip to content

feat: external and persisted Zig cache#253

Merged
aherrmann merged 10 commits intomainfrom
zig-cache
Apr 7, 2024
Merged

feat: external and persisted Zig cache#253
aherrmann merged 10 commits intomainfrom
zig-cache

Conversation

@aherrmann
Copy link
Owner

@aherrmann aherrmann commented Apr 5, 2024

Configure an external, globally shared, and persisted cache directory for the Zig compiler. This directly follows the example of uber/hermetic_cc_toolchain.

Closes #87

This is required for Zig 0.12 support as Zig 0.12 produces dangling symlinks in its cache directory, making the current approach of treating the cache directory as a build output infeasible, see bazelbuild/bazel#15454 (comment).

Time saved due to persisted Zig cache

$ rm -rf /tmp/zig-cache; \
  bazel clean; \
  bazel build //configure-target:binary_x86_64-windows \
    --noremote_accept_cached; \
  bazel clean; \
  bazel build //configure-target:binary_x86_64-windows \
    --noremote_accept_cached
...
INFO: Elapsed time: 6.784s, Critical Path: 3.83s
...
INFO: Elapsed time: 4.047s, Critical Path: 1.22s
  • Configure Zig cache directory from environment
  • Track Zig cache directory in toolchain info
  • Configure Zig cache command line options
  • Configure sandbox mount path for Zig cache
  • update generated files
  • Move env_zig_cache_prefix into zig_cache.bzl
  • Unit test for the Zig cache configuration logic
  • Test match toolchain and build cache configuration
  • Integration test that Zig cache can be configured
  • Document Zig cache configuration

@aherrmann aherrmann enabled auto-merge April 5, 2024 06:59
@aherrmann aherrmann merged commit 86bd8fa into main Apr 7, 2024
@aherrmann aherrmann deleted the zig-cache branch April 7, 2024 11:44
@aherrmann aherrmann changed the title External and persisted Zig cache feat: external and persisted Zig cache Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle Zig's global and local cache meaningfully.

1 participant