Remove injected metadata before rewriting the `.jdeps` file.

`JavaCompileAction` rewrites the `.jdeps` files after running the spawn. In case of an executor which uses the [`MetadataInjector::injectFile`](https://github.com/bazelbuild/bazel/blob/5be114a2e4fb928a98f44327135c1046f361980b/src/main/java/com/google/devtools/build/lib/actions/cache/MetadataInjector.java#L35), the output store would already have the metadata. Consequently, when constructing the `ActionExecutionValue`, we would [pick up the metadata](https://github.com/bazelbuild/bazel/blob/5be114a2e4fb928a98f44327135c1046f361980b/src/main/java/com/google/devtools/build/lib/skyframe/ActionMetadataHandler.java#L275-L278) for the `.jdeps` file as it came from the execution as opposed to after the rewrite.

One of the consequences of this is that when we rewrite the file with identical value, the `mtime` for the output would change. Consequently, `FilesystemValueChecker` deems the file as potentially modified and marks the corresponding action as dirty.

Remove the output store entry for the `.jdeps` file before rewriting it to make sure we will not pick up a stale value.

PiperOrigin-RevId: 449845853
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java
index 4259e92..90c77d4 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java
@@ -78,7 +78,6 @@
 import com.google.devtools.build.lib.util.DetailedExitCode;
 import com.google.devtools.build.lib.util.Fingerprint;
 import com.google.devtools.build.lib.util.OnDemandString;
-import com.google.devtools.build.lib.vfs.FileSystemUtils;
 import com.google.devtools.build.lib.vfs.Path;
 import com.google.devtools.build.lib.vfs.PathFragment;
 import com.google.devtools.build.lib.view.proto.Deps;
@@ -716,8 +715,12 @@
     // this. Note that in-memory and filesystem outputs aren't necessarily mutually exclusive.
     Path fsPath = actionExecutionContext.getInputPath(outputDepsProto);
     if (fsPath.exists()) {
+      // Make sure to clear the output store cache if it has an entry from before the rewrite.
+      actionExecutionContext.getMetadataHandler().resetOutputs(ImmutableList.of(outputDepsProto));
       fsPath.setWritable(true);
-      FileSystemUtils.writeContent(fsPath, fullOutputDeps.toByteArray());
+      try (var outputStream = fsPath.getOutputStream()) {
+        fullOutputDeps.writeTo(outputStream);
+      }
     }
 
     return fullOutputDeps;