/** * Sets or replaces all elements for {@link ModuleConfiguration#getProtoFiles() protoFiles} list. * @param elements An iterable of protoFiles elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder protoFiles(Iterable<String> elements) { this.protoFiles = ImmutableList.builder(); return addAllProtoFiles(elements); }
@Override public void execute() throws MojoExecutionException, MojoFailureException { super.execute(); ProtostuffCompiler compiler = new ProtostuffCompiler(); final Path sourcePath = getSourcePath(); String output = computeSourceOutputDir(target); Set<String> allTemplates = new LinkedHashSet<>(); if (template != null) { allTemplates.add(template); } if (templates != null) { allTemplates.addAll(templates); } List<String> protoFiles = findProtoFiles(sourcePath); ModuleConfiguration moduleConfiguration = ImmutableModuleConfiguration.builder() .name("java") .includePaths(singletonList(sourcePath)) .generator(CompilerModule.ST4_COMPILER) .putOptions(CompilerModule.TEMPLATES_OPTION, allTemplates) .putOptions(CompilerModule.EXTENSIONS_OPTION, extensions) .output(output) .addAllProtoFiles(protoFiles) .build(); compiler.compile(moduleConfiguration); addGeneratedSourcesToProject(output); }
@Override public void execute() throws MojoExecutionException, MojoFailureException { super.execute(); ProtostuffCompiler compiler = new ProtostuffCompiler(); final Path sourcePath = getSourcePath(); List<String> protoFiles = findProtoFiles(sourcePath); ModuleConfiguration moduleConfiguration = ImmutableModuleConfiguration.builder() .name("html") .includePaths(singletonList(sourcePath)) .generator(CompilerModule.HTML_COMPILER) .output(target.getAbsolutePath()) .putOptions(HtmlGenerator.PAGES, pages) .addAllProtoFiles(protoFiles) .build(); compiler.compile(moduleConfiguration); }
/** * Fill a builder with attribute values from the provided {@code ModuleConfiguration} instance. * Regular attribute values will be replaced with those from the given instance. * Absent optional values will not replace present values. * Collection elements and entries will be added, not replaced. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder from(ModuleConfiguration instance) { Preconditions.checkNotNull(instance, "instance"); name(instance.getName()); addAllIncludePaths(instance.getIncludePaths()); addAllProtoFiles(instance.getProtoFiles()); generator(instance.getGenerator()); output(instance.getOutput()); putAllOptions(instance.getOptions()); return this; }