ModuleConfiguration configuration = builder.build();
@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); }
@Override public void execute() throws MojoExecutionException, MojoFailureException { super.execute(); ProtostuffCompiler compiler = new ProtostuffCompiler(); final Path sourcePath = getSourcePath(); String output = computeSourceOutputDir(target); List<String> protoFiles = findProtoFiles(sourcePath); ModuleConfiguration moduleConfiguration = ImmutableModuleConfiguration.builder() .name("java") .includePaths(singletonList(sourcePath)) .generator("java") .output(output) .protoFiles(protoFiles) .build(); compiler.compile(moduleConfiguration); addGeneratedSourcesToProject(output); }
/** * Creates an immutable copy of a {@link ModuleConfiguration} value. * Uses accessors to get values to initialize the new immutable instance. * If an instance is already immutable, it is returned as is. * @param instance The instance to copy * @return A copied immutable ModuleConfiguration instance */ public static ImmutableModuleConfiguration copyOf(ModuleConfiguration instance) { if (instance instanceof ImmutableModuleConfiguration) { return (ImmutableModuleConfiguration) instance; } return ImmutableModuleConfiguration.builder() .from(instance) .build(); }