summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2023-05-23 11:28:02 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2023-05-23 17:45:50 +0200
commitd4396683860b5aed391a336692bacae71e1007cd (patch)
tree1ec78e1b501f06b67c797058c476426bed127ecf
parent0e768e18456a99dcb335e81e92bb52293425b91b (diff)
downloadjustbuild-d4396683860b5aed391a336692bacae71e1007cd.tar.gz
Storage config: also specify the location of the execution root
As local execution is tightly coupled to storage, also specify the layout in the storage configuration. In this way, we have a central place specifying the layout of just's cache directory and avoid accidentally getting into conflicting situations. While there, also move the execution root under the generation regime, to ensure that left-over execution directories (e.g., after a forceful termination of the program) eventually get cleaned up by garbage collection.
-rw-r--r--CHANGELOG.md3
-rw-r--r--src/buildtool/execution_api/local/local_action.cpp2
-rw-r--r--src/buildtool/storage/config.hpp7
3 files changed, 11 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1b9306a8..ddd7638b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,9 @@ A feature release on top of `1.1.0`, backwards compatible.
- `just-import-git` now supports an option `--plain` to import a
repository without dependencies.
+- Minor changes to the layout of the local build root; in particular,
+ left-over execution directories will eventually get cleaned up
+ by garbage collection.
## Release `1.1.0` (2023-05-19)
diff --git a/src/buildtool/execution_api/local/local_action.cpp b/src/buildtool/execution_api/local/local_action.cpp
index 764c00aa..e2fe1199 100644
--- a/src/buildtool/execution_api/local/local_action.cpp
+++ b/src/buildtool/execution_api/local/local_action.cpp
@@ -115,7 +115,7 @@ auto LocalAction::Execute(Logger const* logger) noexcept
auto LocalAction::Run(bazel_re::Digest const& action_id) const noexcept
-> std::optional<Output> {
auto exec_path =
- CreateUniquePath(StorageConfig::BuildRoot() / "exec_root" /
+ CreateUniquePath(StorageConfig::ExecutionRoot() /
NativeSupport::Unprefix(action_id.hash()));
if (not exec_path) {
diff --git a/src/buildtool/storage/config.hpp b/src/buildtool/storage/config.hpp
index d231f06a..dd569c46 100644
--- a/src/buildtool/storage/config.hpp
+++ b/src/buildtool/storage/config.hpp
@@ -155,6 +155,13 @@ class StorageConfig {
}
}
+ /// \brief Root directory for local action executions; individual actions
+ /// create a working directory below this root.
+ [[nodiscard]] static auto ExecutionRoot() noexcept
+ -> std::filesystem::path {
+ return GenerationCacheRoot(0) / "exec_root";
+ }
+
private:
[[nodiscard]] static auto Data() noexcept -> ConfigData& {
static ConfigData instance{};