diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2025-02-14 15:16:10 +0100 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2025-02-19 17:50:30 +0100 |
commit | 8ab573ef1c624e2ed81b2032178c25451176d2f1 (patch) | |
tree | b3e41ee30eed3240bcd18502b7972903e7c2a53e /src | |
parent | dfa481bd5f97d92c444dc31a4a051cb890494d1d (diff) | |
download | justbuild-8ab573ef1c624e2ed81b2032178c25451176d2f1.tar.gz |
ApiBundle: Remove HashFunction.
And ensure every user obtains HashFunction from corresponding IExecutionApi
Diffstat (limited to 'src')
20 files changed, 56 insertions, 81 deletions
diff --git a/src/buildtool/computed_roots/TARGETS b/src/buildtool/computed_roots/TARGETS index 08621e59..67592e95 100644 --- a/src/buildtool/computed_roots/TARGETS +++ b/src/buildtool/computed_roots/TARGETS @@ -30,7 +30,6 @@ , "deps": [ ["@", "gsl", "", "gsl"] , ["src/buildtool/build_engine/target_map", "configured_target"] - , ["src/buildtool/execution_api/common", "api_bundle"] , ["src/buildtool/logging", "logging"] , ["src/buildtool/main", "analyse_context"] ] diff --git a/src/buildtool/computed_roots/evaluate.cpp b/src/buildtool/computed_roots/evaluate.cpp index 6c280e20..839f9f98 100644 --- a/src/buildtool/computed_roots/evaluate.cpp +++ b/src/buildtool/computed_roots/evaluate.cpp @@ -266,8 +266,8 @@ void ComputeAndFill( key.ToString()); } else { - auto serve_result = InquireServe( - &analyse_context, target, context->apis, &build_logger); + auto serve_result = + InquireServe(&analyse_context, target, &build_logger); if (serve_result) { auto root_result = FileRoot(*serve_result); Logger::Log(LogLevel::Performance, diff --git a/src/buildtool/computed_roots/inquire_serve.cpp b/src/buildtool/computed_roots/inquire_serve.cpp index 5f5c12ef..8869937b 100644 --- a/src/buildtool/computed_roots/inquire_serve.cpp +++ b/src/buildtool/computed_roots/inquire_serve.cpp @@ -42,7 +42,6 @@ [[nodiscard]] auto InquireServe( gsl::not_null<AnalyseContext*> const& analyse_context, BuildMaps::Target::ConfiguredTarget const& id, - gsl::not_null<ApiBundle const*> const& /* apis */, gsl::not_null<Logger const*> const& logger) -> std::optional<std::string> { auto const& repo_name = id.target.ToModule().repository; diff --git a/src/buildtool/computed_roots/inquire_serve.hpp b/src/buildtool/computed_roots/inquire_serve.hpp index cec39400..168f8fc1 100644 --- a/src/buildtool/computed_roots/inquire_serve.hpp +++ b/src/buildtool/computed_roots/inquire_serve.hpp @@ -20,7 +20,6 @@ #include "gsl/gsl" #include "src/buildtool/build_engine/target_map/configured_target.hpp" -#include "src/buildtool/execution_api/common/api_bundle.hpp" #include "src/buildtool/logging/logger.hpp" #include "src/buildtool/main/analyse_context.hpp" @@ -29,7 +28,6 @@ [[nodiscard]] auto InquireServe( gsl::not_null<AnalyseContext*> const& analyse_context, BuildMaps::Target::ConfiguredTarget const& id, - gsl::not_null<ApiBundle const*> const& apis, gsl::not_null<Logger const*> const& logger) -> std::optional<std::string>; #endif diff --git a/src/buildtool/execution_api/common/TARGETS b/src/buildtool/execution_api/common/TARGETS index 3bf03655..e7624d1d 100644 --- a/src/buildtool/execution_api/common/TARGETS +++ b/src/buildtool/execution_api/common/TARGETS @@ -65,12 +65,12 @@ , ["src/buildtool/common", "config"] , ["src/buildtool/common/remote", "remote_common"] , ["src/buildtool/common/remote", "retry_config"] - , ["src/buildtool/crypto", "hash_function"] , ["src/buildtool/execution_api/local", "context"] , ["src/buildtool/execution_api/remote", "context"] ] , "private-deps": - [ ["src/buildtool/execution_api/bazel_msg", "execution_config"] + [ ["src/buildtool/crypto", "hash_function"] + , ["src/buildtool/execution_api/bazel_msg", "execution_config"] , ["src/buildtool/execution_api/local", "local_api"] , ["src/buildtool/execution_api/remote", "bazel_api"] , ["src/buildtool/execution_api/remote", "config"] diff --git a/src/buildtool/execution_api/common/api_bundle.cpp b/src/buildtool/execution_api/common/api_bundle.cpp index 69b628bc..7ab06e81 100644 --- a/src/buildtool/execution_api/common/api_bundle.cpp +++ b/src/buildtool/execution_api/common/api_bundle.cpp @@ -17,6 +17,7 @@ #include <memory> #include <utility> +#include "src/buildtool/crypto/hash_function.hpp" #include "src/buildtool/execution_api/bazel_msg/execution_config.hpp" #include "src/buildtool/execution_api/local/local_api.hpp" #include "src/buildtool/execution_api/remote/bazel/bazel_api.hpp" @@ -29,23 +30,22 @@ auto ApiBundle::Create( gsl::not_null<LocalContext const*> const& local_context, gsl::not_null<RemoteContext const*> const& remote_context, RepositoryConfig const* repo_config) -> ApiBundle { - HashFunction const hash_fct = local_context->storage_config->hash_function; IExecutionApi::Ptr local_api = std::make_shared<LocalApi>(local_context, repo_config); IExecutionApi::Ptr remote_api = local_api; if (auto const address = remote_context->exec_config->remote_address) { ExecutionConfiguration config; config.skip_cache_lookup = false; - remote_api = std::make_shared<BazelApi>("remote-execution", - address->host, - address->port, - remote_context->auth, - remote_context->retry_config, - config, - hash_fct); + remote_api = std::make_shared<BazelApi>( + "remote-execution", + address->host, + address->port, + remote_context->auth, + remote_context->retry_config, + config, + local_context->storage_config->hash_function); } - return ApiBundle{.hash_function = hash_fct, - .local = std::move(local_api), + return ApiBundle{.local = std::move(local_api), .remote = std::move(remote_api)}; } @@ -63,7 +63,7 @@ auto ApiBundle::MakeRemote( authentication, retry_config, config, - hash_function); + HashFunction{local->GetHashType()}); } return local; } diff --git a/src/buildtool/execution_api/common/api_bundle.hpp b/src/buildtool/execution_api/common/api_bundle.hpp index a08e7bba..75627ac7 100644 --- a/src/buildtool/execution_api/common/api_bundle.hpp +++ b/src/buildtool/execution_api/common/api_bundle.hpp @@ -22,7 +22,6 @@ #include "src/buildtool/common/remote/remote_common.hpp" #include "src/buildtool/common/remote/retry_config.hpp" #include "src/buildtool/common/repository_config.hpp" -#include "src/buildtool/crypto/hash_function.hpp" #include "src/buildtool/execution_api/common/execution_api.hpp" #include "src/buildtool/execution_api/local/context.hpp" #include "src/buildtool/execution_api/remote/context.hpp" @@ -51,7 +50,6 @@ struct ApiBundle final { gsl::not_null<RetryConfig const*> const& retry_config) const -> gsl::not_null<IExecutionApi::Ptr>; - HashFunction const hash_function; gsl::not_null<IExecutionApi::Ptr> const local; gsl::not_null<IExecutionApi::Ptr> const remote; }; diff --git a/src/buildtool/execution_api/utils/subobject.cpp b/src/buildtool/execution_api/utils/subobject.cpp index 106e8859..f1b1b459 100644 --- a/src/buildtool/execution_api/utils/subobject.cpp +++ b/src/buildtool/execution_api/utils/subobject.cpp @@ -52,7 +52,7 @@ auto RetrieveSubPathId(Artifact::ObjectInfo object_info, sofar.string()); return std::nullopt; } - if (not ProtocolTraits::IsNative(apis.hash_function.GetType())) { + if (not ProtocolTraits::IsNative(apis.remote->GetHashType())) { auto directory = BazelMsgFactory::MessageFromString<bazel_re::Directory>(*data); if (not directory) { diff --git a/src/buildtool/execution_engine/executor/executor.hpp b/src/buildtool/execution_engine/executor/executor.hpp index 3926a330..6dd48516 100644 --- a/src/buildtool/execution_engine/executor/executor.hpp +++ b/src/buildtool/execution_engine/executor/executor.hpp @@ -84,7 +84,6 @@ class ExecutorImpl { IExecutionApi const& api, ExecutionProperties const& merged_properties, gsl::not_null<RemoteContext const*> const& remote_context, - HashFunction hash_function, std::chrono::milliseconds const& timeout, IExecutionAction::CacheFlag cache_flag, gsl::not_null<Statistics*> const& stats, @@ -134,7 +133,7 @@ class ExecutorImpl { // get the alternative endpoint auto alternative_api = GetAlternativeEndpoint( - merged_properties, remote_context, hash_function); + merged_properties, remote_context, api.GetHashType()); if (alternative_api) { if (not api.ParallelRetrieveToCas( std::vector<Artifact::ObjectInfo>{Artifact::ObjectInfo{ @@ -238,7 +237,6 @@ class ExecutorImpl { } if (not VerifyOrUploadKnownArtifact( - apis.hash_function.GetType(), *apis.remote, artifact->Content().Repository(), repo_config, @@ -266,11 +264,8 @@ class ExecutorImpl { return oss.str(); }); auto repo = artifact->Content().Repository(); - auto new_info = UploadFile(*apis.remote, - apis.hash_function, - repo, - repo_config, - *file_path_opt); + auto new_info = + UploadFile(*apis.remote, repo, repo_config, *file_path_opt); if (not new_info) { Logger::Log(LogLevel::Error, "artifact in {} could not be uploaded to CAS.", @@ -446,12 +441,11 @@ class ExecutorImpl { /// \param info The info of the object /// \returns true on success [[nodiscard]] static auto VerifyOrUploadKnownArtifact( - HashFunction::Type hash_type, IExecutionApi const& api, std::string const& repo, gsl::not_null<const RepositoryConfig*> const& repo_config, Artifact::ObjectInfo const& info) noexcept -> bool { - if (not ProtocolTraits::IsNative(hash_type)) { + if (not ProtocolTraits::IsNative(api.GetHashType())) { auto opt = GitHashesConverter::Instance().GetGitEntry(info.digest.hash()); if (opt) { @@ -473,7 +467,6 @@ class ExecutorImpl { /// \returns The computed object info on success [[nodiscard]] static auto UploadFile( IExecutionApi const& api, - HashFunction hash_function, std::string const& repo, gsl::not_null<const RepositoryConfig*> const& repo_config, std::filesystem::path const& file_path) noexcept @@ -490,6 +483,7 @@ class ExecutorImpl { if (not content.has_value()) { return std::nullopt; } + HashFunction const hash_function{api.GetHashType()}; auto digest = ArtifactDigestFactory::HashDataAs<ObjectType::File>( hash_function, *content); if (not api.Upload({ArtifactBlob{digest, @@ -752,7 +746,7 @@ class ExecutorImpl { [[nodiscard]] static auto GetAlternativeEndpoint( const ExecutionProperties& properties, const gsl::not_null<RemoteContext const*>& remote_context, - HashFunction hash_function) -> std::unique_ptr<BazelApi> { + HashFunction::Type hash_type) -> std::unique_ptr<BazelApi> { for (auto const& [pred, endpoint] : remote_context->exec_config->dispatch) { bool match = true; @@ -775,7 +769,7 @@ class ExecutorImpl { remote_context->auth, remote_context->retry_config, config, - hash_function); + HashFunction{hash_type}); } } return nullptr; @@ -818,7 +812,6 @@ class Executor { context_.remote_context->exec_config->platform_properties, action->ExecutionProperties()), context_.remote_context, - context_.apis->hash_function, Impl::ScaleTime(timeout_, action->TimeoutScale()), action->NoCache() ? CF::DoNotCacheOutput : CF::CacheOutput, context_.statistics, @@ -841,7 +834,6 @@ class Executor { context_.remote_context->exec_config->platform_properties, action->ExecutionProperties()), context_.remote_context, - context_.apis->hash_function, Impl::ScaleTime(timeout_, action->TimeoutScale()), action->NoCache() ? CF::DoNotCacheOutput : CF::CacheOutput, context_.statistics, @@ -915,7 +907,6 @@ class Rebuilder { context_.remote_context->exec_config->platform_properties, action->ExecutionProperties()), context_.remote_context, - context_.apis->hash_function, Impl::ScaleTime(timeout_, action->TimeoutScale()), CF::PretendCached, context_.statistics, @@ -934,7 +925,6 @@ class Rebuilder { context_.remote_context->exec_config->platform_properties, action->ExecutionProperties()), context_.remote_context, - context_.apis->hash_function, Impl::ScaleTime(timeout_, action->TimeoutScale()), CF::FromCacheOnly, context_.statistics, diff --git a/src/buildtool/graph_traverser/graph_traverser.hpp b/src/buildtool/graph_traverser/graph_traverser.hpp index 1f6759a8..d385473c 100644 --- a/src/buildtool/graph_traverser/graph_traverser.hpp +++ b/src/buildtool/graph_traverser/graph_traverser.hpp @@ -214,7 +214,7 @@ class GraphTraverser { auto const [blobs, tree_descs, actions] = *desc; HashFunction::Type const hash_type = - context_.apis->hash_function.GetType(); + context_.apis->local->GetHashType(); std::vector<ActionDescription::Ptr> action_descriptions{}; action_descriptions.reserve(actions.size()); for (auto const& [id, description] : actions.items()) { @@ -312,9 +312,10 @@ class GraphTraverser { [[nodiscard]] auto UploadBlobs( std::vector<std::string> const& blobs) const noexcept -> bool { std::unordered_set<ArtifactBlob> container; + HashFunction const hash_function{context_.apis->remote->GetHashType()}; for (auto const& blob : blobs) { auto digest = ArtifactDigestFactory::HashDataAs<ObjectType::File>( - context_.apis->hash_function, blob); + hash_function, blob); Logger::Log(logger_, LogLevel::Trace, [&]() { return fmt::format( "Will upload blob {}, its digest has id {} and size {}.", diff --git a/src/buildtool/main/TARGETS b/src/buildtool/main/TARGETS index 5662580c..44440484 100644 --- a/src/buildtool/main/TARGETS +++ b/src/buildtool/main/TARGETS @@ -369,7 +369,6 @@ [ ["@", "fmt", "", "fmt"] , ["src/buildtool/build_engine/expression", "expression"] , ["src/buildtool/build_engine/expression", "expression_ptr_interface"] - , ["src/buildtool/crypto", "hash_function"] , ["src/buildtool/execution_api/common", "common"] , ["src/buildtool/multithreading", "async_map_utils"] , ["src/buildtool/multithreading", "task_system"] @@ -382,7 +381,6 @@ , "srcs": ["archive.cpp"] , "deps": [ ["src/buildtool/common", "common"] - , ["src/buildtool/crypto", "hash_function"] , ["src/buildtool/execution_api/common", "common"] ] , "stage": ["src", "buildtool", "main"] diff --git a/src/buildtool/main/archive.cpp b/src/buildtool/main/archive.cpp index 2d8c95db..017aaaeb 100644 --- a/src/buildtool/main/archive.cpp +++ b/src/buildtool/main/archive.cpp @@ -59,8 +59,7 @@ void archive_entry_cleanup(archive_entry* entry) { } } -auto add_to_archive(HashFunction::Type hash_type, - archive* archive, +auto add_to_archive(archive* archive, IExecutionApi const& api, const Artifact::ObjectInfo& artifact, const std::filesystem::path& location) -> bool { @@ -134,8 +133,11 @@ auto add_to_archive(HashFunction::Type hash_type, for (auto const& [hash, entries] : *git_tree) { auto hex_hash = ToHexString(hash); for (auto const& entry : entries) { - auto digest = ArtifactDigestFactory::Create( - hash_type, hex_hash, 0, IsTreeObject(entry.type)); + auto digest = + ArtifactDigestFactory::Create(api.GetHashType(), + hex_hash, + 0, + IsTreeObject(entry.type)); if (not digest) { return false; } @@ -146,8 +148,7 @@ auto add_to_archive(HashFunction::Type hash_type, } } for (auto const& [name, obj] : tree) { - if (not add_to_archive( - hash_type, archive, api, obj, location / name)) { + if (not add_to_archive(archive, api, obj, location / name)) { return false; } } @@ -160,7 +161,6 @@ auto add_to_archive(HashFunction::Type hash_type, } // namespace [[nodiscard]] auto GenerateArchive( - HashFunction::Type hash_type, IExecutionApi const& api, const Artifact::ObjectInfo& artifact, const std::optional<std::filesystem::path>& output_path) -> bool { @@ -204,11 +204,8 @@ auto add_to_archive(HashFunction::Type hash_type, } } - if (not add_to_archive(hash_type, - archive.get(), - api, - artifact, - std::filesystem::path{""})) { + if (not add_to_archive( + archive.get(), api, artifact, std::filesystem::path{""})) { return false; } if (output_path) { diff --git a/src/buildtool/main/archive.hpp b/src/buildtool/main/archive.hpp index da61a5c3..ff23c65e 100644 --- a/src/buildtool/main/archive.hpp +++ b/src/buildtool/main/archive.hpp @@ -21,11 +21,9 @@ #include <optional> #include "src/buildtool/common/artifact.hpp" -#include "src/buildtool/crypto/hash_function.hpp" #include "src/buildtool/execution_api/common/execution_api.hpp" [[nodiscard]] auto GenerateArchive( - HashFunction::Type hash_type, IExecutionApi const& api, const Artifact::ObjectInfo& artifact, const std::optional<std::filesystem::path>& output_path) -> bool; diff --git a/src/buildtool/main/build_utils.cpp b/src/buildtool/main/build_utils.cpp index e7787af3..3b919ade 100644 --- a/src/buildtool/main/build_utils.cpp +++ b/src/buildtool/main/build_utils.cpp @@ -22,7 +22,6 @@ #include "src/buildtool/build_engine/expression/expression.hpp" #include "src/buildtool/build_engine/expression/expression_ptr.hpp" #ifndef BOOTSTRAP_BUILD_TOOL -#include "src/buildtool/crypto/hash_function.hpp" #include "src/buildtool/execution_api/common/execution_api.hpp" #include "src/buildtool/logging/log_level.hpp" #include "src/buildtool/multithreading/async_map_utils.hpp" @@ -106,7 +105,7 @@ auto CreateTargetCacheWriterMap( } auto const& target = cache_targets.at(tc_key); auto entry = TargetCacheEntry::FromTarget( - apis->hash_function.GetType(), target, extra_infos); + apis->remote->GetHashType(), target, extra_infos); if (not entry) { (*logger)( fmt::format("Failed creating target cache entry for key {}", diff --git a/src/buildtool/main/install_cas.cpp b/src/buildtool/main/install_cas.cpp index 8f7f9d65..782a0422 100644 --- a/src/buildtool/main/install_cas.cpp +++ b/src/buildtool/main/install_cas.cpp @@ -105,7 +105,7 @@ auto FetchAndInstallArtifacts(ApiBundle const& apis, FetchArguments const& clargs, RemoteContext const& remote_context) -> bool { auto object_info = ObjectInfoFromLiberalString( - apis.hash_function.GetType(), + apis.remote->GetHashType(), clargs.object_id, remote_context.exec_config->remote_address.has_value()); if (not object_info) { @@ -156,8 +156,7 @@ auto FetchAndInstallArtifacts(ApiBundle const& apis, object_info->ToString()); return false; } - return GenerateArchive( - apis.hash_function.GetType(), *apis.remote, *object_info, out); + return GenerateArchive(*apis.remote, *object_info, out); } if (out) { diff --git a/src/buildtool/serve_api/serve_service/serve_server_implementation.cpp b/src/buildtool/serve_api/serve_service/serve_server_implementation.cpp index f9823538..f6405651 100644 --- a/src/buildtool/serve_api/serve_service/serve_server_implementation.cpp +++ b/src/buildtool/serve_api/serve_service/serve_server_implementation.cpp @@ -176,9 +176,8 @@ auto ServeServerImpl::Run( is_compat ? &*local_context : nullptr, is_compat ? &*apis.local : nullptr); // setup the apis to pass to SourceTreeService - auto const mr_apis = ApiBundle{.hash_function = apis.hash_function, - .local = mr_local_api, - .remote = apis.remote}; + auto const mr_apis = + ApiBundle{.local = mr_local_api, .remote = apis.remote}; SourceTreeService sts{ &serve_config, diff --git a/src/buildtool/serve_api/serve_service/source_tree.cpp b/src/buildtool/serve_api/serve_service/source_tree.cpp index f78c4f2c..0108d8d7 100644 --- a/src/buildtool/serve_api/serve_service/source_tree.cpp +++ b/src/buildtool/serve_api/serve_service/source_tree.cpp @@ -418,7 +418,7 @@ auto SourceTreeService::SetDigestInResponse( return TResponse::INTERNAL_ERROR; } // in native mode, set the native digest in response - if (ProtocolTraits::IsNative(apis_.hash_function.GetType())) { + if (ProtocolTraits::IsNative(apis_.remote->GetHashType())) { *(response->mutable_digest()) = ArtifactDigestFactory::ToBazel(*std::move(native_digest)); } @@ -1016,7 +1016,7 @@ auto SourceTreeService::ServeDistdirTree( content_list.reserve(request->distfiles().size()); bool const is_native = - ProtocolTraits::IsNative(apis_.hash_function.GetType()); + ProtocolTraits::IsNative(apis_.remote->GetHashType()); for (auto const& kv : request->distfiles()) { bool blob_found{}; std::string blob_digest; // The digest of the requested distfile, taken @@ -1619,7 +1619,7 @@ auto SourceTreeService::GetRemoteTree( // get tree from remote CAS into tmp dir auto const remote_digest = ArtifactDigestFactory::FromBazel( - apis_.hash_function.GetType(), request->digest()); + apis_.remote->GetHashType(), request->digest()); if (not remote_digest or not apis_.remote->IsAvailable(*remote_digest)) { logger_->Emit(LogLevel::Error, "Remote CAS does not contain expected tree {}", diff --git a/src/buildtool/serve_api/serve_service/target.cpp b/src/buildtool/serve_api/serve_service/target.cpp index 4ce3491d..2bd91079 100644 --- a/src/buildtool/serve_api/serve_service/target.cpp +++ b/src/buildtool/serve_api/serve_service/target.cpp @@ -379,7 +379,7 @@ auto TargetService::ServeTarget( return ::grpc::Status{::grpc::StatusCode::NOT_FOUND, msg}; } auto const repo_key_dgst = - ArtifactDigestFactory::Create(apis_.hash_function.GetType(), + ArtifactDigestFactory::Create(apis_.local->GetHashType(), repo_key->String(), 0, /*is_tree=*/false); diff --git a/src/other_tools/just_mr/fetch.cpp b/src/other_tools/just_mr/fetch.cpp index 03813b13..7fafada8 100644 --- a/src/other_tools/just_mr/fetch.cpp +++ b/src/other_tools/just_mr/fetch.cpp @@ -411,12 +411,13 @@ auto MultiRepoFetch(std::shared_ptr<Configuration> const& config, } // create the remote api - auto const hash_fct = - compat_local_context != nullptr - ? compat_local_context->storage_config->hash_function - : native_local_context.storage_config->hash_function; IExecutionApi::Ptr remote_api = nullptr; if (auto const address = remote_exec_config->remote_address) { + auto const hash_fct = + compat_local_context != nullptr + ? compat_local_context->storage_config->hash_function + : native_local_context.storage_config->hash_function; + ExecutionConfiguration config; config.skip_cache_lookup = false; remote_api = std::make_shared<BazelApi>("remote-execution", @@ -441,8 +442,7 @@ auto MultiRepoFetch(std::shared_ptr<Configuration> const& config, return kExitConfigError; } auto const apis = - ApiBundle{.hash_function = hash_fct, - .local = mr_local_api, + ApiBundle{.local = mr_local_api, .remote = has_remote_api ? remote_api : mr_local_api}; auto serve = ServeApi::Create( *serve_config, diff --git a/src/other_tools/just_mr/setup.cpp b/src/other_tools/just_mr/setup.cpp index 427c3288..b4b31f71 100644 --- a/src/other_tools/just_mr/setup.cpp +++ b/src/other_tools/just_mr/setup.cpp @@ -219,12 +219,13 @@ auto MultiRepoSetup(std::shared_ptr<Configuration> const& config, } // create the remote api - auto const hash_fct = - compat_local_context != nullptr - ? compat_local_context->storage_config->hash_function - : native_local_context.storage_config->hash_function; IExecutionApi::Ptr remote_api = nullptr; if (auto const address = remote_exec_config->remote_address) { + auto const hash_fct = + compat_local_context != nullptr + ? compat_local_context->storage_config->hash_function + : native_local_context.storage_config->hash_function; + ExecutionConfiguration config; config.skip_cache_lookup = false; remote_api = std::make_shared<BazelApi>("remote-execution", @@ -249,8 +250,7 @@ auto MultiRepoSetup(std::shared_ptr<Configuration> const& config, return std::nullopt; } auto const apis = - ApiBundle{.hash_function = hash_fct, - .local = mr_local_api, + ApiBundle{.local = mr_local_api, .remote = has_remote_api ? remote_api : mr_local_api}; auto serve = ServeApi::Create( *serve_config, |