Update the openwire generator so it can cope with the new module layout and separation of openwire marsahaler tests in activemq-core from the actual marshaler code in activemq-client

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1410119 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy A. Bish 2012-11-16 00:06:02 +00:00
parent daae3e6530
commit b928ccbf47
3 changed files with 37 additions and 7 deletions

View File

@ -265,7 +265,7 @@
<tasks>
<echo>Running OpenWire Generator</echo>
<taskdef name="generate" classname="org.apache.activemq.openwire.tool.JavaGeneratorTask" classpathref="maven.compile.classpath" />
<generate version="9" basedir="${basedir}" />
<generate version="9" basedir="${basedir}" generateTests="false"/>
</tasks>
</configuration>
</plugin>

View File

@ -1122,7 +1122,7 @@
<tasks>
<echo>Running OpenWire Generator</echo>
<taskdef name="generate" classname="org.apache.activemq.openwire.tool.JavaGeneratorTask" classpathref="maven.compile.classpath" />
<generate version="9" basedir="${basedir}" />
<generate version="9" outputdir="${basedir}" basedir="${basedir}/../activemq-client" generateMarshalers="false"/>
</tasks>
</configuration>
<goals>

View File

@ -26,12 +26,15 @@ import org.codehaus.jam.JamServiceFactory;
import org.codehaus.jam.JamServiceParams;
/**
*
*
*/
public class JavaGeneratorTask extends Task {
int version = 2;
File basedir = new File(".");
File outputdir = null;
boolean generateMarshalers = true;
boolean generateTests = true;
public static void main(String[] args) {
@ -51,6 +54,7 @@ public class JavaGeneratorTask extends Task {
generator.execute();
}
@Override
public void execute() throws BuildException {
try {
@ -66,17 +70,20 @@ public class JavaGeneratorTask extends Task {
params.includeSourcePattern(dirs, "**/*.java");
JamService jam = jamServiceFactory.createService(params);
{
File outputBase = outputdir != null ? outputdir : basedir;
if (generateMarshalers) {
JavaMarshallingGenerator script = new JavaMarshallingGenerator();
script.setJam(jam);
script.setTargetDir(basedir + "/src/main/java");
script.setTargetDir(outputBase + "/src/main/java");
script.setOpenwireVersion(version);
script.run();
}
{
if (generateTests) {
JavaTestsGenerator script = new JavaTestsGenerator();
script.setJam(jam);
script.setTargetDir(basedir + "/src/test/java");
script.setTargetDir(outputBase + "/src/test/java");
script.setOpenwireVersion(version);
script.run();
}
@ -102,4 +109,27 @@ public class JavaGeneratorTask extends Task {
this.basedir = basedir;
}
public File getOutputdir() {
return outputdir;
}
public void setOutputdir(File outputdir) {
this.outputdir = outputdir;
}
public boolean isGenerateMarshalers() {
return generateMarshalers;
}
public void setGenerateMarshalers(boolean generateMarshalers) {
this.generateMarshalers = generateMarshalers;
}
public boolean isGenerateTests() {
return generateTests;
}
public void setGenerateTests(boolean generateTests) {
this.generateTests = generateTests;
}
}