use of org.talend.sdk.component.starter.server.Versions.CXF in project component-runtime by Talend.
the class GradleBuildGenerator method createBuild.
@Override
public Build createBuild(final ProjectRequest.BuildConfiguration buildConfiguration, final String packageBase, final Collection<Dependency> dependencies, final Collection<String> facets) {
final Set<String> buildDependencies = new TreeSet<>();
final List<String> configurations = new ArrayList<>();
final Set<String> plugins = new TreeSet<>();
final List<String> tasks = new ArrayList<>();
final Set<String> imports = new TreeSet<>();
final Set<String> javaMainSourceSets = new TreeSet<>();
if (facets.contains(WADLFacet.Constants.NAME)) {
buildDependencies.add("org.apache.cxf:cxf-tools-wadlto-jaxrs:" + CXF);
imports.add("org.apache.cxf.tools.common.ToolContext");
imports.add("org.apache.cxf.tools.wadlto.WADLToJava");
tasks.add("def wadlGeneratedFolder = \"$buildDir/generated-sources/cxf\"\n" + "task generateWadlClient {\n" + " def wadl = \"$projectDir/src/main/resources/wadl/client.xml\"\n" + "\n" + " inputs.file(wadl)\n" + " outputs.dir(wadlGeneratedFolder)\n" + "\n" + " doLast {\n" + " new File(wadlGeneratedFolder).mkdirs()\n" + "\n" + " new WADLToJava([\n" + " \"-d\", wadlGeneratedFolder,\n" + " \"-p\", \"com.application.client.wadl\",\n" + " wadl\n" + " ] as String[]).run(new ToolContext())\n" + " }\n" + "}");
javaMainSourceSets.add("srcDir wadlGeneratedFolder");
javaMainSourceSets.add("project.tasks.compileJava.dependsOn project.tasks.generateWadlClient");
}
final GradleBuild model = new GradleBuild(Versions.KIT, buildConfiguration, dependencies.stream().map(d -> "test".equals(d.getScope()) ? new Dependency(d, "testCompile") : d).map(d -> "runtime".equals(d.getScope()) ? new Dependency(d, "compile") : d).collect(toList()), buildDependencies, configurations, plugins, tasks, imports, javaMainSourceSets);
return new Build(buildConfiguration.getArtifact(), buildConfiguration.getGroup(), buildConfiguration.getVersion(), "src/main/java", "src/test/java", "src/main/resources", "src/test/resources", "src/main/webapp", "build.gradle", tpl.render("generator/gradle/build.mustache", model), "build", generateWrapperFiles());
}
Aggregations