From c475f5a7140bf7619084013a6ef599abbc50120d Mon Sep 17 00:00:00 2001 From: nash Date: Thu, 23 Sep 2010 18:18:26 +0000 Subject: TUSCANY-3684: Provide additional configuration options for tuscany-maven-ant-generator git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1000563 13f79535-47bb-0310-9956-ffa450edef68 --- .../ant/generator/plugin/AntGeneratorMojo.java | 89 ++++++++++++++++++++++ .../sca/tools/ant/generator/plugin/JarFile.java | 46 +++++++++++ 2 files changed, 135 insertions(+) create mode 100644 sca-java-1.x/branches/sca-java-1.6.1/tools/maven/maven-ant-generator/src/main/java/org/apache/tuscany/sca/tools/ant/generator/plugin/JarFile.java (limited to 'sca-java-1.x/branches/sca-java-1.6.1') diff --git a/sca-java-1.x/branches/sca-java-1.6.1/tools/maven/maven-ant-generator/src/main/java/org/apache/tuscany/sca/tools/ant/generator/plugin/AntGeneratorMojo.java b/sca-java-1.x/branches/sca-java-1.6.1/tools/maven/maven-ant-generator/src/main/java/org/apache/tuscany/sca/tools/ant/generator/plugin/AntGeneratorMojo.java index 54ac6c7481..de1201ea2d 100644 --- a/sca-java-1.x/branches/sca-java-1.6.1/tools/maven/maven-ant-generator/src/main/java/org/apache/tuscany/sca/tools/ant/generator/plugin/AntGeneratorMojo.java +++ b/sca-java-1.x/branches/sca-java-1.6.1/tools/maven/maven-ant-generator/src/main/java/org/apache/tuscany/sca/tools/ant/generator/plugin/AntGeneratorMojo.java @@ -132,6 +132,24 @@ public class AntGeneratorMojo extends AbstractMojo { * @parameter expression="../.." */ private String pathToRootDir; + + /** + * Additional run targets and corresponding class names + * @parameter + */ + private Map runTargets; + + /** + * Set this to true if test source needs to be compiled + * @parameter + */ + private boolean testSource; + + /** + * Additional jar files to be produced + * @parameter + */ + private List jarFiles; public void execute() throws MojoExecutionException { if ((buildDependencyFileOnly != null) && @@ -236,6 +254,46 @@ public class AntGeneratorMojo extends AbstractMojo { } pw.println(" "); + // Compile test source using code cut and pasted from above + if (testSource) { + pw.println(" "); + pw.println(" "); + for (String source: (List)project.getTestCompileSourceRoots()) { + if (source.length() > base) { + source = source.substring(base); + } else { + source = "."; + } + pw.println(" "); + } + pw.println(" "); + pw.println(" "); + pw.println(" "); + pw.println(" "); + pw.println(" "); + pw.println(" "); + pw.println(" "); + for (FileSet resource: (List)project.getTestResources()) { + String source = resource.getDirectory(); + if (source.length() > base) { + source = source.substring(base); + + if (source.equals(".")){ + pw.println(" "); + } else { + pw.println(" "); + } + } else { + if (project.getTestResources().size() > 1) { + break; + } + pw.println(" "); + source = "."; + } + } + pw.println(" "); + } + // Build a JAR if (packaging.equals("jar")) { pw.println(" "); @@ -256,6 +314,21 @@ public class AntGeneratorMojo extends AbstractMojo { pw.println(" "); pw.println(" "); } + + // Build additional JARs + if (jarFiles != null) { + for (JarFile jarFile: jarFiles) { + pw.println(" "); + if (jarFile.getFilesets() != null) { + for (String fileset: jarFile.getFilesets()) { + pw.println(" "); + } + } + pw.println(" "); + } + } + + // Finish the compile target pw.println(" "); pw.println(); @@ -278,6 +351,22 @@ public class AntGeneratorMojo extends AbstractMojo { pw.println(" "); pw.println(); } + + // Generate other run targets + if (runTargets != null) { + for (Map.Entry element: runTargets.entrySet()) { + pw.println(" "); + pw.println(" "); + pw.println(" "); + pw.println(" "); + pw.println(" "); + pw.println(" "); + pw.println(" "); + pw.println(" "); + pw.println(" "); + pw.println(); + } + } // Generate the clean target pw.println(" "); diff --git a/sca-java-1.x/branches/sca-java-1.6.1/tools/maven/maven-ant-generator/src/main/java/org/apache/tuscany/sca/tools/ant/generator/plugin/JarFile.java b/sca-java-1.x/branches/sca-java-1.6.1/tools/maven/maven-ant-generator/src/main/java/org/apache/tuscany/sca/tools/ant/generator/plugin/JarFile.java new file mode 100644 index 0000000000..3d8bc581cb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.6.1/tools/maven/maven-ant-generator/src/main/java/org/apache/tuscany/sca/tools/ant/generator/plugin/JarFile.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.tools.ant.generator.plugin; + +import java.util.List; + +public class JarFile { + + /** + * The destfile attribute of the generated task + * + * @parameter + */ + private String destfile; + + /** + * The filesets to be included in the generated task + * + * @parameter + */ + private List filesets; + + public String getDestfile() { + return destfile; + } + + public List getFilesets() { + return filesets; + } +} -- cgit v1.2.3