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

Move default output root on macOS to $HOME/Library/Caches #25262

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

aaronsky
Copy link
Contributor

Fixes #25260

Implements the request made here and moves the default output root on macOS from /private/var/tmp to $HOME/Library/Caches. May constitute an incompatible change, though on a cursory glance I didn't see any precedent for incompatible startup options in source.

@aaronsky aaronsky marked this pull request as ready for review February 12, 2025 10:33
@github-actions github-actions bot added team-Rules-CPP Issues for C++ rules awaiting-review PR is awaiting review from an assigned reviewer labels Feb 12, 2025
@aaronsky aaronsky requested a review from tetromino February 15, 2025 13:57
@tetromino tetromino added team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website team-CLI Console UI and removed team-Rules-CPP Issues for C++ rules labels Feb 18, 2025
@tetromino tetromino requested a review from meisterT February 18, 2025 17:53
@tetromino
Copy link
Contributor

This is an incompatible change, but arguably one that doesn't need to be gated by a flag. We do need to make sure that

  • the change is described in bazel 9 release notes
  • it doesn't get cherry-picked into 8.x point releases

An additional question is what to do about the documentation at https://bazel.build/remote/output-directories - I assume many bazel 8 users will check that page (even though it's for bazel-at-head). So maybe we need phrasing along the lines of "this is how things work in bazel 9, and that is how they used to work in bazel 8 and earlier".

@tetromino

This comment was marked as resolved.

@tetromino
Copy link
Contributor

Did some code searching.

Needs to be fixed:

Already fixed:

  • DarwinSandboxedSpawnRunner.java already marks ~/Library/Caches as always-writable

Copy link
Contributor

@tetromino tetromino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also update output-directories.md.

I'd suggest something like the following wording:

  • The outputRoot directory defaults to ~/.cache/bazel on Linux,
    ~/Library/Caches/bazel on macOS (when using Bazel 9 and newer), and on Windows it defaults to %HOME% if
    set, else %USERPROFILE% if set, else the result of calling
    SHGetKnownFolderPath() with the FOLDERID_Profile flag set. If the
    environment variable $XDG_CACHE_HOME is set on either Linux or
    macOS, the value ${XDG_CACHE_HOME}/bazel will override the default.
    If the environment variable $TEST_TMPDIR is set, as in a test of Bazel
    itself, then that value overrides any defaults.
    • Note that Bazel 8.x and earlier on macOS used /private/var/tmp as outputRoot, and ignored $XDG_CACHE_HOME.

@aaronsky
Copy link
Contributor Author

Thanks for the feedback @tetromino! I've addressed it in the latest commit. I'm happy to continue working with you to iterate on this as needed. I don't know if I'm the best person to work on those other identified points, since some of them are internal to Google and others seem to require some inter-repo coordination, but let me know what you want from me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-review PR is awaiting review from an assigned reviewer team-CLI Console UI team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move default output root on macOS to $HOME/Library/Caches
2 participants