diff options
author | Sascha Roloff <sascha.roloff@huawei.com> | 2023-01-12 21:03:40 +0100 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2023-01-20 15:27:28 +0100 |
commit | 3430425a300159c4a8a0f67cbbd0c3098daa9dfc (patch) | |
tree | d91c38e8e992977004338e01a3ec03ca5d26cce7 /src/buildtool/build_engine/target_map/target_cache.cpp | |
parent | dc47c8e0878565770120d6511016a31c72df6ada (diff) | |
download | justbuild-3430425a300159c4a8a0f67cbbd0c3098daa9dfc.tar.gz |
Move execution-backend-id calculation from target-level cache to local config
This code movement is required to break a cyclic dependency coming with the
introduction of the garbage collector. target_cache depends on
garbage_collector and garbage_collector would depend on target_cache to
determine the target-level-cache directory. After moving this calculation to a
more general location, the cycle is broken.
Diffstat (limited to 'src/buildtool/build_engine/target_map/target_cache.cpp')
-rw-r--r-- | src/buildtool/build_engine/target_map/target_cache.cpp | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/src/buildtool/build_engine/target_map/target_cache.cpp b/src/buildtool/build_engine/target_map/target_cache.cpp index e08697db..493b7505 100644 --- a/src/buildtool/build_engine/target_map/target_cache.cpp +++ b/src/buildtool/build_engine/target_map/target_cache.cpp @@ -20,9 +20,7 @@ #include <fmt/core.h> #include "src/buildtool/common/artifact_digest.hpp" -#include "src/buildtool/compatibility/native_support.hpp" #include "src/buildtool/execution_api/local/config.hpp" -#include "src/buildtool/execution_api/remote/config.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" #include "src/buildtool/logging/log_level.hpp" @@ -95,19 +93,7 @@ auto TargetCache::DownloadKnownArtifacts( } auto TargetCache::ComputeCacheDir(int index) -> std::filesystem::path { - return LocalExecutionConfig::TargetCacheDir(index) / ExecutionBackendId(); -} - -auto TargetCache::ExecutionBackendId() -> std::string { - auto address = RemoteExecutionConfig::RemoteAddress(); - auto properties = RemoteExecutionConfig::PlatformProperties(); - auto backend_desc = nlohmann::json{ - {"remote_address", - address ? nlohmann::json{fmt::format( - "{}:{}", address->host, address->port)} - : nlohmann::json{}}, - {"platform_properties", - properties}}.dump(2); - return NativeSupport::Unprefix( - CAS().StoreBlobFromBytes(backend_desc).value().hash()); + [[maybe_unused]] auto id = CAS().StoreBlobFromBytes( + LocalExecutionConfig::ExecutionBackendDescription()); + return LocalExecutionConfig::TargetCacheDir(index); } |