Include the configuration checksum when listing incompatible target
dependencies.

PiperOrigin-RevId: 455186220
Change-Id: I415202a4a1910a82c8ebef4a18ff797d09b95f9b
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/constraints/TopLevelConstraintSemantics.java b/src/main/java/com/google/devtools/build/lib/analysis/constraints/TopLevelConstraintSemantics.java
index b2a626c..3ceef10 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/constraints/TopLevelConstraintSemantics.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/constraints/TopLevelConstraintSemantics.java
@@ -302,7 +302,10 @@
     // TODO(austinschuh): While the first eror is helpful, reporting all the errors at once would
     // save the user bazel round trips.
     while (target != null) {
-      message += "\n    " + target.getLabel();
+      message +=
+          String.format(
+              "\n    %s (%s)",
+              target.getLabel(), target.getConfigurationChecksum().substring(0, 6));
       provider = target.get(IncompatiblePlatformProvider.PROVIDER);
       ImmutableList<ConfiguredTarget> targetList = provider.targetsResponsibleForIncompatibility();
       if (targetList == null) {
diff --git a/src/test/shell/integration/target_compatible_with_test.sh b/src/test/shell/integration/target_compatible_with_test.sh
index ba12b11..e2bf1d1 100755
--- a/src/test/shell/integration/target_compatible_with_test.sh
+++ b/src/test/shell/integration/target_compatible_with_test.sh
@@ -636,8 +636,8 @@
 
   # Validate that we get the dependency chain printed out.
   expect_log '^Dependency chain:$'
-  expect_log '^    //target_skipping:generate_with_tool$'
-  expect_log "^    //target_skipping:generator_tool   <-- target platform (//target_skipping:foo2_bar1_platform) didn't satisfy constraint //target_skipping:foo1"
+  expect_log '^    //target_skipping:generate_with_tool (.*)$'
+  expect_log "^    //target_skipping:generator_tool (.*)   <-- target platform (//target_skipping:foo2_bar1_platform) didn't satisfy constraint //target_skipping:foo1"
   expect_log 'FAILED: Build did NOT complete successfully'
 
   # Validate the test.
@@ -650,9 +650,9 @@
 
   # Validate that we get the dependency chain printed out.
   expect_log '^Dependency chain:$'
-  expect_log '^    //target_skipping:generated_test$'
-  expect_log '^    //target_skipping:generate_with_tool$'
-  expect_log "^    //target_skipping:generator_tool   <-- target platform (//target_skipping:foo2_bar1_platform) didn't satisfy constraint //target_skipping:foo1"
+  expect_log '^    //target_skipping:generated_test (.*)$'
+  expect_log '^    //target_skipping:generate_with_tool (.*)$'
+  expect_log "^    //target_skipping:generator_tool (.*)   <-- target platform (//target_skipping:foo2_bar1_platform) didn't satisfy constraint //target_skipping:foo1"
   expect_log 'FAILED: Build did NOT complete successfully'
 }
 
@@ -698,9 +698,9 @@
 
   # Validate that we get the dependency chain and constraints printed out.
   expect_log '^Dependency chain:$'
-  expect_log '^    //target_skipping:generated_test$'
-  expect_log '^    //target_skipping:generate_with_tool$'
-  expect_log "^    //target_skipping:generator_tool   <-- target platform (//target_skipping:foo2_bar1_platform) didn't satisfy constraints \[//target_skipping:foo1, //target_skipping:bar2\]"
+  expect_log '^    //target_skipping:generated_test (.*)$'
+  expect_log '^    //target_skipping:generate_with_tool (.*)$'
+  expect_log "^    //target_skipping:generator_tool (.*)   <-- target platform (//target_skipping:foo2_bar1_platform) didn't satisfy constraints \[//target_skipping:foo1, //target_skipping:bar2\]"
   expect_log 'FAILED: Build did NOT complete successfully'
 }