use of com.google.devtools.build.lib.buildeventstream.PathConverter in project bazel by bazelbuild.
the class BuildEventStreamerModule method tryCreateStreamer.
@VisibleForTesting
Optional<BuildEventStreamer> tryCreateStreamer(OptionsProvider optionsProvider, ModuleEnvironment moduleEnvironment) {
try {
PathConverter pathConverter;
if (commandEnvironment == null) {
pathConverter = new PathConverter() {
@Override
public String apply(Path path) {
return path.getPathString();
}
};
} else {
pathConverter = commandEnvironment.getRuntime().getPathToUriConverter();
}
BuildEventStreamOptions besOptions = checkNotNull(optionsProvider.getOptions(BuildEventStreamOptions.class), "Could not get BuildEventStreamOptions");
ImmutableSet<BuildEventTransport> buildEventTransports = createFromOptions(besOptions, pathConverter);
if (!buildEventTransports.isEmpty()) {
BuildEventStreamer streamer = new BuildEventStreamer(buildEventTransports);
return Optional.of(streamer);
}
} catch (IOException e) {
moduleEnvironment.exit(new AbruptExitException(ExitCode.LOCAL_ENVIRONMENTAL_ERROR, e));
}
return Optional.absent();
}
Aggregations