diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-12-03 12:21:16 +0100 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-12-04 18:04:09 +0100 |
commit | 27f227fc2762a9796e331d9636033f2d55679947 (patch) | |
tree | aa911e4d1176c2f14170809d77ae4b7c2dd16aab /src/buildtool/main/main.cpp | |
parent | 2d0e0b73b777e5e0940a1ec241635aeb651c23f2 (diff) | |
download | justbuild-27f227fc2762a9796e331d9636033f2d55679947.tar.gz |
Rehash root lookup, if building in compatible mode
To avoid unnecessary staging and git imports of computed roots for
build in compatible mode, use the rehashing functionality to allow
us to compute the git tree of that root in memory.
Diffstat (limited to 'src/buildtool/main/main.cpp')
-rw-r--r-- | src/buildtool/main/main.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp index b1e3dbad..34125fcd 100644 --- a/src/buildtool/main/main.cpp +++ b/src/buildtool/main/main.cpp @@ -1041,9 +1041,19 @@ auto main(int argc, char* argv[]) -> int { std::size_t eval_root_jobs = std::lround(std::ceil(std::sqrt(arguments.common.jobs))); #ifndef BOOTSTRAP_BUILD_TOOL + const bool need_rehash = + arguments.protocol.hash_type != HashFunction::Type::GitSHA1; + const auto git_storage_config = + need_rehash ? CreateStorageConfig(arguments.endpoint, + HashFunction::Type::GitSHA1) + : std::nullopt; + if (need_rehash and (not git_storage_config)) { + return kExitFailure; + } if (not EvaluateComputedRoots(&repo_config, main_repo, *storage_config, + git_storage_config, traverse_args, &exec_context, eval_root_jobs)) { |