Add exec platform and properties to verbose_explanation

I was puzzled why a certain build was being rebuilt from scratch when I targeted a remote build system, even though the build had been completed in the local cache. Running

 bazel build //path/to/my/build --explain=explain.txt --verbose_explanations

showed the exact same output for remote and local.

Turns out, the execution platform and properties contribute to the action cache key. However, if these are not shown in the verbose explain output, this is not clear.

By printing this out, it should be more apparent why the action cache key miss occurs.

PiperOrigin-RevId: 478027092
Change-Id: Ie66e339b9b3a618defc2ad869f6bffa175e7f0e2
diff --git a/src/main/java/com/google/devtools/build/lib/actions/ActionCacheChecker.java b/src/main/java/com/google/devtools/build/lib/actions/ActionCacheChecker.java
index 338b0be..77ac27b 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/ActionCacheChecker.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/ActionCacheChecker.java
@@ -220,12 +220,25 @@
     if (handler != null) {
       if (cacheConfig.verboseExplanations()) {
         String keyDescription = action.describeKey();
+        String execPlatform =
+            action.getExecutionPlatform() == null
+                ? "<null>"
+                : action.getExecutionPlatform().toString();
+        String execProps = action.getExecProperties().toString();
         reportRebuild(
             handler,
             action,
             keyDescription == null
                 ? "action command has changed"
-                : "action command has changed.\nNew action: " + keyDescription);
+                : "action command has changed.\n"
+                    + "New action: "
+                    + keyDescription // keyDescription ends with newline already.
+                    + "    Platform: "
+                    + execPlatform
+                    + "\n"
+                    + "    Exec Properties: "
+                    + execProps
+                    + "\n");
       } else {
         reportRebuild(
             handler,