summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-05-26 15:06:49 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-06-06 09:55:17 +0200
commit3f41feb6e022a30cfce39ec40c7ffda46d75193d (patch)
tree24f8f8d5047582bd936b17d96e3f7b4b14020c79
parente4214ea95874bdd5bc059d0892f90c09df7b664d (diff)
downloadjustbuild-3f41feb6e022a30cfce39ec40c7ffda46d75193d.tar.gz
style: Use designated initializers
This feature has been introduced with C++20.
-rw-r--r--src/buildtool/build_engine/base_maps/rule_map.cpp12
-rw-r--r--src/buildtool/build_engine/base_maps/source_map.cpp4
-rw-r--r--src/buildtool/build_engine/expression/target_result.cpp15
-rw-r--r--src/buildtool/build_engine/target_map/built_in_rules.cpp15
-rw-r--r--src/buildtool/build_engine/target_map/export.cpp16
-rw-r--r--src/buildtool/build_engine/target_map/result_map.hpp35
-rw-r--r--src/buildtool/build_engine/target_map/target_map.cpp84
-rw-r--r--src/buildtool/build_engine/target_map/utils.cpp4
-rw-r--r--src/buildtool/common/artifact.hpp22
-rw-r--r--src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp24
-rw-r--r--src/buildtool/execution_api/git/git_api.hpp18
-rw-r--r--src/buildtool/execution_api/local/local_response.hpp13
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp5
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_response.cpp19
-rw-r--r--src/buildtool/execution_engine/executor/executor.hpp3
-rw-r--r--src/buildtool/file_system/git_repo.cpp4
-rw-r--r--src/buildtool/graph_traverser/graph_traverser.hpp11
-rw-r--r--src/buildtool/main/analyse.cpp6
-rw-r--r--src/buildtool/main/install_cas.cpp3
-rw-r--r--src/buildtool/main/main.cpp9
-rw-r--r--src/buildtool/storage/target_cache_entry.cpp5
-rw-r--r--src/buildtool/system/system_command.hpp6
-rw-r--r--src/other_tools/git_operations/git_operations.cpp28
-rw-r--r--src/other_tools/git_operations/git_repo_remote.cpp3
-rw-r--r--src/other_tools/just_mr/main.cpp42
-rw-r--r--src/other_tools/just_mr/utils.hpp31
-rw-r--r--src/other_tools/ops_maps/import_to_git_map.cpp52
-rw-r--r--src/other_tools/repo_map/repos_to_setup_map.cpp106
-rw-r--r--src/other_tools/root_maps/commit_git_map.cpp34
-rw-r--r--src/other_tools/root_maps/content_git_map.cpp17
-rw-r--r--src/other_tools/root_maps/distdir_git_map.cpp17
-rw-r--r--src/other_tools/root_maps/fpath_git_map.cpp13
-rw-r--r--src/other_tools/root_maps/tree_id_git_map.cpp50
-rw-r--r--test/buildtool/build_engine/target_map/target_map.test.cpp194
-rw-r--r--test/buildtool/execution_engine/executor/executor.test.cpp4
-rw-r--r--test/other_tools/git_operations/critical_git_ops.test.cpp77
36 files changed, 545 insertions, 456 deletions
diff --git a/src/buildtool/build_engine/base_maps/rule_map.cpp b/src/buildtool/build_engine/base_maps/rule_map.cpp
index 2b05c11d..c8a3dc22 100644
--- a/src/buildtool/build_engine/base_maps/rule_map.cpp
+++ b/src/buildtool/build_engine/base_maps/rule_map.cpp
@@ -138,12 +138,12 @@ auto const kRuleFields = std::unordered_set<std::string>{"anonymous",
rule_mapping.emplace(key, ExpressionPtr{std::move(*rule_name)});
}
- anon_defs.emplace(
- name,
- UserRule::AnonymousDefinition{
- target->get<std::string>(),
- provider->get<std::string>(),
- ExpressionPtr{Expression::map_t{std::move(rule_mapping)}}});
+ anon_defs.emplace(name,
+ UserRule::AnonymousDefinition{
+ .target = target->get<std::string>(),
+ .provider = provider->get<std::string>(),
+ .rule_map = ExpressionPtr{
+ Expression::map_t{std::move(rule_mapping)}}});
}
return anon_defs;
}
diff --git a/src/buildtool/build_engine/base_maps/source_map.cpp b/src/buildtool/build_engine/base_maps/source_map.cpp
index 8baf81c2..b2fa238b 100644
--- a/src/buildtool/build_engine/base_maps/source_map.cpp
+++ b/src/buildtool/build_engine/base_maps/source_map.cpp
@@ -31,7 +31,9 @@ auto as_target(const BuildMaps::Base::EntityName& key, ExpressionPtr artifact)
auto stage = ExpressionPtr{
Expression::map_t{key.GetNamedTarget().name, std::move(artifact)}};
return std::make_shared<AnalysedTarget const>(
- TargetResult{stage, Expression::kEmptyMap, stage},
+ TargetResult{.artifact_stage = stage,
+ .provides = Expression::kEmptyMap,
+ .runfiles = stage},
std::vector<ActionDescription::Ptr>{},
std::vector<std::string>{},
std::vector<Tree::Ptr>{},
diff --git a/src/buildtool/build_engine/expression/target_result.cpp b/src/buildtool/build_engine/expression/target_result.cpp
index 8bd3cbaa..2ec31a55 100644
--- a/src/buildtool/build_engine/expression/target_result.cpp
+++ b/src/buildtool/build_engine/expression/target_result.cpp
@@ -218,8 +218,10 @@ auto SerializeTargetResultWithReplacement(
provided_nodes,
provided_results,
sofar);
- auto result = ExpressionPtr{TargetNode{TargetNode::Abstract{
- node_type, string_fields, target_fields}}};
+ auto result = ExpressionPtr{TargetNode{
+ TargetNode::Abstract{.node_type = node_type,
+ .string_fields = string_fields,
+ .target_fields = target_fields}}};
sofar->emplace(id, result);
return result;
}
@@ -256,10 +258,11 @@ auto SerializeTargetResultWithReplacement(
provided_results,
sofar);
if (artifact_stage and runfiles and provides) {
- return ExpressionPtr{TargetResult{std::move(artifact_stage),
- std::move(provides),
- std::move(runfiles),
- /*is_cacheable=*/true}};
+ return ExpressionPtr{
+ TargetResult{.artifact_stage = std::move(artifact_stage),
+ .provides = std::move(provides),
+ .runfiles = std::move(runfiles),
+ .is_cacheable = true}};
}
return ExpressionPtr{nullptr};
}
diff --git a/src/buildtool/build_engine/target_map/built_in_rules.cpp b/src/buildtool/build_engine/target_map/built_in_rules.cpp
index 5db35b41..ad9a12b5 100644
--- a/src/buildtool/build_engine/target_map/built_in_rules.cpp
+++ b/src/buildtool/build_engine/target_map/built_in_rules.cpp
@@ -199,7 +199,9 @@ void FileGenRuleWithDeps(
ObjectType::File}}}};
auto analysis_result = std::make_shared<AnalysedTarget const>(
- TargetResult{stage, ExpressionPtr{Expression::map_t{}}, stage},
+ TargetResult{.artifact_stage = stage,
+ .provides = ExpressionPtr{Expression::map_t{}},
+ .runfiles = stage},
std::vector<ActionDescription::Ptr>{},
std::vector<std::string>{data_val->String()},
std::vector<Tree::Ptr>{},
@@ -372,7 +374,9 @@ void TreeRuleWithDeps(
auto result = ExpressionPtr{Expression::map_t{result_stage}};
auto analysis_result = std::make_shared<AnalysedTarget const>(
- TargetResult{result, ExpressionPtr{Expression::map_t{}}, result},
+ TargetResult{.artifact_stage = result,
+ .provides = ExpressionPtr{Expression::map_t{}},
+ .runfiles = result},
std::vector<ActionDescription::Ptr>{},
std::vector<std::string>{},
std::move(trees),
@@ -604,7 +608,8 @@ void InstallRuleWithDeps(
auto const& empty_map = Expression::kEmptyMap;
auto result = std::make_shared<AnalysedTarget const>(
- TargetResult{stage, empty_map, stage},
+ TargetResult{
+ .artifact_stage = stage, .provides = empty_map, .runfiles = stage},
std::vector<ActionDescription::Ptr>{},
std::vector<std::string>{},
std::vector<Tree::Ptr>{},
@@ -1060,7 +1065,9 @@ void GenericRuleWithDeps(
auto const& empty_map = Expression::kEmptyMap;
auto result = std::make_shared<AnalysedTarget const>(
TargetResult{
- ExpressionPtr{Expression::map_t{artifacts}}, empty_map, empty_map},
+ .artifact_stage = ExpressionPtr{Expression::map_t{artifacts}},
+ .provides = empty_map,
+ .runfiles = empty_map},
std::vector<ActionDescription::Ptr>{action},
std::vector<std::string>{},
std::vector<Tree::Ptr>{},
diff --git a/src/buildtool/build_engine/target_map/export.cpp b/src/buildtool/build_engine/target_map/export.cpp
index 187a192d..0ba82d23 100644
--- a/src/buildtool/build_engine/target_map/export.cpp
+++ b/src/buildtool/build_engine/target_map/export.cpp
@@ -53,7 +53,8 @@ void FinalizeExport(
}
auto deps_info = TargetGraphInformation{
std::make_shared<BuildMaps::Target::ConfiguredTarget>(
- BuildMaps::Target::ConfiguredTarget{target, effective_config}),
+ BuildMaps::Target::ConfiguredTarget{.target = target,
+ .config = effective_config}),
{(*value)->GraphInformation().Node()},
{},
{}};
@@ -61,7 +62,9 @@ void FinalizeExport(
std::unordered_set<std::string> vars_set{};
vars_set.insert(vars.begin(), vars.end());
auto analysis_result = std::make_shared<AnalysedTarget const>(
- TargetResult{(*value)->Artifacts(), provides, (*value)->RunFiles()},
+ TargetResult{.artifact_stage = (*value)->Artifacts(),
+ .provides = provides,
+ .runfiles = (*value)->RunFiles()},
std::vector<ActionDescription::Ptr>{},
std::vector<std::string>{},
std::vector<Tree::Ptr>{},
@@ -148,8 +151,8 @@ void ExportRule(
if (auto result = entry.ToResult()) {
auto deps_info = TargetGraphInformation{
std::make_shared<BuildMaps::Target::ConfiguredTarget>(
- BuildMaps::Target::ConfiguredTarget{key.target,
- effective_config}),
+ BuildMaps::Target::ConfiguredTarget{
+ .target = key.target, .config = effective_config}),
{},
{},
{}};
@@ -200,8 +203,9 @@ void ExportRule(
}
(*subcaller)(
- {BuildMaps::Target::ConfiguredTarget{std::move(*exported_target),
- std::move(target_config)}},
+ {BuildMaps::Target::ConfiguredTarget{
+ .target = std::move(*exported_target),
+ .config = std::move(target_config)}},
[setter,
logger,
vars = std::move(*flexible_vars),
diff --git a/src/buildtool/build_engine/target_map/result_map.hpp b/src/buildtool/build_engine/target_map/result_map.hpp
index f8b66958..6911bf02 100644
--- a/src/buildtool/build_engine/target_map/result_map.hpp
+++ b/src/buildtool/build_engine/target_map/result_map.hpp
@@ -73,8 +73,10 @@ class ResultTargetMap {
bool is_export_target = false) -> AnalysedTargetPtr {
auto part = std::hash<BuildMaps::Base::EntityName>{}(name) % width_;
std::unique_lock lock{m_[part]};
- auto [entry, inserted] = targets_[part].emplace(
- ConfiguredTarget{std::move(name), std::move(conf)}, result);
+ auto [entry, inserted] =
+ targets_[part].emplace(ConfiguredTarget{.target = std::move(name),
+ .config = std::move(conf)},
+ result);
if (target_cache_key) {
cache_targets_[part].emplace(*target_cache_key, entry->second);
}
@@ -227,20 +229,21 @@ class ResultTargetMap {
std::for_each(target.begin(), target.end(), [&](auto const& el) {
auto const& actions = el.second->Actions();
if constexpr (kIncludeOrigins) {
- std::for_each(actions.begin(),
- actions.end(),
- [&result, &origin_map](auto const& action) {
- auto origins = nlohmann::json::array();
- for (auto const& [ct, count] :
- origin_map[action->Id()]) {
- origins.push_back(nlohmann::json{
- {"target", ct.target.ToJson()},
- {"subtask", count},
- {"config", ct.config.ToJson()}});
- }
- result.actions.emplace_back(
- ActionWithOrigin{action, origins});
- });
+ std::for_each(
+ actions.begin(),
+ actions.end(),
+ [&result, &origin_map](auto const& action) {
+ auto origins = nlohmann::json::array();
+ for (auto const& [ct, count] :
+ origin_map[action->Id()]) {
+ origins.push_back(nlohmann::json{
+ {"target", ct.target.ToJson()},
+ {"subtask", count},
+ {"config", ct.config.ToJson()}});
+ }
+ result.actions.emplace_back(ActionWithOrigin{
+ .desc = action, .origin = origins});
+ });
}
else {
std::for_each(actions.begin(),
diff --git a/src/buildtool/build_engine/target_map/target_map.cpp b/src/buildtool/build_engine/target_map/target_map.cpp
index c61e3670..d5e0c05b 100644
--- a/src/buildtool/build_engine/target_map/target_map.cpp
+++ b/src/buildtool/build_engine/target_map/target_map.cpp
@@ -199,7 +199,8 @@ struct TargetData {
targets.reserve(nodes.size());
for (auto const& node_expr : nodes) {
targets.emplace_back(ExpressionPtr{BuildMaps::Base::EntityName{
- BuildMaps::Base::AnonymousTarget{rule_map, node_expr}}});
+ BuildMaps::Base::AnonymousTarget{
+ .rule_map = rule_map, .target_node = node_expr}}});
}
target_exprs.emplace(field_name, targets);
}
@@ -268,7 +269,8 @@ void withDependencies(
declared_and_implicit_count, dependency_values.size(), &anonymous_deps);
auto deps_info = TargetGraphInformation{
std::make_shared<BuildMaps::Target::ConfiguredTarget>(
- BuildMaps::Target::ConfiguredTarget{key.target, effective_conf}),
+ BuildMaps::Target::ConfiguredTarget{.target = key.target,
+ .config = effective_conf}),
declared_deps,
implicit_deps,
anonymous_deps};
@@ -713,10 +715,10 @@ void withDependencies(
check_entries(
target_fields, is_node, "target_fields", "target node");
- return ExpressionPtr{
- TargetNode{TargetNode::Abstract{type->String(),
- std::move(string_fields),
- std::move(target_fields)}}};
+ return ExpressionPtr{TargetNode{TargetNode::Abstract{
+ .node_type = type->String(),
+ .string_fields = std::move(string_fields),
+ .target_fields = std::move(target_fields)}}};
}},
{"RESULT", [](auto&& eval, auto const& expr, auto const& env) {
auto const& empty_map_exp = Expression::kEmptyMapExpr;
@@ -785,7 +787,9 @@ void withDependencies(
fmt::format("provides has to be a map, but found {}",
provides->ToString())};
}
- return ExpressionPtr{TargetResult{artifacts, provides, runfiles}};
+ return ExpressionPtr{TargetResult{.artifact_stage = artifacts,
+ .provides = provides,
+ .runfiles = runfiles}};
}}});
auto result = rule->Expression()->Evaluate(
@@ -1035,11 +1039,12 @@ void withRuleDefinition(
}
dependency_keys.emplace_back(
- BuildMaps::Target::ConfiguredTarget{dep->Name(),
- transitioned_config});
+ BuildMaps::Target::ConfiguredTarget{
+ .target = dep->Name(), .config = transitioned_config});
transition_keys.emplace_back(
BuildMaps::Target::ConfiguredTarget{
- dep->Name(), Configuration{transition}});
+ .target = dep->Name(),
+ .config = Configuration{transition}});
}
}
params.emplace(target_field_name,
@@ -1058,11 +1063,11 @@ void withRuleDefinition(
}
dependency_keys.emplace_back(
- BuildMaps::Target::ConfiguredTarget{dep,
- transitioned_config});
+ BuildMaps::Target::ConfiguredTarget{
+ .target = dep, .config = transitioned_config});
transition_keys.emplace_back(
BuildMaps::Target::ConfiguredTarget{
- dep, Configuration{transition}});
+ .target = dep, .config = Configuration{transition}});
}
}
}
@@ -1128,8 +1133,9 @@ void withRuleDefinition(
return;
}
anon_names.emplace_back(BuildMaps::Base::EntityName{
- BuildMaps::Base::AnonymousTarget{def.rule_map,
- node}});
+ BuildMaps::Base::AnonymousTarget{
+ .rule_map = def.rule_map,
+ .target_node = node}});
}
}
@@ -1139,11 +1145,13 @@ void withRuleDefinition(
for (auto const& anon : anon_names) {
anonymous_keys.emplace_back(
BuildMaps::Target::ConfiguredTarget{
- anon->Name(), transitioned_config});
+ .target = anon->Name(),
+ .config = transitioned_config});
transition_keys.emplace_back(
BuildMaps::Target::ConfiguredTarget{
- anon->Name(), Configuration{transition}});
+ .target = anon->Name(),
+ .config = Configuration{transition}});
}
}
@@ -1404,7 +1412,9 @@ void TreeTarget(
Expression::map_t{target.name, ExpressionPtr{*known_tree}}};
auto analysis_result = std::make_shared<AnalysedTarget const>(
- TargetResult{tree, {}, tree},
+ TargetResult{.artifact_stage = tree,
+ .provides = {},
+ .runfiles = tree},
std::vector<ActionDescription::Ptr>{},
std::vector<std::string>{},
std::vector<Tree::Ptr>{},
@@ -1428,23 +1438,25 @@ void TreeTarget(
std::vector<ConfiguredTarget> v;
for (const auto& x : dir_entries.FilesIterator()) {
- v.emplace_back(
- ConfiguredTarget{BuildMaps::Base::EntityName{
- target.repository,
- dir_name,
- x,
- BuildMaps::Base::ReferenceType::kFile},
- Configuration{}});
+ v.emplace_back(ConfiguredTarget{
+ .target =
+ BuildMaps::Base::EntityName{
+ target.repository,
+ dir_name,
+ x,
+ BuildMaps::Base::ReferenceType::kFile},
+ .config = Configuration{}});
}
for (const auto& x : dir_entries.DirectoriesIterator()) {
- v.emplace_back(
- ConfiguredTarget{BuildMaps::Base::EntityName{
- target.repository,
- dir_name,
- x,
- BuildMaps::Base::ReferenceType::kTree},
- Configuration{}});
+ v.emplace_back(ConfiguredTarget{
+ .target =
+ BuildMaps::Base::EntityName{
+ target.repository,
+ dir_name,
+ x,
+ BuildMaps::Base::ReferenceType::kTree},
+ .config = Configuration{}});
}
(*subcaller)(
std::move(v),
@@ -1474,7 +1486,9 @@ void TreeTarget(
name, ExpressionPtr{ArtifactDescription{tree_id}}}};
auto analysis_result =
std::make_shared<AnalysedTarget const>(
- TargetResult{tree_map, {}, tree_map},
+ TargetResult{.artifact_stage = tree_map,
+ .provides = {},
+ .runfiles = tree_map},
std::vector<ActionDescription::Ptr>{},
std::vector<std::string>{},
std::vector<Tree::Ptr>{tree},
@@ -1505,7 +1519,9 @@ void GlobResult(const std::vector<AnalysedTargetPtr const*>& values,
}
auto stage = ExpressionPtr{Expression::map_t{result}};
auto target = std::make_shared<AnalysedTarget const>(
- TargetResult{stage, Expression::kEmptyMap, stage},
+ TargetResult{.artifact_stage = stage,
+ .provides = Expression::kEmptyMap,
+ .runfiles = stage},
std::vector<ActionDescription::Ptr>{},
std::vector<std::string>{},
std::vector<Tree::Ptr>{},
diff --git a/src/buildtool/build_engine/target_map/utils.cpp b/src/buildtool/build_engine/target_map/utils.cpp
index 050749de..c0932dc9 100644
--- a/src/buildtool/build_engine/target_map/utils.cpp
+++ b/src/buildtool/build_engine/target_map/utils.cpp
@@ -45,7 +45,7 @@ auto BuildMaps::Target::Utils::obtainTargetByName(
}
auto transition = eval(expr->Get("transition", empty_map_exp), env);
auto it = deps_by_transition.find(BuildMaps::Target::ConfiguredTarget{
- *target, Configuration{transition}});
+ .target = *target, .config = Configuration{transition}});
if (it == deps_by_transition.end()) {
throw Evaluator::EvaluationError{fmt::format(
"Reference to undeclared dependency {} in transition {}",
@@ -70,7 +70,7 @@ auto BuildMaps::Target::Utils::obtainTarget(
}
auto transition = eval(expr->Get("transition", empty_map_exp), env);
auto it = deps_by_transition.find(BuildMaps::Target::ConfiguredTarget{
- reference->Name(), Configuration{transition}});
+ .target = reference->Name(), .config = Configuration{transition}});
if (it == deps_by_transition.end()) {
throw Evaluator::EvaluationError{fmt::format(
"Reference to undeclared dependency {} in transition {}",
diff --git a/src/buildtool/common/artifact.hpp b/src/buildtool/common/artifact.hpp
index eb5be3a3..3a593f5b 100644
--- a/src/buildtool/common/artifact.hpp
+++ b/src/buildtool/common/artifact.hpp
@@ -82,8 +82,9 @@ class Artifact {
std::size_t size = std::stoul(size_str);
auto const& object_type = FromChar(*type.c_str());
return ObjectInfo{
- ArtifactDigest{id, size, IsTreeObject(object_type)},
- object_type};
+ .digest =
+ ArtifactDigest{id, size, IsTreeObject(object_type)},
+ .type = object_type};
} catch (std::out_of_range const& e) {
Logger::Log(LogLevel::Debug,
"size raised out_of_range exception.");
@@ -100,10 +101,11 @@ class Artifact {
j["size"].is_number() and j["type"].is_string()) {
auto const& object_type =
FromChar(*(j["type"].get<std::string>().c_str()));
- return ObjectInfo{ArtifactDigest{j["id"].get<std::string>(),
- j["size"].get<std::size_t>(),
- IsTreeObject(object_type)},
- object_type};
+ return ObjectInfo{
+ .digest = ArtifactDigest{j["id"].get<std::string>(),
+ j["size"].get<std::size_t>(),
+ IsTreeObject(object_type)},
+ .type = object_type};
}
return std::nullopt;
}
@@ -159,8 +161,9 @@ class Artifact {
void SetObjectInfo(ObjectInfo const& object_info,
bool fail_info) const noexcept {
if (fail_info) {
- object_info_ =
- ObjectInfo{object_info.digest, object_info.type, true};
+ object_info_ = ObjectInfo{.digest = object_info.digest,
+ .type = object_info.type,
+ .failed = true};
}
else {
object_info_ = object_info;
@@ -170,7 +173,8 @@ class Artifact {
void SetObjectInfo(ArtifactDigest const& digest,
ObjectType type,
bool failed) const noexcept {
- object_info_ = ObjectInfo{digest, type, failed};
+ object_info_ =
+ ObjectInfo{.digest = digest, .type = type, .failed = failed};
}
[[nodiscard]] static auto CreateLocalArtifact(
diff --git a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp
index 5f392483..ba52443b 100644
--- a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp
+++ b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp
@@ -349,15 +349,16 @@ template <class T>
[[nodiscard]] auto CreateObjectInfo(bazel_re::DirectoryNode const& node)
-> Artifact::ObjectInfo {
- return Artifact::ObjectInfo{ArtifactDigest{node.digest()},
- ObjectType::Tree};
+ return Artifact::ObjectInfo{.digest = ArtifactDigest{node.digest()},
+ .type = ObjectType::Tree};
}
[[nodiscard]] auto CreateObjectInfo(bazel_re::FileNode const& node)
-> Artifact::ObjectInfo {
- return Artifact::ObjectInfo{
- ArtifactDigest{node.digest()},
- node.is_executable() ? ObjectType::Executable : ObjectType::File};
+ return Artifact::ObjectInfo{.digest = ArtifactDigest{node.digest()},
+ .type = node.is_executable()
+ ? ObjectType::Executable
+ : ObjectType::File};
}
/// \brief Convert `DirectoryTree` to `DirectoryNodeBundle`.
@@ -445,12 +446,13 @@ auto BazelMsgFactory::ReadObjectInfosFromGitTree(
for (auto const& [raw_id, es] : entries) {
auto const hex_id = ToHexString(raw_id);
for (auto const& entry : es) {
- if (not store_info(entry.name,
- Artifact::ObjectInfo{
- ArtifactDigest{hex_id,
- /*size is unknown*/ 0,
- IsTreeObject(entry.type)},
- entry.type})) {
+ if (not store_info(
+ entry.name,
+ Artifact::ObjectInfo{
+ .digest = ArtifactDigest{hex_id,
+ /*size is unknown*/ 0,
+ IsTreeObject(entry.type)},
+ .type = entry.type})) {
return false;
}
}
diff --git a/src/buildtool/execution_api/git/git_api.hpp b/src/buildtool/execution_api/git/git_api.hpp
index 2844d492..acbab788 100644
--- a/src/buildtool/execution_api/git/git_api.hpp
+++ b/src/buildtool/execution_api/git/git_api.hpp
@@ -59,10 +59,11 @@ class GitApi final : public IExecutionApi {
for (auto const& [path, entry] : *tree) {
if (not RetrieveToPaths(
{Artifact::ObjectInfo{
- ArtifactDigest{
- entry->Hash(), /*size*/ 0, entry->IsTree()},
- entry->Type(),
- false}},
+ .digest = ArtifactDigest{entry->Hash(),
+ /*size*/ 0,
+ entry->IsTree()},
+ .type = entry->Type(),
+ .failed = false}},
{output_paths[i] / path})) {
return false;
}
@@ -111,10 +112,11 @@ class GitApi final : public IExecutionApi {
for (auto const& [path, entry] : *tree) {
json[path] =
Artifact::ObjectInfo{
- ArtifactDigest{
- entry->Hash(), /*size*/ 0, entry->IsTree()},
- entry->Type(),
- false}
+ .digest =
+ ArtifactDigest{
+ entry->Hash(), /*size*/ 0, entry->IsTree()},
+ .type = entry->Type(),
+ .failed = false}
.ToString(/*size_unknown*/ true);
}
auto msg = json.dump(2) + "\n";
diff --git a/src/buildtool/execution_api/local/local_response.hpp b/src/buildtool/execution_api/local/local_response.hpp
index 2875ec16..7faa5619 100644
--- a/src/buildtool/execution_api/local/local_response.hpp
+++ b/src/buildtool/execution_api/local/local_response.hpp
@@ -76,10 +76,10 @@ class LocalResponse final : public IExecutionResponse {
try {
artifacts.emplace(
file.path(),
- Artifact::ObjectInfo{ArtifactDigest{file.digest()},
- file.is_executable()
- ? ObjectType::Executable
- : ObjectType::File});
+ Artifact::ObjectInfo{
+ .digest = ArtifactDigest{file.digest()},
+ .type = file.is_executable() ? ObjectType::Executable
+ : ObjectType::File});
} catch (...) {
return {};
}
@@ -90,8 +90,9 @@ class LocalResponse final : public IExecutionResponse {
try {
artifacts.emplace(
dir.path(),
- Artifact::ObjectInfo{ArtifactDigest{dir.tree_digest()},
- ObjectType::Tree});
+ Artifact::ObjectInfo{
+ .digest = ArtifactDigest{dir.tree_digest()},
+ .type = ObjectType::Tree});
} catch (...) {
return {};
}
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp b/src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp
index a528eecb..7f683132 100644
--- a/src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp
+++ b/src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp
@@ -47,8 +47,9 @@ class BazelExecutionClient {
std::optional<ExecutionOutput> output{std::nullopt};
static auto MakeEmptyFailed() -> ExecutionResponse {
- return ExecutionResponse{
- {}, ExecutionResponse::State::Failed, std::nullopt};
+ return ExecutionResponse{.execution_handle = {},
+ .state = ExecutionResponse::State::Failed,
+ .output = std::nullopt};
}
};
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_response.cpp b/src/buildtool/execution_api/remote/bazel/bazel_response.cpp
index d45d9aa1..9889d8ed 100644
--- a/src/buildtool/execution_api/remote/bazel/bazel_response.cpp
+++ b/src/buildtool/execution_api/remote/bazel/bazel_response.cpp
@@ -51,11 +51,12 @@ auto BazelResponse::Artifacts() const noexcept -> ArtifactInfos {
// collect files and store them
for (auto const& file : action_result.output_files()) {
try {
- artifacts.emplace(file.path(),
- Artifact::ObjectInfo{
- ArtifactDigest{file.digest()},
- file.is_executable() ? ObjectType::Executable
- : ObjectType::File});
+ artifacts.emplace(
+ file.path(),
+ Artifact::ObjectInfo{.digest = ArtifactDigest{file.digest()},
+ .type = file.is_executable()
+ ? ObjectType::Executable
+ : ObjectType::File});
} catch (...) {
return {};
}
@@ -68,8 +69,9 @@ auto BazelResponse::Artifacts() const noexcept -> ArtifactInfos {
try {
artifacts.emplace(
tree.path(),
- Artifact::ObjectInfo{ArtifactDigest{tree.tree_digest()},
- ObjectType::Tree});
+ Artifact::ObjectInfo{
+ .digest = ArtifactDigest{tree.tree_digest()},
+ .type = ObjectType::Tree});
} catch (...) {
return {};
}
@@ -109,7 +111,8 @@ auto BazelResponse::Artifacts() const noexcept -> ArtifactInfos {
}
artifacts.emplace(
action_result.output_directories(pos).path(),
- Artifact::ObjectInfo{*root_digest, ObjectType::Tree});
+ Artifact::ObjectInfo{.digest = *root_digest,
+ .type = ObjectType::Tree});
} catch (...) {
return {};
}
diff --git a/src/buildtool/execution_engine/executor/executor.hpp b/src/buildtool/execution_engine/executor/executor.hpp
index aa6635ba..f239c381 100644
--- a/src/buildtool/execution_engine/executor/executor.hpp
+++ b/src/buildtool/execution_engine/executor/executor.hpp
@@ -399,7 +399,8 @@ class ExecutorImpl {
IsExecutableObject(*object_type)}}})) {
return std::nullopt;
}
- return Artifact::ObjectInfo{std::move(digest), *object_type};
+ return Artifact::ObjectInfo{.digest = std::move(digest),
+ .type = *object_type};
}
/// \brief Add digests and object type to artifact nodes for all outputs of
diff --git a/src/buildtool/file_system/git_repo.cpp b/src/buildtool/file_system/git_repo.cpp
index 968978b5..01db8269 100644
--- a/src/buildtool/file_system/git_repo.cpp
+++ b/src/buildtool/file_system/git_repo.cpp
@@ -1250,7 +1250,7 @@ auto GitRepo::ReadTreeData(std::string const& data,
-> std::optional<tree_entries_t> {
#ifndef BOOTSTRAP_BUILD_TOOL
try {
- InMemoryODBBackend b{kInMemoryODBParent};
+ InMemoryODBBackend b{.parent = kInMemoryODBParent};
auto cas = std::make_shared<GitCAS>();
if (auto raw_id =
is_hex_id ? FromHexString(id) : std::make_optional(id)) {
@@ -1285,7 +1285,7 @@ auto GitRepo::CreateShallowTree(tree_entries_t const& entries) noexcept
-> std::optional<std::pair<std::string, std::string>> {
#ifndef BOOTSTRAP_BUILD_TOOL
try {
- InMemoryODBBackend b{kInMemoryODBParent, &entries};
+ InMemoryODBBackend b{.parent = kInMemoryODBParent, .entries = &entries};
auto cas = std::make_shared<GitCAS>();
// create a GitCAS from a special-purpose in-memory object database.
git_odb* odb_ptr{nullptr};
diff --git a/src/buildtool/graph_traverser/graph_traverser.hpp b/src/buildtool/graph_traverser/graph_traverser.hpp
index cc2ecfa1..48f5c281 100644
--- a/src/buildtool/graph_traverser/graph_traverser.hpp
+++ b/src/buildtool/graph_traverser/graph_traverser.hpp
@@ -136,9 +136,10 @@ class GraphTraverser {
artifact_nodes,
runfile_descriptions);
MaybePrintToStdout(rel_paths, artifact_nodes);
- return BuildResult{std::move(std::get<0>(*artifacts)),
- std::move(infos),
- failed_artifacts};
+ return BuildResult{
+ .output_paths = std::move(std::get<0>(*artifacts)),
+ .extra_infos = std::move(infos),
+ .failed_artifacts = failed_artifacts};
}
if (clargs_.stage->remember) {
@@ -158,7 +159,9 @@ class GraphTraverser {
MaybePrintToStdout(rel_paths, artifact_nodes);
- return BuildResult{*output_paths, std::move(infos), failed_artifacts};
+ return BuildResult{.output_paths = *output_paths,
+ .extra_infos = std::move(infos),
+ .failed_artifacts = failed_artifacts};
}
/// \brief Parses graph description into graph, traverses it and retrieves
diff --git a/src/buildtool/main/analyse.cpp b/src/buildtool/main/analyse.cpp
index ab88685d..96972703 100644
--- a/src/buildtool/main/analyse.cpp
+++ b/src/buildtool/main/analyse.cpp
@@ -108,7 +108,9 @@ void DetectAndReportPending(std::string const& name,
auto provides_exp = Expression::FromJson(provides);
return std::make_shared<AnalysedTarget const>(
- TargetResult{inputs_exp, provides_exp, Expression::kEmptyMap},
+ TargetResult{.artifact_stage = inputs_exp,
+ .provides = provides_exp,
+ .runfiles = Expression::kEmptyMap},
std::vector<ActionDescription::Ptr>{action},
target->Blobs(),
target->Trees(),
@@ -249,5 +251,5 @@ void DetectAndReportPending(std::string const& name,
}
}
}
- return AnalysisResult{id, target, modified};
+ return AnalysisResult{.id = id, .target = target, .modified = modified};
}
diff --git a/src/buildtool/main/install_cas.cpp b/src/buildtool/main/install_cas.cpp
index 4566a1bb..cdeca553 100644
--- a/src/buildtool/main/install_cas.cpp
+++ b/src/buildtool/main/install_cas.cpp
@@ -57,7 +57,8 @@ namespace {
size_str.empty() ? 0 : std::atol(size_str.c_str()));
auto const& object_type = FromChar(*type.c_str());
return Artifact::ObjectInfo{
- ArtifactDigest{id, size, IsTreeObject(object_type)}, object_type};
+ .digest = ArtifactDigest{id, size, IsTreeObject(object_type)},
+ .type = object_type};
}
#ifndef BOOTSTRAP_BUILD_TOOL
diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp
index 498507b1..3dee0096 100644
--- a/src/buildtool/main/main.cpp
+++ b/src/buildtool/main/main.cpp
@@ -576,7 +576,8 @@ void SetupHashFunction() {
if (not entity) {
std::exit(kExitFailure);
}
- return Target::ConfiguredTarget{std::move(*entity), std::move(config)};
+ return Target::ConfiguredTarget{.target = std::move(*entity),
+ .config = std::move(config)};
}
auto const target_file =
(std::filesystem::path{current_module} / target_file_name).string();
@@ -608,9 +609,9 @@ void SetupHashFunction() {
std::exit(kExitFailure);
}
return Target::ConfiguredTarget{
- Base::EntityName{
- Base::NamedTarget{main_repo, current_module, json.begin().key()}},
- std::move(config)};
+ .target = Base::EntityName{Base::NamedTarget{
+ main_repo, current_module, json.begin().key()}},
+ .config = std::move(config)};
}
[[nodiscard]] auto DetermineWorkspaceRootByLookingForMarkers() noexcept
diff --git a/src/buildtool/storage/target_cache_entry.cpp b/src/buildtool/storage/target_cache_entry.cpp
index 6e1f3187..e06d0caa 100644
--- a/src/buildtool/storage/target_cache_entry.cpp
+++ b/src/buildtool/storage/target_cache_entry.cpp
@@ -26,8 +26,9 @@ auto TargetCacheEntry::FromTarget(
AnalysedTargetPtr const& target,
std::unordered_map<ArtifactDescription, Artifact::ObjectInfo> const&
replacements) noexcept -> std::optional<TargetCacheEntry> {
- auto result = TargetResult{
- target->Artifacts(), target->Provides(), target->RunFiles()};
+ auto result = TargetResult{.artifact_stage = target->Artifacts(),
+ .provides = target->Provides(),
+ .runfiles = target->RunFiles()};
if (auto desc = result.ReplaceNonKnownAndToJson(replacements)) {
return TargetCacheEntry{*desc};
}
diff --git a/src/buildtool/system/system_command.hpp b/src/buildtool/system/system_command.hpp
index 13655730..660d9202 100644
--- a/src/buildtool/system/system_command.hpp
+++ b/src/buildtool/system/system_command.hpp
@@ -119,9 +119,9 @@ class SystemCommand {
if (auto const err = OpenFile(stderr_file)) {
if (auto retval = ForkAndExecute(
cmd, envp, cwd, fileno(out.get()), fileno(err.get()))) {
- return ExecOutput{*retval,
- std::move(stdout_file),
- std::move(stderr_file)};
+ return ExecOutput{.return_value = *retval,
+ .stdout_file = std::move(stdout_file),
+ .stderr_file = std::move(stderr_file)};
}
}
else {
diff --git a/src/other_tools/git_operations/git_operations.cpp b/src/other_tools/git_operations/git_operations.cpp
index b68c54e7..f0f80a8d 100644
--- a/src/other_tools/git_operations/git_operations.cpp
+++ b/src/other_tools/git_operations/git_operations.cpp
@@ -30,7 +30,7 @@ auto CriticalGitOps::GitInitialCommit(GitOpParams const& crit_op_params,
(*logger)(fmt::format("could not initialize git repository {}",
crit_op_params.target_path.string()),
true /*fatal*/);
- return GitOpValue({nullptr, std::nullopt});
+ return {.git_cas = nullptr, .result = std::nullopt};
}
// setup wrapped logger
auto wrapped_logger = std::make_shared<AsyncMapConsumerLogger>(
@@ -43,10 +43,10 @@ auto CriticalGitOps::GitInitialCommit(GitOpParams const& crit_op_params,
auto commit_hash = git_repo->StageAndCommitAllAnonymous(
crit_op_params.message.value(), wrapped_logger);
if (commit_hash == std::nullopt) {
- return GitOpValue({nullptr, std::nullopt});
+ return {.git_cas = nullptr, .result = std::nullopt};
}
// success
- return GitOpValue({git_repo->GetGitCAS(), commit_hash.value()});
+ return {.git_cas = git_repo->GetGitCAS(), .result = commit_hash.value()};
}
auto CriticalGitOps::GitEnsureInit(GitOpParams const& crit_op_params,
@@ -57,7 +57,7 @@ auto CriticalGitOps::GitEnsureInit(GitOpParams const& crit_op_params,
(*logger)(fmt::format("target directory {} could not be created",
crit_op_params.target_path.string()),
true /*fatal*/);
- return GitOpValue({nullptr, std::nullopt});
+ return {.git_cas = nullptr, .result = std::nullopt};
}
// Create and open a GitRepo at given target location
auto git_repo = GitRepoRemote::InitAndOpen(
@@ -69,10 +69,10 @@ auto CriticalGitOps::GitEnsureInit(GitOpParams const& crit_op_params,
crit_op_params.init_bare.value() ? "bare" : "non-bare",
crit_op_params.target_path.string()),
true /*fatal*/);
- return GitOpValue({nullptr, std::nullopt});
+ return {.git_cas = nullptr, .result = std::nullopt};
}
// success
- return GitOpValue({git_repo->GetGitCAS(), ""});
+ return {.git_cas = git_repo->GetGitCAS(), .result = ""};
}
auto CriticalGitOps::GitKeepTag(GitOpParams const& crit_op_params,
@@ -83,7 +83,7 @@ auto CriticalGitOps::GitKeepTag(GitOpParams const& crit_op_params,
(*logger)(fmt::format("target directory {} does not exist!",
crit_op_params.target_path.string()),
true /*fatal*/);
- return GitOpValue({nullptr, std::nullopt});
+ return {.git_cas = nullptr, .result = std::nullopt};
}
// Open a GitRepo at given location
auto git_repo = GitRepoRemote::Open(crit_op_params.target_path);
@@ -91,7 +91,7 @@ auto CriticalGitOps::GitKeepTag(GitOpParams const& crit_op_params,
(*logger)(fmt::format("could not open git repository {}",
crit_op_params.target_path.string()),
true /*fatal*/);
- return GitOpValue({nullptr, std::nullopt});
+ return {.git_cas = nullptr, .result = std::nullopt};
}
// setup wrapped logger
auto wrapped_logger = std::make_shared<AsyncMapConsumerLogger>(
@@ -103,10 +103,10 @@ auto CriticalGitOps::GitKeepTag(GitOpParams const& crit_op_params,
if (not git_repo->KeepTag(crit_op_params.git_hash,
crit_op_params.message.value(),
wrapped_logger)) {
- return GitOpValue({nullptr, std::nullopt});
+ return {.git_cas = nullptr, .result = std::nullopt};
}
// success
- return GitOpValue({git_repo->GetGitCAS(), ""});
+ return {.git_cas = git_repo->GetGitCAS(), .result = ""};
}
auto CriticalGitOps::GitGetHeadId(GitOpParams const& crit_op_params,
@@ -117,7 +117,7 @@ auto CriticalGitOps::GitGetHeadId(GitOpParams const& crit_op_params,
(*logger)(fmt::format("target directory {} does not exist!",
crit_op_params.target_path.string()),
true /*fatal*/);
- return GitOpValue({nullptr, std::nullopt});
+ return {.git_cas = nullptr, .result = std::nullopt};
}
// Open a GitRepo at given location
auto git_repo = GitRepoRemote::Open(crit_op_params.target_path);
@@ -125,7 +125,7 @@ auto CriticalGitOps::GitGetHeadId(GitOpParams const& crit_op_params,
(*logger)(fmt::format("could not open git repository {}",
crit_op_params.target_path.string()),
true /*fatal*/);
- return GitOpValue({nullptr, std::nullopt});
+ return {.git_cas = nullptr, .result = std::nullopt};
}
// setup wrapped logger
auto wrapped_logger = std::make_shared<AsyncMapConsumerLogger>(
@@ -136,8 +136,8 @@ auto CriticalGitOps::GitGetHeadId(GitOpParams const& crit_op_params,
// Get head commit
auto head_commit = git_repo->GetHeadCommit(wrapped_logger);
if (head_commit == std::nullopt) {
- return GitOpValue({nullptr, std::nullopt});
+ return {.git_cas = nullptr, .result = std::nullopt};
}
// success
- return GitOpValue({git_repo->GetGitCAS(), *head_commit});
+ return {.git_cas = git_repo->GetGitCAS(), .result = *head_commit};
}
diff --git a/src/other_tools/git_operations/git_repo_remote.cpp b/src/other_tools/git_operations/git_repo_remote.cpp
index 0c925cc4..580375ec 100644
--- a/src/other_tools/git_operations/git_repo_remote.cpp
+++ b/src/other_tools/git_operations/git_repo_remote.cpp
@@ -531,7 +531,8 @@ auto GitRepoRemote::FetchViaTmpRepo(std::filesystem::path const& tmp_dir,
return false;
}
// add backend, with max priority
- FetchIntoODBBackend b{kFetchIntoODBParent, GetGitOdb().get()};
+ FetchIntoODBBackend b{.parent = kFetchIntoODBParent,
+ .target_odb = GetGitOdb().get()};
if (git_odb_add_backend(
tmp_repo->GetGitOdb().get(),
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
diff --git a/src/other_tools/just_mr/main.cpp b/src/other_tools/just_mr/main.cpp
index 33a09531..56ba4a18 100644
--- a/src/other_tools/just_mr/main.cpp
+++ b/src/other_tools/just_mr/main.cpp
@@ -790,26 +790,28 @@ void DefaultReachableRepositories(
(*resolved_repo_desc)
->Get("ignore_special", Expression::none_t{});
ArchiveRepoInfo archive_info = {
- {
- repo_desc_content->get()->String(), /* content */
- repo_desc_distfile->IsString()
- ? std::make_optional(repo_desc_distfile->String())
- : std::nullopt, /* distfile */
- repo_desc_fetch->get()->String(), /* fetch_url */
- repo_desc_sha256->IsString()
- ? std::make_optional(repo_desc_sha256->String())
- : std::nullopt, /* sha256 */
- repo_desc_sha512->IsString()
- ? std::make_optional(repo_desc_sha512->String())
- : std::nullopt, /* sha512 */
- repo_name, /* origin */
- false /* origin_from_distdir */
- }, /* archive */
- repo_type_str, /* repo_type */
- subdir.empty() ? "." : subdir.string(), /* subdir */
- repo_desc_ignore_special->IsBool()
- ? repo_desc_ignore_special->Bool()
- : false /* ignore_special */};
+ .archive = {.content = repo_desc_content->get()->String(),
+ .distfile =
+ repo_desc_distfile->IsString()
+ ? std::make_optional(
+ repo_desc_distfile->String())
+ : std::nullopt,
+ .fetch_url = repo_desc_fetch->get()->String(),
+ .sha256 = repo_desc_sha256->IsString()
+ ? std::make_optional(
+ repo_desc_sha256->String())
+ : std::nullopt,
+ .sha512 = repo_desc_sha512->IsString()
+ ? std::make_optional(
+ repo_desc_sha512->String())
+ : std::nullopt,
+ .origin = repo_name,
+ .origin_from_distdir = false},
+ .repo_type = repo_type_str,
+ .subdir = subdir.empty() ? "." : subdir.string(),
+ .ignore_special = repo_desc_ignore_special->IsBool()
+ ? repo_desc_ignore_special->Bool()
+ : false};
// add to list
repos_to_fetch.emplace_back(std::move(archive_info));
}
diff --git a/src/other_tools/just_mr/utils.hpp b/src/other_tools/just_mr/utils.hpp
index d992a895..5caf33d0 100644
--- a/src/other_tools/just_mr/utils.hpp
+++ b/src/other_tools/just_mr/utils.hpp
@@ -55,36 +55,21 @@ struct JustSubCmdFlags {
// ordered, so that we have replicability
std::map<std::string, JustSubCmdFlags> const kKnownJustSubcommands{
{"version",
- {false /*config*/,
- false /*build_root*/,
- false /*launch*/,
- false /*defines*/}},
+ {.config = false, .build_root = false, .launch = false, .defines = false}},
{"describe",
- {true /*config*/,
- false /*build_root*/,
- false /*launch*/,
- true /*defines*/}},
+ {.config = true, .build_root = false, .launch = false, .defines = true}},
{"analyse",
- {true /*config*/,
- true /*build_root*/,
- false /*launch*/,
- true /*defines*/}},
+ {.config = true, .build_root = true, .launch = false, .defines = true}},
{"build",
- {true /*config*/, true /*build_root*/, true /*launch*/, true /*defines*/}},
+ {.config = true, .build_root = true, .launch = true, .defines = true}},
{"install",
- {true /*config*/, true /*build_root*/, true /*launch*/, true /*defines*/}},
+ {.config = true, .build_root = true, .launch = true, .defines = true}},
{"rebuild",
- {true /*config*/, true /*build_root*/, true /*launch*/, true /*defines*/}},
+ {.config = true, .build_root = true, .launch = true, .defines = true}},
{"install-cas",
- {false /*config*/,
- true /*build_root*/,
- false /*launch*/,
- false /*defines*/}},
+ {.config = false, .build_root = true, .launch = false, .defines = false}},
{"gc",
- {false /*config*/,
- true /*build_root*/,
- false /*launch*/,
- false /*defines*/}}};
+ {.config = false, .build_root = true, .launch = false, .defines = false}}};
nlohmann::json const kDefaultConfigLocations = nlohmann::json::array(
{{{"root", "workspace"}, {"path", "repos.json"}},
diff --git a/src/other_tools/ops_maps/import_to_git_map.cpp b/src/other_tools/ops_maps/import_to_git_map.cpp
index 42ec7c9b..e8b7a89d 100644
--- a/src/other_tools/ops_maps/import_to_git_map.cpp
+++ b/src/other_tools/ops_maps/import_to_git_map.cpp
@@ -31,13 +31,14 @@ void KeepCommitAndSetTree(
ImportToGitMap::SetterPtr const& setter,
ImportToGitMap::LoggerPtr const& logger) {
// Keep tag for commit
- GitOpKey op_key = {{
- StorageConfig::GitRoot(), // target_path
- commit, // git_hash
- "", // branch
- "Keep referenced tree alive" // message
- },
- GitOpType::KEEP_TAG};
+ GitOpKey op_key = {.params =
+ {
+ StorageConfig::GitRoot(), // target_path
+ commit, // git_hash
+ "", // branch
+ "Keep referenced tree alive" // message
+ },
+ .op_type = GitOpType::KEEP_TAG};
critical_git_op_map->ConsumeAfterKeysReady(
ts,
{std::move(op_key)},
@@ -96,15 +97,16 @@ auto CreateImportToGitMap(
auto /*unused*/,
auto const& key) {
// Perform initial commit at location: init + add . + commit
- GitOpKey op_key = {
- {
- key.target_path, // target_path
- "", // git_hash
- "", // branch
- fmt::format(
- "Content of {} {}", key.repo_type, key.content), // message
- },
- GitOpType::INITIAL_COMMIT};
+ GitOpKey op_key = {.params =
+ {
+ key.target_path, // target_path
+ "", // git_hash
+ "", // branch
+ fmt::format("Content of {} {}",
+ key.repo_type,
+ key.content), // message
+ },
+ .op_type = GitOpType::INITIAL_COMMIT};
critical_git_op_map->ConsumeAfterKeysReady(
ts,
{std::move(op_key)},
@@ -124,14 +126,16 @@ auto CreateImportToGitMap(
}
// ensure Git cache
// define Git operation to be done
- GitOpKey op_key = {{
- StorageConfig::GitRoot(), // target_path
- "", // git_hash
- "", // branch
- std::nullopt, // message
- true // init_bare
- },
- GitOpType::ENSURE_INIT};
+ GitOpKey op_key = {
+ .params =
+ {
+ StorageConfig::GitRoot(), // target_path
+ "", // git_hash
+ "", // branch
+ std::nullopt, // message
+ true // init_bare
+ },
+ .op_type = GitOpType::ENSURE_INIT};
critical_git_op_map->ConsumeAfterKeysReady(
ts,
{std::move(op_key)},
diff --git a/src/other_tools/repo_map/repos_to_setup_map.cpp b/src/other_tools/repo_map/repos_to_setup_map.cpp
index 0637b81d..d65386a3 100644
--- a/src/other_tools/repo_map/repos_to_setup_map.cpp
+++ b/src/other_tools/repo_map/repos_to_setup_map.cpp
@@ -95,14 +95,14 @@ void GitCheckout(ExpressionPtr const& repo_desc,
repo_desc->Get("ignore_special", Expression::none_t{});
// populate struct
GitRepoInfo git_repo_info = {
- repo_desc_commit->get()->String(), /* hash */
- repo_desc_repository->get()->String(), /* repo_url */
- repo_desc_branch->get()->String(), /* branch */
- subdir.empty() ? "." : subdir.string(), /* subdir */
- repo_name, /* origin */
- repo_desc_ignore_special->IsBool() ? repo_desc_ignore_special->Bool()
- : false /* ignore_special */
- };
+ .hash = repo_desc_commit->get()->String(),
+ .repo_url = repo_desc_repository->get()->String(),
+ .branch = repo_desc_branch->get()->String(),
+ .subdir = subdir.empty() ? "." : subdir.string(),
+ .origin = repo_name,
+ .ignore_special = repo_desc_ignore_special->IsBool()
+ ? repo_desc_ignore_special->Bool()
+ : false};
// get the WS root as git tree
commit_git_map->ConsumeAfterKeysReady(
ts,
@@ -178,26 +178,25 @@ void ArchiveCheckout(ExpressionPtr const& repo_desc,
repo_desc->Get("ignore_special", Expression::none_t{});
// populate struct
ArchiveRepoInfo archive_repo_info = {
- {
- repo_desc_content->get()->String(), /* content */
- repo_desc_distfile->IsString()
- ? std::make_optional(repo_desc_distfile->String())
- : std::nullopt, /* distfile */
- repo_desc_fetch->get()->String(), /* fetch_url */
- repo_desc_sha256->IsString()
- ? std::make_optional(repo_desc_sha256->String())
- : std::nullopt, /* sha256 */
- repo_desc_sha512->IsString()
- ? std::make_optional(repo_desc_sha512->String())
- : std::nullopt, /* sha512 */
- repo_name, /* origin */
- false /* origin_from_distdir */
- }, /* archive */
- repo_type, /* repo_type */
- subdir.empty() ? "." : subdir.string(), /* subdir */
- repo_desc_ignore_special->IsBool() ? repo_desc_ignore_special->Bool()
- : false /* ignore_special */
- };
+ .archive =
+ {.content = repo_desc_content->get()->String(),
+ .distfile = repo_desc_distfile->IsString()
+ ? std::make_optional(repo_desc_distfile->String())
+ : std::nullopt,
+ .fetch_url = repo_desc_fetch->get()->String(),
+ .sha256 = repo_desc_sha256->IsString()
+ ? std::make_optional(repo_desc_sha256->String())
+ : std::nullopt,
+ .sha512 = repo_desc_sha512->IsString()
+ ? std::make_optional(repo_desc_sha512->String())
+ : std::nullopt,
+ .origin = repo_name,
+ .origin_from_distdir = false},
+ .repo_type = repo_type,
+ .subdir = subdir.empty() ? "." : subdir.string(),
+ .ignore_special = repo_desc_ignore_special->IsBool()
+ ? repo_desc_ignore_special->Bool()
+ : false};
// get the WS root as git tree
content_git_map->ConsumeAfterKeysReady(
ts,
@@ -432,20 +431,20 @@ void DistdirCheckout(ExpressionPtr const& repo_desc,
(*resolved_repo_desc)->Get("sha512", Expression::none_t{});
ArchiveContent archive = {
- repo_desc_content->get()->String(), /* content */
- repo_desc_distfile->IsString()
- ? std::make_optional(repo_desc_distfile->String())
- : std::nullopt, /* distfile */
- repo_desc_fetch->get()->String(), /* fetch_url */
- repo_desc_sha256->IsString()
- ? std::make_optional(repo_desc_sha256->String())
- : std::nullopt, /* sha256 */
- repo_desc_sha512->IsString()
- ? std::make_optional(repo_desc_sha512->String())
- : std::nullopt, /* sha512 */
- dist_repo_name, /* origin */
- true /* origin_from_distdir */
- }; /* archive */
+ .content = repo_desc_content->get()->String(),
+ .distfile =
+ repo_desc_distfile->IsString()
+ ? std::make_optional(repo_desc_distfile->String())
+ : std::nullopt,
+ .fetch_url = repo_desc_fetch->get()->String(),
+ .sha256 = repo_desc_sha256->IsString()
+ ? std::make_optional(repo_desc_sha256->String())
+ : std::nullopt,
+ .sha512 = repo_desc_sha512->IsString()
+ ? std::make_optional(repo_desc_sha512->String())
+ : std::nullopt,
+ .origin = dist_repo_name,
+ .origin_from_distdir = true};
// add to distdir content map
auto repo_distfile =
@@ -463,13 +462,11 @@ void DistdirCheckout(ExpressionPtr const& repo_desc,
HashFunction::ComputeBlobHash(nlohmann::json(*distdir_content).dump())
.HexString();
// get the WS root as git tree
- DistdirInfo distdir_info = {
- distdir_content_id, /* content_id */
- distdir_content, /* content_list */
- dist_repos_to_fetch, /* repos_to_fetch */
- repo_name, /* origin */
- ignore_special /* ignore_special */
- };
+ DistdirInfo distdir_info = {.content_id = distdir_content_id,
+ .content_list = distdir_content,
+ .repos_to_fetch = dist_repos_to_fetch,
+ .origin = repo_name,
+ .ignore_special = ignore_special};
distdir_git_map->ConsumeAfterKeysReady(
ts,
{std::move(distdir_info)},
@@ -568,13 +565,10 @@ void GitTreeCheckout(ExpressionPtr const& repo_desc,
? repo_desc_ignore_special->Bool()
: false;
// populate struct
- TreeIdInfo tree_id_info = {
- repo_desc_hash->get()->String(), /* hash */
- std::move(env), /* env_vars */
- std::move(cmd), /* command */
- repo_name, /* origin */
- ignore_special /* ignore_special */
- };
+ TreeIdInfo tree_id_info = {.hash = repo_desc_hash->get()->String(),
+ .env_vars = std::move(env),
+ .command = std::move(cmd),
+ .ignore_special = ignore_special};
// get the WS root as git tree
tree_id_git_map->ConsumeAfterKeysReady(
ts,
diff --git a/src/other_tools/root_maps/commit_git_map.cpp b/src/other_tools/root_maps/commit_git_map.cpp
index 3ae98331..5a2f831e 100644
--- a/src/other_tools/root_maps/commit_git_map.cpp
+++ b/src/other_tools/root_maps/commit_git_map.cpp
@@ -107,13 +107,14 @@ void EnsureCommit(GitRepoInfo const& repo_info,
return;
}
// keep tag
- GitOpKey op_key = {{
- repo_root, // target_path
- repo_info.hash, // git_hash
- "", // branch
- "Keep referenced tree alive" // message
- },
- GitOpType::KEEP_TAG};
+ GitOpKey op_key = {.params =
+ {
+ repo_root, // target_path
+ repo_info.hash, // git_hash
+ "", // branch
+ "Keep referenced tree alive" // message
+ },
+ .op_type = GitOpType::KEEP_TAG};
critical_git_op_map->ConsumeAfterKeysReady(
ts,
{std::move(op_key)},
@@ -221,15 +222,16 @@ auto CreateCommitGitMap(
// ensure git repo
// define Git operation to be done
GitOpKey op_key = {
- {
- repo_root, // target_path
- "", // git_hash
- "", // branch
- std::nullopt, // message
- not just_mr_paths->git_checkout_locations.contains(
- fetch_repo) // init_bare
- },
- GitOpType::ENSURE_INIT};
+ .params =
+ {
+ repo_root, // target_path
+ "", // git_hash
+ "", // branch
+ std::nullopt, // message
+ not just_mr_paths->git_checkout_locations.contains(
+ fetch_repo) // init_bare
+ },
+ .op_type = GitOpType::ENSURE_INIT};
critical_git_op_map->ConsumeAfterKeysReady(
ts,
{std::move(op_key)},
diff --git a/src/other_tools/root_maps/content_git_map.cpp b/src/other_tools/root_maps/content_git_map.cpp
index b7a3c25e..aeea9e1e 100644
--- a/src/other_tools/root_maps/content_git_map.cpp
+++ b/src/other_tools/root_maps/content_git_map.cpp
@@ -69,14 +69,15 @@ auto CreateContentGitMap(
}
// ensure Git cache
// define Git operation to be done
- GitOpKey op_key = {{
- StorageConfig::GitRoot(), // target_path
- "", // git_hash
- "", // branch
- std::nullopt, // message
- true // init_bare
- },
- GitOpType::ENSURE_INIT};
+ GitOpKey op_key = {.params =
+ {
+ StorageConfig::GitRoot(), // target_path
+ "", // git_hash
+ "", // branch
+ std::nullopt, // message
+ true // init_bare
+ },
+ .op_type = GitOpType::ENSURE_INIT};
critical_git_op_map->ConsumeAfterKeysReady(
ts,
{std::move(op_key)},
diff --git a/src/other_tools/root_maps/distdir_git_map.cpp b/src/other_tools/root_maps/distdir_git_map.cpp
index db0e8ee9..78539158 100644
--- a/src/other_tools/root_maps/distdir_git_map.cpp
+++ b/src/other_tools/root_maps/distdir_git_map.cpp
@@ -78,14 +78,15 @@ auto CreateDistdirGitMap(
}
// ensure Git cache
// define Git operation to be done
- GitOpKey op_key = {{
- StorageConfig::GitRoot(), // target_path
- "", // git_hash
- "", // branch
- std::nullopt, // message
- true // init_bare
- },
- GitOpType::ENSURE_INIT};
+ GitOpKey op_key = {.params =
+ {
+ StorageConfig::GitRoot(), // target_path
+ "", // git_hash
+ "", // branch
+ std::nullopt, // message
+ true // init_bare
+ },
+ .op_type = GitOpType::ENSURE_INIT};
critical_git_op_map->ConsumeAfterKeysReady(
ts,
{std::move(op_key)},
diff --git a/src/other_tools/root_maps/fpath_git_map.cpp b/src/other_tools/root_maps/fpath_git_map.cpp
index 262d2b77..e7946e71 100644
--- a/src/other_tools/root_maps/fpath_git_map.cpp
+++ b/src/other_tools/root_maps/fpath_git_map.cpp
@@ -62,12 +62,13 @@ auto CreateFilePathGitMap(
return;
}
// get head commit
- GitOpKey op_key = {{
- *repo_root, // target_path
- "", // git_hash
- "", // branch
- },
- GitOpType::GET_HEAD_ID};
+ GitOpKey op_key = {.params =
+ {
+ *repo_root, // target_path
+ "", // git_hash
+ "", // branch
+ },
+ .op_type = GitOpType::GET_HEAD_ID};
critical_git_op_map->ConsumeAfterKeysReady(
ts,
{std::move(op_key)},
diff --git a/src/other_tools/root_maps/tree_id_git_map.cpp b/src/other_tools/root_maps/tree_id_git_map.cpp
index 27474c52..920ed615 100644
--- a/src/other_tools/root_maps/tree_id_git_map.cpp
+++ b/src/other_tools/root_maps/tree_id_git_map.cpp
@@ -36,13 +36,14 @@ void KeepCommitAndSetRoot(
TreeIdGitMap::SetterPtr const& ws_setter,
TreeIdGitMap::LoggerPtr const& logger) {
// Keep tag for commit
- GitOpKey op_key = {{
- StorageConfig::GitRoot(), // target_path
- commit, // git_hash
- "", // branch
- "Keep referenced tree alive" // message
- },
- GitOpType::KEEP_TAG};
+ GitOpKey op_key = {.params =
+ {
+ StorageConfig::GitRoot(), // target_path
+ commit, // git_hash
+ "", // branch
+ "Keep referenced tree alive" // message
+ },
+ .op_type = GitOpType::KEEP_TAG};
critical_git_op_map->ConsumeAfterKeysReady(
ts,
{std::move(op_key)},
@@ -95,14 +96,15 @@ auto CreateTreeIdGitMap(
// first, check whether tree exists already in CAS
// ensure Git cache
// define Git operation to be done
- GitOpKey op_key = {{
- StorageConfig::GitRoot(), // target_path
- "", // git_hash
- "", // branch
- std::nullopt, // message
- true // init_bare
- },
- GitOpType::ENSURE_INIT};
+ GitOpKey op_key = {.params =
+ {
+ StorageConfig::GitRoot(), // target_path
+ "", // git_hash
+ "", // branch
+ std::nullopt, // message
+ true // init_bare
+ },
+ .op_type = GitOpType::ENSURE_INIT};
critical_git_op_map->ConsumeAfterKeysReady(
ts,
{std::move(op_key)},
@@ -177,14 +179,16 @@ auto CreateTreeIdGitMap(
}
// do an import to git with tree check
- GitOpKey op_key = {{
- tmp_dir->GetPath(), // target_path
- "", // git_hash
- "", // branch
- fmt::format("Content of tree {}",
- key.hash), // message
- },
- GitOpType::INITIAL_COMMIT};
+ GitOpKey op_key = {
+ .params =
+ {
+ tmp_dir->GetPath(), // target_path
+ "", // git_hash
+ "", // branch
+ fmt::format("Content of tree {}",
+ key.hash), // message
+ },
+ .op_type = GitOpType::INITIAL_COMMIT};
critical_git_op_map->ConsumeAfterKeysReady(
ts,
{std::move(op_key)},
diff --git a/test/buildtool/build_engine/target_map/target_map.test.cpp b/test/buildtool/build_engine/target_map/target_map.test.cpp
index 6d9cbbdd..9b667425 100644
--- a/test/buildtool/build_engine/target_map/target_map.test.cpp
+++ b/test/buildtool/build_engine/target_map/target_map.test.cpp
@@ -68,9 +68,10 @@ TEST_CASE("simple targets") {
target_map.ConsumeAfterKeysReady(
&ts,
{BuildMaps::Target::ConfiguredTarget{
- BuildMaps::Base::EntityName{
- "", "a/b/targets_here", "c/d/foo"},
- empty_config}},
+ .target =
+ BuildMaps::Base::EntityName{
+ "", "a/b/targets_here", "c/d/foo"},
+ .config = empty_config}},
[&result](auto values) { result = *values[0]; },
[&error, &error_msg](std::string const& msg, bool /*unused*/) {
error = true;
@@ -93,9 +94,10 @@ TEST_CASE("simple targets") {
target_map.ConsumeAfterKeysReady(
&ts,
{BuildMaps::Target::ConfiguredTarget{
- BuildMaps::Base::EntityName{
- "", "a/b/targets_here/c", "d/foo"},
- empty_config}},
+ .target =
+ BuildMaps::Base::EntityName{
+ "", "a/b/targets_here/c", "d/foo"},
+ .config = empty_config}},
[&result](auto values) { result = *values[0]; },
[&error, &error_msg](std::string const& msg, bool /*unused*/) {
error = true;
@@ -116,9 +118,10 @@ TEST_CASE("simple targets") {
target_map.ConsumeAfterKeysReady(
&ts,
{BuildMaps::Target::ConfiguredTarget{
- BuildMaps::Base::EntityName{
- "", "simple_targets", "rule just provides"},
- empty_config}},
+ .target =
+ BuildMaps::Base::EntityName{
+ "", "simple_targets", "rule just provides"},
+ .config = empty_config}},
[&result](auto values) { result = *values[0]; },
[&error, &error_msg](std::string const& msg, bool /*unused*/) {
error = true;
@@ -141,9 +144,10 @@ TEST_CASE("simple targets") {
target_map.ConsumeAfterKeysReady(
&ts,
{BuildMaps::Target::ConfiguredTarget{
- BuildMaps::Base::EntityName{
- "", "simple_targets", "rule provides FOO"},
- empty_config}},
+ .target =
+ BuildMaps::Base::EntityName{
+ "", "simple_targets", "rule provides FOO"},
+ .config = empty_config}},
[&result](auto values) { result = *values[0]; },
[&error, &error_msg](std::string const& msg, bool /*unused*/) {
error = true;
@@ -168,9 +172,10 @@ TEST_CASE("simple targets") {
target_map.ConsumeAfterKeysReady(
&ts,
{BuildMaps::Target::ConfiguredTarget{
- BuildMaps::Base::EntityName{
- "", "simple_targets", "rule provides FOO"},
- config}},
+ .target =
+ BuildMaps::Base::EntityName{
+ "", "simple_targets", "rule provides FOO"},
+ .config = config}},
[&result](auto values) { result = *values[0]; },
[&error, &error_msg](std::string const& msg, bool /*unused*/) {
error = true;
@@ -195,9 +200,10 @@ TEST_CASE("simple targets") {
target_map.ConsumeAfterKeysReady(
&ts,
{BuildMaps::Target::ConfiguredTarget{
- BuildMaps::Base::EntityName{
- "", "simple_targets", "config transition for FOO"},
- config}},
+ .target =
+ BuildMaps::Base::EntityName{
+ "", "simple_targets", "config transition for FOO"},
+ .config = config}},
[&result](auto values) { result = *values[0]; },
[&error, &error_msg](std::string const& msg, bool /*unused*/) {
error = true;
@@ -221,9 +227,10 @@ TEST_CASE("simple targets") {
target_map.ConsumeAfterKeysReady(
&ts,
{BuildMaps::Target::ConfiguredTarget{
- BuildMaps::Base::EntityName{
- "", "simple_targets", "collect dep artifacts"},
- empty_config}},
+ .target =
+ BuildMaps::Base::EntityName{
+ "", "simple_targets", "collect dep artifacts"},
+ .config = empty_config}},
[&result](auto values) { result = *values[0]; },
[&error, &error_msg](std::string const& msg, bool /*unused*/) {
error = true;
@@ -253,9 +260,10 @@ TEST_CASE("simple targets") {
target_map.ConsumeAfterKeysReady(
&ts,
{BuildMaps::Target::ConfiguredTarget{
- BuildMaps::Base::EntityName{
- "", "simple_targets", "stage blob"},
- empty_config}},
+ .target =
+ BuildMaps::Base::EntityName{
+ "", "simple_targets", "stage blob"},
+ .config = empty_config}},
[&result](auto values) { result = *values[0]; },
[&error, &error_msg](std::string const& msg, bool /*unused*/) {
error = true;
@@ -281,9 +289,10 @@ TEST_CASE("simple targets") {
target_map.ConsumeAfterKeysReady(
&ts,
{BuildMaps::Target::ConfiguredTarget{
- BuildMaps::Base::EntityName{
- "", "simple_targets", "use implicit"},
- empty_config}},
+ .target =
+ BuildMaps::Base::EntityName{
+ "", "simple_targets", "use implicit"},
+ .config = empty_config}},
[&result](auto values) { result = *values[0]; },
[&error, &error_msg](std::string const& msg, bool /*unused*/) {
error = true;
@@ -309,9 +318,10 @@ TEST_CASE("simple targets") {
target_map.ConsumeAfterKeysReady(
&ts,
{BuildMaps::Target::ConfiguredTarget{
- BuildMaps::Base::EntityName{
- "", "simple_targets", "actions"},
- empty_config}},
+ .target =
+ BuildMaps::Base::EntityName{
+ "", "simple_targets", "actions"},
+ .config = empty_config}},
[&result](auto values) { result = *values[0]; },
[&error, &error_msg](std::string const& msg, bool /*unused*/) {
error = true;
@@ -366,11 +376,12 @@ TEST_CASE("configuration deduplication") {
TaskSystem ts;
target_map.ConsumeAfterKeysReady(
&ts,
- {BuildMaps::Target::ConfiguredTarget{indirect_target, config},
- BuildMaps::Target::ConfiguredTarget{indirect_target,
- alternative_config},
- BuildMaps::Target::ConfiguredTarget{indirect_target,
- different_config}},
+ {BuildMaps::Target::ConfiguredTarget{.target = indirect_target,
+ .config = config},
+ BuildMaps::Target::ConfiguredTarget{.target = indirect_target,
+ .config = alternative_config},
+ BuildMaps::Target::ConfiguredTarget{.target = indirect_target,
+ .config = different_config}},
[&result](auto values) {
std::transform(values.begin(),
values.end(),
@@ -417,9 +428,10 @@ TEST_CASE("generator functions in string arguments") {
target_map.ConsumeAfterKeysReady(
&ts,
{BuildMaps::Target::ConfiguredTarget{
- BuildMaps::Base::EntityName{
- "", "simple_targets", "artifact names"},
- empty_config}},
+ .target =
+ BuildMaps::Base::EntityName{
+ "", "simple_targets", "artifact names"},
+ .config = empty_config}},
[&result](auto values) { result = *values[0]; },
[&error, &error_msg](std::string const& msg, bool /*unused*/) {
error = true;
@@ -440,9 +452,10 @@ TEST_CASE("generator functions in string arguments") {
target_map.ConsumeAfterKeysReady(
&ts,
{BuildMaps::Target::ConfiguredTarget{
- BuildMaps::Base::EntityName{
- "", "simple_targets", "runfile names"},
- empty_config}},
+ .target =
+ BuildMaps::Base::EntityName{
+ "", "simple_targets", "runfile names"},
+ .config = empty_config}},
[&result](auto values) { result = *values[0]; },
[&error, &error_msg](std::string const& msg, bool /*unused*/) {
error = true;
@@ -483,9 +496,10 @@ TEST_CASE("built-in rules") {
target_map.ConsumeAfterKeysReady(
&ts,
{BuildMaps::Target::ConfiguredTarget{
- BuildMaps::Base::EntityName{
- "", "simple_targets", "use generic"},
- empty_config}},
+ .target =
+ BuildMaps::Base::EntityName{
+ "", "simple_targets", "use generic"},
+ .config = empty_config}},
[&result](auto values) { result = *values[0]; },
[&error, &error_msg](std::string const& msg, bool /*unused*/) {
error = true;
@@ -507,9 +521,10 @@ TEST_CASE("built-in rules") {
target_map.ConsumeAfterKeysReady(
&ts,
{BuildMaps::Target::ConfiguredTarget{
- BuildMaps::Base::EntityName{
- "", "simple_targets", "install"},
- empty_config}},
+ .target =
+ BuildMaps::Base::EntityName{
+ "", "simple_targets", "install"},
+ .config = empty_config}},
[&result](auto values) { result = *values[0]; },
[&error, &error_msg](std::string const& msg, bool /*unused*/) {
error = true;
@@ -546,9 +561,10 @@ TEST_CASE("built-in rules") {
target_map.ConsumeAfterKeysReady(
&ts,
{BuildMaps::Target::ConfiguredTarget{
- BuildMaps::Base::EntityName{
- "", "simple_targets", "generate file"},
- empty_config}},
+ .target =
+ BuildMaps::Base::EntityName{
+ "", "simple_targets", "generate file"},
+ .config = empty_config}},
[&result](auto values) { result = *values[0]; },
[&error, &error_msg](std::string const& msg, bool /*unused*/) {
error = true;
@@ -576,8 +592,10 @@ TEST_CASE("built-in rules") {
TaskSystem ts;
target_map.ConsumeAfterKeysReady(
&ts,
- {BuildMaps::Target::ConfiguredTarget{target, empty_config},
- BuildMaps::Target::ConfiguredTarget{target, baz_config}},
+ {BuildMaps::Target::ConfiguredTarget{.target = target,
+ .config = empty_config},
+ BuildMaps::Target::ConfiguredTarget{.target = target,
+ .config = baz_config}},
[&bar_result, &baz_result](auto values) {
bar_result = *values[0];
baz_result = *values[1];
@@ -625,9 +643,10 @@ TEST_CASE("target reference") {
target_map.ConsumeAfterKeysReady(
&ts,
{BuildMaps::Target::ConfiguredTarget{
- BuildMaps::Base::EntityName{
- "", "file_reference", "hello.txt"},
- empty_config}},
+ .target =
+ BuildMaps::Base::EntityName{
+ "", "file_reference", "hello.txt"},
+ .config = empty_config}},
[&result](auto values) { result = *values[0]; },
[&error, &error_msg](std::string const& msg, bool /*unused*/) {
error = true;
@@ -656,8 +675,9 @@ TEST_CASE("target reference") {
target_map.ConsumeAfterKeysReady(
&ts,
{BuildMaps::Target::ConfiguredTarget{
- BuildMaps::Base::EntityName{"", "x/x/x", "addressing"},
- empty_config}},
+ .target =
+ BuildMaps::Base::EntityName{"", "x/x/x", "addressing"},
+ .config = empty_config}},
[&result](auto values) { result = *values[0]; },
[&error, &error_msg](std::string const& msg, bool /*unused*/) {
error = true;
@@ -702,8 +722,9 @@ TEST_CASE("trees") {
target_map.ConsumeAfterKeysReady(
&ts,
{BuildMaps::Target::ConfiguredTarget{
- BuildMaps::Base::EntityName{"", "tree", "no conflict"},
- empty_config}},
+ .target =
+ BuildMaps::Base::EntityName{"", "tree", "no conflict"},
+ .config = empty_config}},
[&result](auto values) { result = *values[0]; },
[&error, &error_msg](std::string const& msg, bool /*unused*/) {
error = true;
@@ -734,8 +755,10 @@ TEST_CASE("trees") {
target_map.ConsumeAfterKeysReady(
&ts,
{BuildMaps::Target::ConfiguredTarget{
- BuildMaps::Base::EntityName{"", "tree", "range conflict"},
- empty_config}},
+ .target =
+ BuildMaps::Base::EntityName{
+ "", "tree", "range conflict"},
+ .config = empty_config}},
[&result](auto values) { result = *values[0]; },
[&error, &error_msg](std::string const& msg, bool /*unused*/) {
error = true;
@@ -774,8 +797,9 @@ TEST_CASE("RESULT error reporting") {
target_map.ConsumeAfterKeysReady(
&ts,
{BuildMaps::Target::ConfiguredTarget{
- BuildMaps::Base::EntityName{"", "result", "artifacts"},
- empty_config}},
+ .target =
+ BuildMaps::Base::EntityName{"", "result", "artifacts"},
+ .config = empty_config}},
[&result](auto values) { result = *values[0]; },
[&error, &error_msg](std::string const& msg, bool /*unused*/) {
error = true;
@@ -795,9 +819,10 @@ TEST_CASE("RESULT error reporting") {
target_map.ConsumeAfterKeysReady(
&ts,
{BuildMaps::Target::ConfiguredTarget{
- BuildMaps::Base::EntityName{
- "", "result", "artifacts entry"},
- empty_config}},
+ .target =
+ BuildMaps::Base::EntityName{
+ "", "result", "artifacts entry"},
+ .config = empty_config}},
[&result](auto values) { result = *values[0]; },
[&error, &error_msg](std::string const& msg, bool /*unused*/) {
error = true;
@@ -818,8 +843,9 @@ TEST_CASE("RESULT error reporting") {
target_map.ConsumeAfterKeysReady(
&ts,
{BuildMaps::Target::ConfiguredTarget{
- BuildMaps::Base::EntityName{"", "result", "runfiles"},
- empty_config}},
+ .target =
+ BuildMaps::Base::EntityName{"", "result", "runfiles"},
+ .config = empty_config}},
[&result](auto values) { result = *values[0]; },
[&error, &error_msg](std::string const& msg, bool /*unused*/) {
error = true;
@@ -839,8 +865,10 @@ TEST_CASE("RESULT error reporting") {
target_map.ConsumeAfterKeysReady(
&ts,
{BuildMaps::Target::ConfiguredTarget{
- BuildMaps::Base::EntityName{"", "result", "runfiles entry"},
- empty_config}},
+ .target =
+ BuildMaps::Base::EntityName{
+ "", "result", "runfiles entry"},
+ .config = empty_config}},
[&result](auto values) { result = *values[0]; },
[&error, &error_msg](std::string const& msg, bool /*unused*/) {
error = true;
@@ -861,8 +889,9 @@ TEST_CASE("RESULT error reporting") {
target_map.ConsumeAfterKeysReady(
&ts,
{BuildMaps::Target::ConfiguredTarget{
- BuildMaps::Base::EntityName{"", "result", "provides"},
- empty_config}},
+ .target =
+ BuildMaps::Base::EntityName{"", "result", "provides"},
+ .config = empty_config}},
[&result](auto values) { result = *values[0]; },
[&error, &error_msg](std::string const& msg, bool /*unused*/) {
error = true;
@@ -902,9 +931,10 @@ TEST_CASE("wrong arguments") {
target_map.ConsumeAfterKeysReady(
&ts,
{BuildMaps::Target::ConfiguredTarget{
- BuildMaps::Base::EntityName{
- "", "bad_targets", "string field"},
- empty_config}},
+ .target =
+ BuildMaps::Base::EntityName{
+ "", "bad_targets", "string field"},
+ .config = empty_config}},
[&result](auto values) { result = *values[0]; },
[&error, &error_msg](std::string const& msg, bool /*unused*/) {
error = true;
@@ -924,9 +954,10 @@ TEST_CASE("wrong arguments") {
target_map.ConsumeAfterKeysReady(
&ts,
{BuildMaps::Target::ConfiguredTarget{
- BuildMaps::Base::EntityName{
- "", "bad_targets", "string field 2"},
- empty_config}},
+ .target =
+ BuildMaps::Base::EntityName{
+ "", "bad_targets", "string field 2"},
+ .config = empty_config}},
[&result](auto values) { result = *values[0]; },
[&error, &error_msg](std::string const& msg, bool /*unused*/) {
error = true;
@@ -946,9 +977,10 @@ TEST_CASE("wrong arguments") {
target_map.ConsumeAfterKeysReady(
&ts,
{BuildMaps::Target::ConfiguredTarget{
- BuildMaps::Base::EntityName{
- "", "bad_targets", "config field"},
- empty_config}},
+ .target =
+ BuildMaps::Base::EntityName{
+ "", "bad_targets", "config field"},
+ .config = empty_config}},
[&result](auto values) { result = *values[0]; },
[&error, &error_msg](std::string const& msg, bool /*unused*/) {
error = true;
diff --git a/test/buildtool/execution_engine/executor/executor.test.cpp b/test/buildtool/execution_engine/executor/executor.test.cpp
index 6793014b..1f0312f7 100644
--- a/test/buildtool/execution_engine/executor/executor.test.cpp
+++ b/test/buildtool/execution_engine/executor/executor.test.cpp
@@ -80,8 +80,8 @@ class TestResponse : public IExecutionResponse {
artifacts.emplace(
path,
Artifact::ObjectInfo{
- ArtifactDigest{path, 0, /*is_tree=*/false},
- ObjectType::File});
+ .digest = ArtifactDigest{path, 0, /*is_tree=*/false},
+ .type = ObjectType::File});
} catch (...) {
return {};
}
diff --git a/test/other_tools/git_operations/critical_git_ops.test.cpp b/test/other_tools/git_operations/critical_git_ops.test.cpp
index a104a9cd..6a78e577 100644
--- a/test/other_tools/git_operations/critical_git_ops.test.cpp
+++ b/test/other_tools/git_operations/critical_git_ops.test.cpp
@@ -152,42 +152,47 @@ TEST_CASE("Critical git operations", "[critical_git_op_map]") {
TaskSystem ts;
crit_op_map.ConsumeAfterKeysReady(
&ts,
- {GitOpKey{GitOpParams{
- path_init_commit, // target_path
- "", // git_hash
- "", // branch
- "Init commit" // message
- },
- GitOpType::INITIAL_COMMIT},
- GitOpKey{GitOpParams{
- path_init_bare, // target_path
- "", // git_hash
- "", // branch
- std::nullopt, // message
- true // init_bare
- },
- GitOpType::ENSURE_INIT},
- GitOpKey{GitOpParams{
- path_init_non_bare, // target_path
- "", // git_hash
- "", // branch
- std::nullopt, // message
- false // init_bare
- },
- GitOpType::ENSURE_INIT},
- GitOpKey{GitOpParams{
- *path_keep_tag, // target_path
- kRootCommit, // git_hash
- "", // branch
- "keep-me" // message
- },
- GitOpType::KEEP_TAG},
- GitOpKey{GitOpParams{
- *path_get_head_id, // target_path
- "", // git_hash
- "", // branch
- },
- GitOpType::GET_HEAD_ID}},
+ {GitOpKey{.params =
+ {
+ path_init_commit, // target_path
+ "", // git_hash
+ "", // branch
+ "Init commit" // message
+ },
+ .op_type = GitOpType::INITIAL_COMMIT},
+ GitOpKey{.params =
+ {
+ path_init_bare, // target_path
+ "", // git_hash
+ "", // branch
+ std::nullopt, // message
+ true // init_bare
+ },
+ .op_type = GitOpType::ENSURE_INIT},
+ GitOpKey{.params =
+ {
+ path_init_non_bare, // target_path
+ "", // git_hash
+ "", // branch
+ std::nullopt, // message
+ false // init_bare
+ },
+ .op_type = GitOpType::ENSURE_INIT},
+ GitOpKey{.params =
+ {
+ *path_keep_tag, // target_path
+ kRootCommit, // git_hash
+ "", // branch
+ "keep-me" // message
+ },
+ .op_type = GitOpType::KEEP_TAG},
+ GitOpKey{.params =
+ {
+ *path_get_head_id, // target_path
+ "", // git_hash
+ "", // branch
+ },
+ .op_type = GitOpType::GET_HEAD_ID}},
[&ops_all, &ops_with_result](auto const& values) {
// check operations
for (size_t const& i : ops_all) {