Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: external and persisted Zig cache #253

Merged
merged 10 commits into from
Apr 7, 2024
Merged

feat: external and persisted Zig cache #253

merged 10 commits into from
Apr 7, 2024

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
21 checks passed
@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