Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Taal2012-10-21 07:21:10 -0400
committerMartin Taal2012-10-21 07:21:10 -0400
commit49cb9ad054800850f9af88790f7142b569bc2e79 (patch)
tree4a9a3b157341cbab82e201d4eb5521a18e836aa0
parent20b5a50d525beb04240f8131720f418e74b1c94d (diff)
downloadorg.eclipse.emf.texo-49cb9ad054800850f9af88790f7142b569bc2e79.tar.gz
org.eclipse.emf.texo-49cb9ad054800850f9af88790f7142b569bc2e79.tar.xz
org.eclipse.emf.texo-49cb9ad054800850f9af88790f7142b569bc2e79.zip
Added readme.txt, ant files and small changes to generator application
-rw-r--r--generator/org.eclipse.emf.texo.eclipse.generator/build.properties5
-rw-r--r--generator/org.eclipse.emf.texo.eclipse.generator/examples/build.xml23
-rw-r--r--generator/org.eclipse.emf.texo.eclipse.generator/examples/texo-gen-macrodef.xml60
-rw-r--r--generator/org.eclipse.emf.texo.eclipse.generator/readme.txt4
-rwxr-xr-xgenerator/org.eclipse.emf.texo.eclipse.generator/src/org/eclipse/emf/texo/eclipse/generator/TexoGeneratorApplication.java10
5 files changed, 101 insertions, 1 deletions
diff --git a/generator/org.eclipse.emf.texo.eclipse.generator/build.properties b/generator/org.eclipse.emf.texo.eclipse.generator/build.properties
index 43c3eb89..4c1644e5 100644
--- a/generator/org.eclipse.emf.texo.eclipse.generator/build.properties
+++ b/generator/org.eclipse.emf.texo.eclipse.generator/build.properties
@@ -7,4 +7,7 @@ bin.includes = plugin.xml,\
license.html,\
epl-v10.html,\
copyright.txt,\
- about.html \ No newline at end of file
+ about.html,\
+ examples/,\
+ readme.txt
+
diff --git a/generator/org.eclipse.emf.texo.eclipse.generator/examples/build.xml b/generator/org.eclipse.emf.texo.eclipse.generator/examples/build.xml
new file mode 100644
index 00000000..4a500f5f
--- /dev/null
+++ b/generator/org.eclipse.emf.texo.eclipse.generator/examples/build.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+Copyright (c) 2012 Springsite BV (The Netherlands) and others
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+ Martin Taal - Initial API and implementation
+-->
+<project name="Texo Headless Generation Run" default="generateCode">
+ <import file="texo-gen-macrodef.xml"/>
+
+ <target name="generateCode">
+ <texo.gen
+ eclipse="/home/mtaal/mytmp/headless/eclipse"
+ data="/home/mtaal/mytmp/headless/workspace"
+ project="testgen"
+ modelLocation="/home/mtaal/mytmp/models"
+ jpa="true"/>
+ </target>
+</project>
diff --git a/generator/org.eclipse.emf.texo.eclipse.generator/examples/texo-gen-macrodef.xml b/generator/org.eclipse.emf.texo.eclipse.generator/examples/texo-gen-macrodef.xml
new file mode 100644
index 00000000..59214cce
--- /dev/null
+++ b/generator/org.eclipse.emf.texo.eclipse.generator/examples/texo-gen-macrodef.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+Copyright (c) 2012 Springsite BV (The Netherlands) and others
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+ Martin Taal - Initial API and implementation
+-->
+<project name="Texo Headless Generation Macrodef">
+ <macrodef name="texo.gen">
+ <attribute name="eclipse"/>
+ <attribute name="data"/>
+ <attribute name="project" default=""/>
+ <attribute name="modelLocation"/>
+ <attribute name="dao" default="false"/>
+ <attribute name="jpa" default="false"/>
+ <sequential>
+
+ <condition property="dao.arg" value="-dao" else="">
+ <istrue value="@{dao}"/>
+ </condition>
+
+ <condition property="jpa.arg" value="-jpa" else="">
+ <istrue value="@{jpa}"/>
+ </condition>
+
+ <property name="project.value" value="@{project}"/>
+
+ <condition property="project.arg" value="-project @{project}" else="">
+ <isset property="project.value"/>
+ </condition>
+
+ <echo message="@{eclipse}"/>
+
+ <property name="eclipse.plugins" value="@{eclipse}/plugins"/>
+ <property name="launcher.jar" value="${eclipse.plugins}/org.eclipse.equinox.launcher.jar"/>
+
+ <!-- copy the version numbered launcher jar to an unversion numbered launcher jar -->
+ <copy tofile="${launcher.jar}">
+ <fileset dir="${eclipse.plugins}" includes="**/org.eclipse.equinox.launcher_*.jar"/>
+ </copy>
+
+ <!-- start Eclipse with java -->
+ <java classpath="${launcher.jar}" fork="true"
+ classname="org.eclipse.equinox.launcher.Main"
+ failonerror="true">
+ <arg value="-nosplash"/>
+ <arg value="-data @{data}"/>
+ <arg value="-application org.eclipse.emf.texo.eclipse.generator.TexoCodeGenerator"/>
+ <arg value="${project.arg}"/>
+ <arg value="-modelLocation @{modelLocation}"/>
+ <arg value="${jpa.arg}"/>
+ <arg value="${dao.arg}"/>
+ </java>
+ </sequential>
+ </macrodef>
+</project>
diff --git a/generator/org.eclipse.emf.texo.eclipse.generator/readme.txt b/generator/org.eclipse.emf.texo.eclipse.generator/readme.txt
new file mode 100644
index 00000000..de48b0dc
--- /dev/null
+++ b/generator/org.eclipse.emf.texo.eclipse.generator/readme.txt
@@ -0,0 +1,4 @@
+See this page for information on how to do headless generation runs which can be used as part of a build:
+http://wiki.eclipse.org/Texo/Generate_in_a_build
+
+in the examples directory in this plugin you can an example build and macrodef to use within ant. \ No newline at end of file
diff --git a/generator/org.eclipse.emf.texo.eclipse.generator/src/org/eclipse/emf/texo/eclipse/generator/TexoGeneratorApplication.java b/generator/org.eclipse.emf.texo.eclipse.generator/src/org/eclipse/emf/texo/eclipse/generator/TexoGeneratorApplication.java
index 7f95030e..67667751 100755
--- a/generator/org.eclipse.emf.texo.eclipse.generator/src/org/eclipse/emf/texo/eclipse/generator/TexoGeneratorApplication.java
+++ b/generator/org.eclipse.emf.texo.eclipse.generator/src/org/eclipse/emf/texo/eclipse/generator/TexoGeneratorApplication.java
@@ -193,13 +193,23 @@ public class TexoGeneratorApplication implements IApplication {
final File modelFile = new File(modelLocation);
final List<File> files = new ArrayList<File>();
+ if (!modelFile.exists()) {
+ throw new RuntimeException("Model file " + modelLocation + " does not exist");
+ }
if (modelFile.isDirectory()) {
for (File file : modelFile.listFiles()) {
if (file.getName().endsWith("xsd") || file.getName().endsWith("ecore")) {
files.add(file);
}
}
+ if (files.isEmpty()) {
+ throw new RuntimeException("No model files (ecore, xsd) found in location " + modelLocation);
+ }
} else {
+ if (!modelLocation.endsWith("xsd") && !modelLocation.endsWith("xsd")) {
+ throw new RuntimeException("Model location " + modelLocation
+ + " is not a model file, supported file extensions are xsd or ecore");
+ }
files.add(modelFile);
}

Back to the top