diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-04-12 16:03:03 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-04-12 18:09:38 +0200 |
commit | 989cde7dc99e4ce789b1520cd622a8049d6b85f9 (patch) | |
tree | 580958e270519c2d1a153955653795da9a501226 | |
parent | e7458ab863ea9b1b2e6a9b874e5fdd1dd7262c22 (diff) | |
download | justbuild-989cde7dc99e4ce789b1520cd622a8049d6b85f9.tar.gz |
Target analysis: report short names of targets when describing a conflict
Configured targets, by design, cannot distinguish between a value
not occuring in the configuration and occuring there with value
null. Therefore, to understand the conflict, we can as well drop
all the null values of the target configuration when reporting it.
-rw-r--r-- | src/buildtool/build_engine/target_map/target_map.cpp | 2 | ||||
-rwxr-xr-x | test/end-to-end/cli/conflict-report.sh | 30 |
2 files changed, 31 insertions, 1 deletions
diff --git a/src/buildtool/build_engine/target_map/target_map.cpp b/src/buildtool/build_engine/target_map/target_map.cpp index 3a3dd5ee..1d169c05 100644 --- a/src/buildtool/build_engine/target_map/target_map.cpp +++ b/src/buildtool/build_engine/target_map/target_map.cpp @@ -226,7 +226,7 @@ auto NameTransitionedDeps( auto conf = effective_conf.Update(transitioned_target.config.Expr()) .Prune(analysis->Vars()); return BuildMaps::Target::ConfiguredTarget{transitioned_target.target, conf} - .ToString(); + .ToShortString(); } // Check if an object is contained an expression; to avoid tree-unfolding diff --git a/test/end-to-end/cli/conflict-report.sh b/test/end-to-end/cli/conflict-report.sh index 0e605402..1e5755af 100755 --- a/test/end-to-end/cli/conflict-report.sh +++ b/test/end-to-end/cli/conflict-report.sh @@ -129,6 +129,14 @@ cat > TARGETS <<'EOF' , "another provided world" ] } +, "rule-conflict-in-config": + { "type": "provide" + , "deps": ["world", "unrelated", "universe", "greeting.txt"] + } +, "simple-rule-conflict-in-config": + { "type": "provide" + , "deps": ["unrelated", "universe", "greeting.txt"] + } } EOF @@ -164,5 +172,27 @@ grep '\["@","","","another provided world"\]' log grep '\["@","","","provided universe"\]' log grep '\["@","","","provided unrelated"\]' log && exit 1 || : +# Also verify that the non-null part of the effective configuration is +# reported. +"${JUST}" build --local-build-root "${LBR}" rule-conflict-in-config \ + -f log --log-limit 0 2>&1 -D '{"FOO": "bar", "NAME": "World"}' \ + && exit 1 || : +echo +grep -F '[["@","","","world"],{}]' log +grep -F '[["@","","","universe"],{}]' log +grep -F '[["@","","","greeting.txt"],{"NAME":"World"}]' log +grep -F '["@","","","unrelated"]' log && exit 1 || : +echo echo + +"${JUST}" build --local-build-root "${LBR}" simple-rule-conflict-in-config \ + -f log --log-limit 0 2>&1 -D '{"FOO": "bar", "NAME": null}' \ + && exit 1 || : +echo +grep -F '[["@","","","universe"],{}]' log +grep -F '[["@","","","greeting.txt"],{}]' log +grep -F '["@","","","unrelated"]' log && exit 1 || : +echo +echo + echo OK |