Search in sources :

Example 1 with CXF

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());
}
Also used : FacetGenerator(org.talend.sdk.component.starter.server.service.facet.FacetGenerator) Build(org.talend.sdk.component.starter.server.service.domain.Build) Versions(org.talend.sdk.component.starter.server.Versions) GeneratorRegistration(org.talend.sdk.component.starter.server.service.event.GeneratorRegistration) WADLFacet(org.talend.sdk.component.starter.server.service.facet.wadl.WADLFacet) Collection(java.util.Collection) Set(java.util.Set) TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) CXF(org.talend.sdk.component.starter.server.Versions.CXF) Inject(javax.inject.Inject) Collectors.toList(java.util.stream.Collectors.toList) List(java.util.List) Resources(org.talend.sdk.component.starter.server.service.Resources) Arrays.asList(java.util.Arrays.asList) Observes(javax.enterprise.event.Observes) TemplateRenderer(org.talend.sdk.component.starter.server.service.template.TemplateRenderer) Data(lombok.Data) ApplicationScoped(javax.enterprise.context.ApplicationScoped) Dependency(org.talend.sdk.component.starter.server.service.domain.Dependency) ProjectRequest(org.talend.sdk.component.starter.server.service.domain.ProjectRequest) TreeSet(java.util.TreeSet) Build(org.talend.sdk.component.starter.server.service.domain.Build) ArrayList(java.util.ArrayList) Dependency(org.talend.sdk.component.starter.server.service.domain.Dependency)

Aggregations

ArrayList (java.util.ArrayList)1 Arrays.asList (java.util.Arrays.asList)1 Collection (java.util.Collection)1 List (java.util.List)1 Set (java.util.Set)1 TreeSet (java.util.TreeSet)1 Collectors.toList (java.util.stream.Collectors.toList)1 ApplicationScoped (javax.enterprise.context.ApplicationScoped)1 Observes (javax.enterprise.event.Observes)1 Inject (javax.inject.Inject)1 Data (lombok.Data)1 Versions (org.talend.sdk.component.starter.server.Versions)1 CXF (org.talend.sdk.component.starter.server.Versions.CXF)1 Resources (org.talend.sdk.component.starter.server.service.Resources)1 Build (org.talend.sdk.component.starter.server.service.domain.Build)1 Dependency (org.talend.sdk.component.starter.server.service.domain.Dependency)1 ProjectRequest (org.talend.sdk.component.starter.server.service.domain.ProjectRequest)1 GeneratorRegistration (org.talend.sdk.component.starter.server.service.event.GeneratorRegistration)1 FacetGenerator (org.talend.sdk.component.starter.server.service.facet.FacetGenerator)1 WADLFacet (org.talend.sdk.component.starter.server.service.facet.wadl.WADLFacet)1