From 3430425a300159c4a8a0f67cbbd0c3098daa9dfc Mon Sep 17 00:00:00 2001 From: Sascha Roloff Date: Thu, 12 Jan 2023 21:03:40 +0100 Subject: 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. --- .../build_engine/target_map/target_cache.cpp | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'src/buildtool/build_engine/target_map/target_cache.cpp') 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 #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); } -- cgit v1.2.3