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

MacOS default cache dir: /tmp -> /var/tmp #163

Merged
merged 2 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ build --worker_sandboxing
# TODO: turn this back on when Zig can build CGo (https://github.com/uber/hermetic_cc_toolchain/issues/10)
#build --action_env BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
build --experimental_output_directory_naming_scheme=diff_against_dynamic_baseline
build --sandbox_add_mount_pair=/tmp
build --sandbox_add_mount_pair=/var/tmp

build:darwin_toolchains --extra_toolchains @zig_sdk//toolchain:darwin_amd64,@zig_sdk//toolchain:darwin_arm64
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
with:
key: cache-${{ matrix.os }}-${{ hashFiles('.bazelversion', 'toolchain/private/zig_sdk.bzl', '.github/workflows/ci.yaml') }}
path: |
/tmp/zig-cache
/var/tmp/zig-cache
~/Library/Caches/bazelisk

- uses: actions/cache@v4
Expand All @@ -47,7 +47,7 @@ jobs:
with:
key: cache-${{ matrix.os }}-${{ hashFiles('.bazelversion', 'toolchain/private/zig_sdk.bzl', '.github/workflows/ci.yaml') }}
path: |
/tmp/zig-cache
/var/tmp/zig-cache
~/.cache/bazelisk

- run: brew install bash
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ zig_toolchains()
And this to `.bazelrc` on a Unix-y systems:

```
build --sandbox_add_mount_pair=/tmp
build --sandbox_add_mount_pair=/var/tmp
```

Windows:
Expand All @@ -70,7 +70,7 @@ Windows:
build --sandbox_add_mount_pair=C:\Temp
```

The directories can be narrowed down to `/tmp/zig-cache` and
The directories can be narrowed down to `/var/tmp/zig-cache` and
`C:\Temp\hermetic_cc_toolchain` respectively if it can be ensured they will be
created before the invocation of `bazel build`. See [#83][pr-83] for more
context. If a different place is prefferred for zig cache, set:
Expand Down Expand Up @@ -329,7 +329,7 @@ will be accepted.

### Zig cache location

Currently zig cache is stored in `/tmp/hermetic_cc_toolchain`, so `bazel clean
Currently zig cache is stored in `/var/tmp/zig-cache`, so `bazel clean
--expunge` will not clear the zig cache. Zig's cache should be stored somewhere
in the project's path. It is not clear how to do it.

Expand Down
2 changes: 1 addition & 1 deletion ci/test
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

set -xeuo pipefail

cache_prefix="${HERMETIC_CC_TOOLCHAIN_CACHE_PREFIX:-/tmp/zig-cache}"
cache_prefix="${HERMETIC_CC_TOOLCHAIN_CACHE_PREFIX:-/var/tmp/zig-cache}"

# check a very hermetic setup with a single target. Re-building all of
# them takes a long time, so using only one. If we ever decide to build all
Expand Down
2 changes: 1 addition & 1 deletion examples/bzlmod/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ build --verbose_failures
build --worker_sandboxing

build --action_env BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
build --sandbox_add_mount_pair=/tmp
build --sandbox_add_mount_pair=/var/tmp
build --experimental_output_directory_naming_scheme=diff_against_dynamic_baseline
2 changes: 1 addition & 1 deletion examples/rules_cc/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ build --verbose_failures
build --worker_sandboxing

build --action_env BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
build --sandbox_add_mount_pair=/tmp
build --sandbox_add_mount_pair=/var/tmp
build --experimental_output_directory_naming_scheme=diff_against_dynamic_baseline
2 changes: 1 addition & 1 deletion toolchain/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def _zig_repository_impl(repository_ctx):
if os == "windows":
cache_prefix = "C:\\\\Temp\\\\hermetic_cc_toolchain"
else:
cache_prefix = "/tmp/zig-cache"
cache_prefix = "/var/tmp/zig-cache"

repository_ctx.template(
"tools/zig-wrapper.zig",
Expand Down
Loading