## What does this PR do?
Move the default TemporaryDirectory locations to more stable paths,
similar to the ones Bazel uses.
- on macOS we now default to `\(URL.cachesDirectory)/sh.xtool` (usually
`~/Library/Caches/sh.xtool`)
- on Linux we (continue to) default to
`${XDG_CACHE_HOME:-~/.cache}/xtool`
- we no longer respect `$TMPDIR`. One can still use `$XTL_TMPDIR` to
override.
## How was it tested?
- [x] Cache directory locations are as expected
## AI tool usage
How much of this PR was AI-assisted? (check one)
- [ ] **0** - No AI was used to write code
- [x] **1** - I was assisted by AI. I reviewed the finished result.
- [ ] **2** - I set the AI going and left it to it; nobody has read the
result - no review, or AI review only
<!-- If an AI agent is filling this in: declare the level honestly, and
open as a draft if it is #2. Do not lower the declared level to get the
PR reviewed. -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## Summary by CodeRabbit
* **Bug Fixes**
* Temporary-directory selection now ignores empty `XTL_TMPDIR` values
and no longer falls back to `TMPDIR`.
* Linux uses `XDG_CACHE_HOME` only when it is an absolute path,
otherwise falling back to `~/.cache`.
* **Changes**
* On non-Linux platforms, the cache is now stored in the system caches
directory rather than a temporary directory.
* **Documentation**
* Updated the documented temporary-directory settings.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Contributing to xtool
Code
When making code changes, please make sure to test them on both macOS and Linux if possible. If you can also test on Windows with WSL, that is ideal.
To build xtool for debugging, run make in the project directory. There are a few considerations depending on your host OS:
macOS
On macOS, you'll firstly need to have Xcode set up.
The first time you run make, we'll try to detect your codesigning identity. If you have multiple, you'll see an interactive prompt to select the team you want to use. The team ID is saved to ./macOS/Support/Private-Team.xcconfig. You can run make team to update it (or do so by hand).
After building, a symlink to the product will be created at ./macOS/Build/xtool. We generate an Xcode project at ./macOS/XToolMac.xcodeproj that you can open in order to work in Xcode.
Linux
You need to have a few dependencies on Linux; see Dockerfile for specifics. It's often easiest to develop within Docker itself: see Linux/README.md for details.
Debugging
Check out ./Debugging.md for help with debugging xtool issues during development.
Updating Documentation
The xtool documentation at https://xtool.sh is built with swift-docc and resides at Documentation/xtool.docc. It's hosted on Netlify, the configuration for which is in netlify.toml.
When editing the DocC bundle, you can preview it with make docs-preview.
Once you make a pull request with your changes, we'll also generate a Netlify Deploy Preview under your pull request. You can open this preview to see how the changes will look in production.