Support mapping of Paths to URIs

Bazel-created files (like log files of test runs) are internally reported
as Paths. However, this is not always the most useful representation of the
location of that artifact for a consumer of build events. Therefore, support
a mapping of paths to more useful URIs.

--
PiperOrigin-RevId: 144843525
MOS_MIGRATED_REVID=144843525
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java b/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java
index 434d099..07b4908 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java
@@ -30,6 +30,7 @@
 import com.google.devtools.build.lib.analysis.config.BinTools;
 import com.google.devtools.build.lib.analysis.config.BuildOptions;
 import com.google.devtools.build.lib.analysis.config.ConfigurationFactory;
+import com.google.devtools.build.lib.buildeventstream.PathConverter;
 import com.google.devtools.build.lib.events.Event;
 import com.google.devtools.build.lib.events.OutputFilter;
 import com.google.devtools.build.lib.flags.CommandNameCache;
@@ -143,6 +144,7 @@
   private final String defaultsPackageContent;
   private final SubscriberExceptionHandler eventBusExceptionHandler;
   private final String productName;
+  private final PathConverter pathToUriConverter;
 
   // Workspace state (currently exactly one workspace per server)
   private BlazeWorkspace workspace;
@@ -163,7 +165,8 @@
       ProjectFile.Provider projectFileProvider,
       InvocationPolicy invocationPolicy,
       Iterable<BlazeCommand> commands,
-      String productName) {
+      String productName,
+      PathConverter pathToUriConverter) {
     // Server state
     this.blazeModules = blazeModules;
     overrideCommands(commands);
@@ -188,6 +191,7 @@
     CommandNameCache.CommandNameCacheInstance.INSTANCE.setCommandNameCache(
         new CommandNameCacheImpl(getCommandMap()));
     this.productName = productName;
+    this.pathToUriConverter = pathToUriConverter;
   }
 
   public void initWorkspace(BlazeDirectories directories, BinTools binTools)
@@ -1067,6 +1071,10 @@
     return productName;
   }
 
+  public PathConverter getPathToUriConverter() {
+    return pathToUriConverter;
+  }
+
   /**
    * A builder for {@link BlazeRuntime} objects. The only required fields are the {@link
    * BlazeDirectories}, and the {@link RuleClassProvider} (except for testing). All other fields
@@ -1167,7 +1175,8 @@
           projectFileProvider,
           serverBuilder.getInvocationPolicy(),
           serverBuilder.getCommands(),
-          productName);
+          productName,
+          serverBuilder.getPathToUriConverter());
     }
 
     public Builder setProductName(String productName) {