summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md3
-rw-r--r--src/buildtool/build_engine/target_map/built_in_rules.cpp16
2 files changed, 15 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 22581d9e..3c53b23a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -26,6 +26,9 @@ A feature release on top of `1.3.0`, backwards compatible.
### Fixes
+- The built-in rule `"generic"` now properly enforces that the
+ obtained outputs form a well-formed artifact stage; a conflicting
+ arrangement of artifacts was possilbe beforehand.
- A bug was fixed that cased `just serve` to fail with an internal
error when building against ignore-special roots.
- `just` now accurately reports internal errors that occurred on
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 51664549..94da5991 100644
--- a/src/buildtool/build_engine/target_map/built_in_rules.cpp
+++ b/src/buildtool/build_engine/target_map/built_in_rules.cpp
@@ -1387,13 +1387,21 @@ void GenericRuleWithDeps(
action_identifier, std::filesystem::path{path})});
}
}
+ auto artifacts_stage = ExpressionPtr{Expression::map_t{artifacts}};
+ auto artifacts_conflict =
+ BuildMaps::Target::Utils::tree_conflict(artifacts_stage);
+ if (artifacts_conflict) {
+ (*logger)(fmt::format("artifacts have staging conflicts on {}",
+ nlohmann::json(*artifacts_conflict).dump()),
+ /*fatal=*/true);
+ return;
+ }
auto const& empty_map = Expression::kEmptyMap;
auto result = std::make_shared<AnalysedTarget const>(
- TargetResult{
- .artifact_stage = ExpressionPtr{Expression::map_t{artifacts}},
- .provides = empty_map,
- .runfiles = empty_map},
+ TargetResult{.artifact_stage = std::move(artifacts_stage),
+ .provides = empty_map,
+ .runfiles = empty_map},
std::vector<ActionDescription::Ptr>{action},
std::vector<std::string>{},
std::move(trees),