From 9e8067c946ddd7b9b2a347507af26a7beacd1165 Mon Sep 17 00:00:00 2001 From: Willem Cazander Date: Sun, 1 Sep 2013 15:18:11 +0200 Subject: [PATCH] Updated build config and profiles and added keyed error reporting for tasks. --- build.txt | 35 +++++--- pom.xml | 28 +++++- .../x4o/xml/eld/xsd/EldXsdLanguageTask.java | 2 +- .../x4o/xml/io/sax/ext/PropertyConfig.java | 6 +- .../lang/task/AbstractX4OLanguageTask.java | 30 +++++++ .../resources/META-INF/cel/cel-core-1.0.xsd | 33 ++++--- .../resources/META-INF/cel/cel-root-1.0.xsd | 27 +++--- .../resources/META-INF/eld/eld-conv-1.0.xsd | 27 +++--- .../resources/META-INF/eld/eld-lang-1.0.xsd | 39 ++++---- .../resources/META-INF/eld/eld-root-1.0.xsd | 27 +++--- .../x4o/xml/eld/doc/EldDocLanguageTask.java | 2 +- x4o-tool/x4o-tool-ant-plugin/pom.xml | 88 +++++++++++++------ x4o-tool/x4o-tool-maven-plugin/pom.xml | 74 ++-------------- .../maven/plugin/X4OLanguageTaskMojo.java | 14 +-- .../maven/plugin/X4OLanguageTaskMojoTest.java | 4 +- 15 files changed, 227 insertions(+), 209 deletions(-) diff --git a/build.txt b/build.txt index fd288d7..fdb56e8 100644 --- a/build.txt +++ b/build.txt @@ -19,15 +19,15 @@ mvn clean install; -- Update schemas in src -- --- note; rm after auto schema creation +-- note; only needed after change in eld or cel langauge. +-- note2; maybe rm/mv after auto schema creation cd project-root/; mvn clean install; -mvn -Pant-update-schema-cel package; -mvn -Pant-update-schema-eld package; -- Add the license as manual step in xsd files. (todo in ant task) +mvn -Px4o-update-schema-cel compile; +mvn -Px4o-update-schema-eld compile; -note: the do 'install' is because of circle plugins. +note: the do 'install' is (once) because of circle plugins. -- Run multi jvm test -- @@ -53,7 +53,7 @@ src/main/build/gnu-up.sh cd project-root/; mvn clean install; # (installs the snapshots plugins so we can run the current eld-doc task in site phase) -MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=128m" mvn -Pbuild-site-x4o-support clean package site site:stage; +MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=128m" mvn -Px4o-build-site-doc clean package site site:stage; cp -r target/staging/x4o-* target/site/; cp -r target/site/ ~/public_html/site-x4o; @@ -66,10 +66,10 @@ mvn checkstyle:checkstyle -- Check for licenses -- cd project-root/; -mvn -Pcheck-license license:check +mvn -Px4o-check-license license:check To update all files from check output; -mvn -Pcheck-license license:format +mvn -Px4o-check-license license:format -- Check for versions-updates -- @@ -78,10 +78,21 @@ mvn versions:display-plugin-updates; mvn versions:display-dependency-updates; --- Run x4o-plugin-maven from cmd -- +-- Run x4o task from cmd -- + +cd project-root/; +mvn clean compile; +cd x4o-driver; +mvn exec:java -Dexec.mainClass="org.x4o.xml.lang.task.X4OLanguageTaskCommandLine" -Dexec.args="-h" +mvn exec:java -Dexec.mainClass="org.x4o.xml.lang.task.X4OLanguageTaskCommandLine" -Dexec.args="-ll" +mvn exec:java -Dexec.mainClass="org.x4o.xml.lang.task.X4OLanguageTaskCommandLine" -Dexec.args="-llt" +mvn exec:java -Dexec.mainClass="org.x4o.xml.lang.task.X4OLanguageTaskCommandLine" -Dexec.args="-l eld -t eld-xsd -p http://language.x4o.org/xml/properties/eld-xsd/output/path=/tmp/test-task-cmd" + + +-- Run x4o-tool-maven-plugin from cmd -- cd project-root/; mvn clean install; -mvn org.x4o.plugin:x4o-plugin-maven:help -mvn org.x4o.plugin:x4o-plugin-maven:write-language-doc -DoutputDirectory=/tmp/doc1 -mvn org.x4o.plugin:x4o-plugin-maven:write-language-doc -DoutputDirectory=/tmp/doc2 -Dlanguages={eld=ALL,swixml=1.0-2.0} -Dverbose=true +mvn org.x4o.tool:x4o-tool-maven-plugin:help +mvn org.x4o.tool:x4o-tool-maven-plugin:x4o-language-task -Dverbose=true -DtaskId=eld-xsd -DlanguageName=cel -DtaskPropertyValues=http://x4o.org/properties/eld-xsd/output/path=/tmp/test-maven-cmd + diff --git a/pom.xml b/pom.xml index 61de594..04da51c 100644 --- a/pom.xml +++ b/pom.xml @@ -102,6 +102,13 @@ 6.0.20 2.1.0 + + + 3.0 + 3.2 + 2.0 + 3.0.1 + 3.2 @@ -339,25 +346,38 @@ - notest + x4o-test-none true + + + x4o-test-speed + + false + todo + - update-schema-cel + x4o-update-schema-cel true - update-schema-eld + x4o-update-schema-eld true - check-license + x4o-build-site-doc + + true + + + + x4o-check-license true diff --git a/x4o-driver/src/main/java/org/x4o/xml/eld/xsd/EldXsdLanguageTask.java b/x4o-driver/src/main/java/org/x4o/xml/eld/xsd/EldXsdLanguageTask.java index 323c51a..6dbac8c 100644 --- a/x4o-driver/src/main/java/org/x4o/xml/eld/xsd/EldXsdLanguageTask.java +++ b/x4o-driver/src/main/java/org/x4o/xml/eld/xsd/EldXsdLanguageTask.java @@ -50,7 +50,7 @@ public class EldXsdLanguageTask extends AbstractX4OLanguageTask { /** * Executes this language task. */ - public X4OLanguageTaskExecutor createTaskExecutor(final PropertyConfig config) { + protected X4OLanguageTaskExecutor createTaskExecutorChecked(final PropertyConfig config) { return new X4OLanguageTaskExecutor() { public void execute(X4OLanguage language) throws X4OLanguageTaskException { try { diff --git a/x4o-driver/src/main/java/org/x4o/xml/io/sax/ext/PropertyConfig.java b/x4o-driver/src/main/java/org/x4o/xml/io/sax/ext/PropertyConfig.java index 1c0b7a6..e84cbd3 100644 --- a/x4o-driver/src/main/java/org/x4o/xml/io/sax/ext/PropertyConfig.java +++ b/x4o-driver/src/main/java/org/x4o/xml/io/sax/ext/PropertyConfig.java @@ -211,15 +211,15 @@ public final class PropertyConfig implements Cloneable { return getPropertyKeysRequired().contains(key); } - public final Collection getPropertyKeysRequired() { + public final List getPropertyKeysRequired() { return findPropertyKeysRequired(false); } - public final Collection getPropertyKeysRequiredValues() { + public final List getPropertyKeysRequiredValues() { return findPropertyKeysRequired(true); } - private final Collection findPropertyKeysRequired(boolean checkValue) { + private final List findPropertyKeysRequired(boolean checkValue) { List result = new ArrayList(10); for (String key:getPropertyKeys()) { PropertyConfigItem item = getPropertyConfigItem(key); diff --git a/x4o-driver/src/main/java/org/x4o/xml/lang/task/AbstractX4OLanguageTask.java b/x4o-driver/src/main/java/org/x4o/xml/lang/task/AbstractX4OLanguageTask.java index 47273f0..8f40c28 100644 --- a/x4o-driver/src/main/java/org/x4o/xml/lang/task/AbstractX4OLanguageTask.java +++ b/x4o-driver/src/main/java/org/x4o/xml/lang/task/AbstractX4OLanguageTask.java @@ -22,6 +22,8 @@ */ package org.x4o.xml.lang.task; +import java.util.List; + import org.x4o.xml.io.sax.ext.PropertyConfig; /** @@ -48,6 +50,34 @@ public abstract class AbstractX4OLanguageTask implements X4OLanguageTask { this.propertyConfig=propertyConfig; } + protected abstract X4OLanguageTaskExecutor createTaskExecutorChecked(PropertyConfig config); + + /** + * @see org.x4o.xml.lang.task.X4OLanguageTask#createTaskExecutor(org.x4o.xml.io.sax.ext.PropertyConfig) + */ + public X4OLanguageTaskExecutor createTaskExecutor(PropertyConfig config) { + return createTaskExecutorChecked(checkConfig(config)); + } + + private PropertyConfig checkConfig(PropertyConfig config) { + List keys = config.getPropertyKeysRequiredValues(); + if (keys.isEmpty()) { + return config; + } + StringBuffer buf = new StringBuffer(100); + buf.append("Error missing value(s) for key(s) {"); + for (int i=0;i - - - - - - - + + + + @@ -49,9 +46,9 @@ + - @@ -75,12 +72,12 @@ + - @@ -108,10 +105,10 @@ + - diff --git a/x4o-driver/src/main/resources/META-INF/cel/cel-root-1.0.xsd b/x4o-driver/src/main/resources/META-INF/cel/cel-root-1.0.xsd index 445e932..79ebef9 100644 --- a/x4o-driver/src/main/resources/META-INF/cel/cel-root-1.0.xsd +++ b/x4o-driver/src/main/resources/META-INF/cel/cel-root-1.0.xsd @@ -23,21 +23,18 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --> - - - - - - - + + + + diff --git a/x4o-driver/src/main/resources/META-INF/eld/eld-conv-1.0.xsd b/x4o-driver/src/main/resources/META-INF/eld/eld-conv-1.0.xsd index c842280..781a7c5 100644 --- a/x4o-driver/src/main/resources/META-INF/eld/eld-conv-1.0.xsd +++ b/x4o-driver/src/main/resources/META-INF/eld/eld-conv-1.0.xsd @@ -23,21 +23,18 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --> - - - - - - - + + + + - - - - - - - + + + + + - @@ -110,13 +107,13 @@ - - + + - - + + @@ -177,10 +174,10 @@ An custom element class to config object. + - diff --git a/x4o-driver/src/main/resources/META-INF/eld/eld-root-1.0.xsd b/x4o-driver/src/main/resources/META-INF/eld/eld-root-1.0.xsd index 4dc5982..a963d7c 100644 --- a/x4o-driver/src/main/resources/META-INF/eld/eld-root-1.0.xsd +++ b/x4o-driver/src/main/resources/META-INF/eld/eld-root-1.0.xsd @@ -23,21 +23,18 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --> - - - - - - - + + + + - ant-update-schema-cel + x4o-update-schema-cel @@ -80,13 +80,17 @@ ${maven-antrun-plugin.version} - update-schema-cel-ant + x4o-update-schema-cel-run-ant generate-resources - - + + + + + + @@ -96,8 +100,8 @@ - org.x4o.plugin - x4o-plugin-ant + org.x4o.tool + x4o-tool-ant-plugin ${project.version} @@ -106,7 +110,7 @@ - ant-update-schema-eld + x4o-update-schema-eld @@ -115,13 +119,17 @@ ${maven-antrun-plugin.version} - update-schema-eld-ant + x4o-update-schema-eld-run-ant generate-resources - - + + + + + + @@ -131,8 +139,8 @@ - org.x4o.plugin - x4o-plugin-ant + org.x4o.tool + x4o-tool-ant-plugin ${project.version} @@ -141,7 +149,7 @@ - ant-site-elddoc + x4o-build-site-doc @@ -150,22 +158,46 @@ ${maven-antrun-plugin.version} - site-elddoc-ant + x4o-build-site-doc-run-ant pre-site - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -175,8 +207,8 @@ - org.x4o.plugin - x4o-plugin-ant + org.x4o.tool + x4o-tool-ant-plugin ${project.version} diff --git a/x4o-tool/x4o-tool-maven-plugin/pom.xml b/x4o-tool/x4o-tool-maven-plugin/pom.xml index 333ba39..76bf283 100644 --- a/x4o-tool/x4o-tool-maven-plugin/pom.xml +++ b/x4o-tool/x4o-tool-maven-plugin/pom.xml @@ -23,26 +23,26 @@ org.apache.maven maven-plugin-api - 3.0 + ${maven-plugin-api.version} provided org.apache.maven.plugin-tools maven-plugin-annotations - 3.2 + ${maven-plugin-annotations.version} provided org.apache.maven.plugin-testing maven-plugin-testing-harness - 2.0 + ${maven-plugin-testing-harness.version} test org.codehaus.plexus plexus-utils - 3.0.1 + ${plexus-utils.version} @@ -50,7 +50,7 @@ org.apache.maven.plugins maven-plugin-plugin - 3.2 + ${maven-plugin-plugin.version} true @@ -67,66 +67,4 @@ - - - build-site-x4o-support - - - - org.x4o.plugin - x4o-plugin-maven - ${project.version} - - - build-site-x4o-support - pre-site - - cel - eld-xsd - - http://language.x4o.org/xml/properties/eld-xsd/output/path=${basedir}/../../target/site/x4o-support - - - - - x4o-language-task - - - - - - org.x4o - x4o-driver - ${project.version} - - - org.x4o - x4o-driver - ${project.version} - test-jar - - - org.x4o - x4o-eld-doc - ${project.version} - - - de.odysseus.juel - juel - ${juel.version} - - - - - - - - \ No newline at end of file + diff --git a/x4o-tool/x4o-tool-maven-plugin/src/main/java/org/x4o/tool/maven/plugin/X4OLanguageTaskMojo.java b/x4o-tool/x4o-tool-maven-plugin/src/main/java/org/x4o/tool/maven/plugin/X4OLanguageTaskMojo.java index 7e9f8f1..86d226f 100644 --- a/x4o-tool/x4o-tool-maven-plugin/src/main/java/org/x4o/tool/maven/plugin/X4OLanguageTaskMojo.java +++ b/x4o-tool/x4o-tool-maven-plugin/src/main/java/org/x4o/tool/maven/plugin/X4OLanguageTaskMojo.java @@ -45,16 +45,16 @@ public class X4OLanguageTaskMojo extends AbstractMojo { static public final String GOAL = "x4o-language-task"; - @Parameter + @Parameter(property="languageName") private String languageName = null; - @Parameter + @Parameter(property="languageVersion") private String languageVersion = null; - @Parameter + @Parameter(property="taskId") private String taskId = null; - @Parameter + @Parameter(property="taskPropertyValues") private List taskPropertyValues; @Parameter(defaultValue="false",property="verbose") @@ -85,7 +85,11 @@ public class X4OLanguageTaskMojo extends AbstractMojo { throw new MojoExecutionException("Error while running task: "+getTaskId()+" error: "+e.getMessage(),e); } long stopTime = System.currentTimeMillis(); - getLog().info("Done "+getTaskId()+" for "+languageName+":"+languageVersion+" in "+(stopTime-startTime)+" ms."); + String ver = ""; + if (languageVersion!=null) { + ver = ":"+languageVersion; + } + getLog().info("Done "+getTaskId()+" for "+languageName+ver+" in "+(stopTime-startTime)+" ms."); } public void execute() throws MojoExecutionException { diff --git a/x4o-tool/x4o-tool-maven-plugin/src/test/java/org/x4o/tool/maven/plugin/X4OLanguageTaskMojoTest.java b/x4o-tool/x4o-tool-maven-plugin/src/test/java/org/x4o/tool/maven/plugin/X4OLanguageTaskMojoTest.java index f9c6124..1f5caa0 100644 --- a/x4o-tool/x4o-tool-maven-plugin/src/test/java/org/x4o/tool/maven/plugin/X4OLanguageTaskMojoTest.java +++ b/x4o-tool/x4o-tool-maven-plugin/src/test/java/org/x4o/tool/maven/plugin/X4OLanguageTaskMojoTest.java @@ -62,10 +62,8 @@ public class X4OLanguageTaskMojoTest extends AbstractMojoTestCase { Mojo mojo = lookupMojo("help",pom); assertNotNull(mojo); mojo.execute(); - } - /* public void testConfAllWriteDoc() throws Exception { executeGoal(X4OLanguageTaskMojo.GOAL,"src/test/resources/junit/test-plugin-conf-all.pom"); File outputDir = new File("target/jtest/test-plugin-conf-all/doc-eld-1.0"); @@ -74,7 +72,7 @@ public class X4OLanguageTaskMojoTest extends AbstractMojoTestCase { assertEquals("Should created more then two files", true, files>2); } - + /* public void testConfLangWriteDoc() throws Exception { executeGoal(X4OLanguageTaskMojo.GOAL,"src/test/resources/junit/test-plugin-conf-lang.pom"); File outputDir = new File("target/jtest/test-plugin-conf-lang/cel");