summaryrefslogtreecommitdiff
path: root/src/buildtool/graph_traverser/graph_traverser.hpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-11-24 11:31:42 +0100
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-11-27 15:03:20 +0100
commitcf04253130030bc28866d10aa1f8fe1353643d42 (patch)
treeef7049624771866455105a8dab7b001840139701 /src/buildtool/graph_traverser/graph_traverser.hpp
parentbc09302c2772c979c45ecc716c36e4a70bb484ac (diff)
downloadjustbuild-cf04253130030bc28866d10aa1f8fe1353643d42.tar.gz
Refactoring RepositoryConfig
With the introduction of 'just serve', export targets can now be built also independently from one another based on their corresponding minimal repository configuration, as stored in the target cache key. In this context, this commit changes the RepositoryConfig usage from one global (static) instance to pointers passed as necessary throughout the code.
Diffstat (limited to 'src/buildtool/graph_traverser/graph_traverser.hpp')
-rw-r--r--src/buildtool/graph_traverser/graph_traverser.hpp30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/buildtool/graph_traverser/graph_traverser.hpp b/src/buildtool/graph_traverser/graph_traverser.hpp
index 5eec6bd8..82e9f17a 100644
--- a/src/buildtool/graph_traverser/graph_traverser.hpp
+++ b/src/buildtool/graph_traverser/graph_traverser.hpp
@@ -31,6 +31,7 @@
#include "gsl/gsl"
#include "src/buildtool/common/cli.hpp"
#include "src/buildtool/common/remote/remote_common.hpp"
+#include "src/buildtool/common/repository_config.hpp"
#include "src/buildtool/common/statistics.hpp"
#include "src/buildtool/common/tree.hpp"
#include "src/buildtool/execution_api/bazel_msg/bazel_blob_container.hpp"
@@ -68,19 +69,23 @@ class GraphTraverser {
bool failed_artifacts;
};
- explicit GraphTraverser(CommandLineArguments clargs)
+ explicit GraphTraverser(CommandLineArguments clargs,
+ gsl::not_null<RepositoryConfig*> const& repo_config)
: clargs_{std::move(clargs)},
- local_api_{CreateExecutionApi(std::nullopt)},
- remote_api_{
- CreateExecutionApi(RemoteExecutionConfig::RemoteAddress())},
+ repo_config_{repo_config},
+ local_api_{CreateExecutionApi(std::nullopt, repo_config)},
+ remote_api_{CreateExecutionApi(RemoteExecutionConfig::RemoteAddress(),
+ repo_config)},
reporter_{[](auto done, auto cv) {}} {}
explicit GraphTraverser(CommandLineArguments clargs,
+ gsl::not_null<RepositoryConfig*> const& repo_config,
progress_reporter_t reporter)
: clargs_{std::move(clargs)},
- local_api_{CreateExecutionApi(std::nullopt)},
- remote_api_{
- CreateExecutionApi(RemoteExecutionConfig::RemoteAddress())},
+ repo_config_{repo_config},
+ local_api_{CreateExecutionApi(std::nullopt, repo_config)},
+ remote_api_{CreateExecutionApi(RemoteExecutionConfig::RemoteAddress(),
+ repo_config)},
reporter_{std::move(reporter)} {}
/// \brief Parses actions and blobs into graph, traverses it and retrieves
@@ -222,6 +227,7 @@ class GraphTraverser {
private:
CommandLineArguments const clargs_;
+ gsl::not_null<RepositoryConfig*> repo_config_;
gsl::not_null<IExecutionApi::Ptr> const local_api_;
gsl::not_null<IExecutionApi::Ptr> const remote_api_;
progress_reporter_t reporter_;
@@ -339,7 +345,8 @@ class GraphTraverser {
[[nodiscard]] auto Traverse(
DependencyGraph const& g,
std::vector<ArtifactIdentifier> const& artifact_ids) const -> bool {
- Executor executor{&(*local_api_),
+ Executor executor{repo_config_,
+ &(*local_api_),
&(*remote_api_),
RemoteExecutionConfig::PlatformProperties(),
clargs_.build.timeout};
@@ -364,9 +371,10 @@ class GraphTraverser {
DependencyGraph const& g,
std::vector<ArtifactIdentifier> const& artifact_ids) const -> bool {
// setup rebuilder with api for cache endpoint
- auto api_cached =
- CreateExecutionApi(RemoteExecutionConfig::CacheAddress());
- Rebuilder executor{&(*local_api_),
+ auto api_cached = CreateExecutionApi(
+ RemoteExecutionConfig::CacheAddress(), repo_config_);
+ Rebuilder executor{repo_config_,
+ &(*local_api_),
&(*remote_api_),
&(*api_cached),
RemoteExecutionConfig::PlatformProperties(),