BuilderMessage (final BuilderMessage.BuildEvent.Type type, @Nullable String description, final @Nullable BuilderMessage.BuildEvent.Status status, @Nullable Collection<? extends Pair<String, String>> generatedPaths, final @Nullable BuilderMessage.BuildEvent.CustomBuilderMessage builderMessage) { final BuilderMessage.BuildEvent.Builder builder = BuilderMessage.BuildEvent.newBuilder().setEventType(type); if (description != null) { builder.setDescription(description); } if (status != null) { builder.setCompletionStatus(status); } if (generatedPaths != null) { for (Pair<String, String> pair : generatedPaths) { final BuilderMessage.BuildEvent.GeneratedFile.Builder fileBuilder = BuilderMessage.BuildEvent.GeneratedFile.newBuilder(); final BuilderMessage.BuildEvent.GeneratedFile generatedFile = fileBuilder.setOutputRoot(pair.first).setRelativePath(pair.second).build(); builder.addGeneratedFiles(generatedFile); } } if (builderMessage != null) { builder.setCustomBuilderMessage(builderMessage); } return BuilderMessage.newBuilder().setType(BuilderMessage.Type.BUILD_EVENT).setBuildEvent(builder.build()).build(); }