summaryrefslogtreecommitdiff
path: root/test/buildtool/build_engine/base_maps/expression_map.test.cpp
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 /test/buildtool/build_engine/base_maps/expression_map.test.cpp
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 'test/buildtool/build_engine/base_maps/expression_map.test.cpp')
-rw-r--r--test/buildtool/build_engine/base_maps/expression_map.test.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/test/buildtool/build_engine/base_maps/expression_map.test.cpp b/test/buildtool/build_engine/base_maps/expression_map.test.cpp
index 89b73d33..392d81ba 100644
--- a/test/buildtool/build_engine/base_maps/expression_map.test.cpp
+++ b/test/buildtool/build_engine/base_maps/expression_map.test.cpp
@@ -14,6 +14,7 @@
#include <filesystem>
#include <functional>
+#include <memory>
#include "catch2/catch_test_macros.hpp"
#include "src/buildtool/build_engine/base_maps/expression_map.hpp"
@@ -26,7 +27,7 @@ namespace {
using namespace BuildMaps::Base; // NOLINT
-void SetupConfig(bool use_git) {
+auto SetupConfig(bool use_git) -> RepositoryConfig {
auto root = FileRoot{kBasePath / "data_expr"};
if (use_git) {
auto repo_path = CreateTestRepo();
@@ -35,17 +36,17 @@ void SetupConfig(bool use_git) {
REQUIRE(git_root);
root = std::move(*git_root);
}
- RepositoryConfig::Instance().Reset();
- RepositoryConfig::Instance().SetInfo(
- "", RepositoryConfig::RepositoryInfo{root});
+ RepositoryConfig repo_config{};
+ repo_config.SetInfo("", RepositoryConfig::RepositoryInfo{root});
+ return repo_config;
}
auto ReadExpressionFunction(EntityName const& id,
ExpressionFunctionMap::Consumer value_checker,
bool use_git = false) -> bool {
- SetupConfig(use_git);
- auto expr_file_map = CreateExpressionFileMap(0);
- auto expr_func_map = CreateExpressionMap(&expr_file_map);
+ auto repo_config = SetupConfig(use_git);
+ auto expr_file_map = CreateExpressionFileMap(&repo_config, 0);
+ auto expr_func_map = CreateExpressionMap(&expr_file_map, &repo_config);
bool success{true};
{