From 95b3fcb09e94ac9f114509b205903b25a2bbd3ba Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Mon, 3 Apr 2023 16:38:54 +0200 Subject: Make git root part of the storage config In this way, we have the whole layout of the local build root consolidated in one place. Moreover, in this way, the location of the git root is also available to the build tool itself and can, e.g., be used as fallback CAS. --- src/other_tools/root_maps/distdir_git_map.cpp | 45 +++++++++++++-------------- 1 file changed, 22 insertions(+), 23 deletions(-) (limited to 'src/other_tools/root_maps/distdir_git_map.cpp') diff --git a/src/other_tools/root_maps/distdir_git_map.cpp b/src/other_tools/root_maps/distdir_git_map.cpp index 403247e4..952eeb75 100644 --- a/src/other_tools/root_maps/distdir_git_map.cpp +++ b/src/other_tools/root_maps/distdir_git_map.cpp @@ -18,6 +18,7 @@ #include "src/buildtool/execution_api/common/execution_common.hpp" #include "src/buildtool/file_system/file_storage.hpp" +#include "src/buildtool/storage/config.hpp" #include "src/buildtool/storage/storage.hpp" #include "src/other_tools/just_mr/progress_reporting/progress.hpp" #include "src/other_tools/just_mr/progress_reporting/statistics.hpp" @@ -76,15 +77,14 @@ auto CreateDistdirGitMap( } // ensure Git cache // define Git operation to be done - GitOpKey op_key = { - { - JustMR::Utils::GetGitCacheRoot(), // target_path - "", // git_hash - "", // branch - std::nullopt, // message - true // init_bare - }, - GitOpType::ENSURE_INIT}; + GitOpKey op_key = {{ + StorageConfig::GitRoot(), // target_path + "", // git_hash + "", // branch + std::nullopt, // message + true // init_bare + }, + GitOpType::ENSURE_INIT}; critical_git_op_map->ConsumeAfterKeysReady( ts, {std::move(op_key)}, @@ -99,14 +99,14 @@ auto CreateDistdirGitMap( } // subdir is ".", so no need to deal with the Git cache // set the workspace root - (*setter)(std::pair( - nlohmann::json::array( - {"git tree", - distdir_tree_id, - JustMR::Utils::GetGitCacheRoot().string()}), - true)); + (*setter)( + std::pair(nlohmann::json::array( + {"git tree", + distdir_tree_id, + StorageConfig::GitRoot().string()}), + true)); }, - [logger, target_path = JustMR::Utils::GetGitCacheRoot()]( + [logger, target_path = StorageConfig::GitRoot()]( auto const& msg, bool fatal) { (*logger)(fmt::format("While running critical Git " "op ENSURE_INIT for " @@ -177,13 +177,12 @@ auto CreateDistdirGitMap( return; } // set the workspace root - (*setter)( - std::pair(nlohmann::json::array( - {"git tree", - distdir_tree_id, - JustMR::Utils::GetGitCacheRoot() - .string()}), - false)); + (*setter)(std::pair( + nlohmann::json::array( + {"git tree", + distdir_tree_id, + StorageConfig::GitRoot().string()}), + false)); }, [logger, target_path = tmp_dir->GetPath()]( auto const& msg, bool fatal) { -- cgit v1.2.3