summaryrefslogtreecommitdiffstats
path: root/sandbox/travelsample/antdefs.xml
diff options
context:
space:
mode:
authornash <nash@13f79535-47bb-0310-9956-ffa450edef68>2010-01-02 09:24:41 +0000
committernash <nash@13f79535-47bb-0310-9956-ffa450edef68>2010-01-02 09:24:41 +0000
commit1a782a0069143286e9e386c628cd4e58c3b51e46 (patch)
tree57393296922a6f2b2b2d5a8476955e6e355b8152 /sandbox/travelsample/antdefs.xml
parentcb17099e7fb5f31435e57e1ee2c60f85b06e0868 (diff)
Add/fix ant scripts for contents of travel sample services and launchers directories (TUSCANY-3398)
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@895152 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sandbox/travelsample/antdefs.xml136
1 files changed, 110 insertions, 26 deletions
diff --git a/sandbox/travelsample/antdefs.xml b/sandbox/travelsample/antdefs.xml
index 92bd5e0425..00d69133ea 100644
--- a/sandbox/travelsample/antdefs.xml
+++ b/sandbox/travelsample/antdefs.xml
@@ -29,47 +29,62 @@
TUSCANY_HOME A directory containing the Tuscany binary distribution.
JUNIT_JAR The location of the JUnit jar file. The JUnit version used
for testing these build files was JUnit 4.5.
+ TUSCANY_HOST_CORBA (only needed to run CORBA services) A directory
+ containing the Tuscany JSE CORBA host jars.
This file defines the following targets that can be used on the
ant command that invokes the build.xml file:
- <compile> Compiles any Java source files that don't have an up-to-date
+ "compile" Compiles any Java source files that don't have an up-to-date
class file, and copies any files in or under the resource directory.
If the build.xml file contains a <path> element with the id
"compile-path", the contents of this path are added to the compiler's
classpath. Also invokes the following targets:
- . <wsdljava> (defined in the build.xml file) if there are any
+ . "wsdljava" (defined in the build.xml file) if there are any
.wsdl files in or under the resource directory
- . <test> if there are any files in or under the src/test/java
+ . "idljava" (defined in the build.xml file) if there are any
+ .idl files in or under the resource directory
+ . "test" if there are any files in or under the src/test/java
directory
- . <package> if all previous steps completed successfully
- <test> Compiles any Java unit test files that don't have an
- up-to-date class file, copies any test resources in or under
- the src/test/resources directory, and runs the unit tests.
- If the build.xml file contains a <path> element with the id
- "test-path", the contents of this path are added to the unit test
- classpath. If the build.xml file defines the "test-setup" property,
- the <test-setup> target in the build.xml file is invoked after
- copying the test resources.
- <package> Creates a jar file containing the compiled Java class
+ . "package" if all previous steps completed successfully
+ "test" Compiles any Java unit test files that don't have an
+ up-to-date class file, copies any test resources in or under the
+ src/test/resources directory, and runs the unit tests. If the
+ build.xml file contains a <path> element with the id "test-path",
+ the contents of this path are used for compiling and running the
+ unit tests. In addition, the "compile-path" setting (if specified)
+ is used for running unit tests. If the build.xml file defines the
+ "test-setup" property, the "testsetup" target in the build.xml
+ file is invoked after copying the test resources.
+ "package" Creates a jar file containing the compiled Java class
files (excluding unit test code) and any files in or under the
resource directory, unless the jar file is already up to date.
- <clean> Deletes all the files produced by the build.
+ If the build.xml file defines a path with id "package-path", this
+ path is used for the Class-Path manifest entry.
+ "run" Runs the class specified by the "run-class" property in the
+ build.xml file if this property is defined. If the build.xml file
+ contains a <path> element with id "run-path", the contents of this
+ path are added to the run classpath.
+ "clean" Deletes all the files produced by the build.
This file also defines the following targets for invocation by <antcall>
- within the <wsdljava> target in the build.xml file:
- <wsimport> Generates Java code from a WSDL file (unless the Java
+ from the build.xml file:
+ "wsimport" Generates Java code from a WSDL file (unless the Java
code is already up to date) by running the JDK wsimport command.
Requires the following parameters:
. <package> the Java package to use for generated code
. <wsdlfile> the filename of the WSDL file
. <javaclass> the filename of any Java class file that will be
- generated by running wsimport on the WSDL file
- <sdojavagen> Generates Java code from a WSDL file (unless the Java
+ generated by running this target on the WSDL file
+ "sdojavagen" Generates Java code from a WSDL file (unless the Java
code is already up to date) by running the SDO XSD2JavaGenerator.
Requires the same parameters as <wsimport>, plus the following:
. <prefix> the prefix string for naming the generated factory
- The build.xml file can make any number of calls to <wsimport> and/or
- <sdojavagen>.
+ "idlj" Generates Java code from a CORBA IDL file (unless the Java
+ code is already up to date) by running the JDK idlj command.
+ Requires the following parameters:
+ . <idlfile> the filename of the IDL file
+ . <javaclass> the filename of any Java class file that will be
+ generated by running this target for this IDL file
All other targets defined by this file (with names starting with "#")
are for internal use from within this file and are not intended to
@@ -140,6 +155,43 @@
</javac>
</target>
+ <!-- check whether there are any CORBA IDL files in or under the resource directory -->
+ <target name="#find-idlfiles">
+ <fileset id="#allidl" dir="src/main/resources">
+ <include name="**/*.idl"/>
+ </fileset>
+ <condition property="#idlfiles">
+ <and>
+ <available file="src/main/resources" type="dir"/>
+ <resourcecount refid="#allidl" when="greater" count="0"/>
+ </and>
+ </condition>
+ </target>
+
+ <!-- call the idljava target in the build.xml file if required -->
+ <target name="#call-idljava" depends="#find-idlfiles" if="#idlfiles">
+ <antcall target="idljava"/>
+ </target>
+
+ <!-- check whether the IDL-generated Java code is already up to date -->
+ <target name="#idlcheck">
+ <condition property="#idl-uptodate">
+ <uptodate srcfile="src/main/resources/${idlfile}"
+ targetfile="target/classes/${javaclass}"/>
+ </condition>
+ </target>
+
+ <!-- run the JDK idlj command if required, then compile the generated Java source -->
+ <target name="idlj" depends="#idlcheck" unless="#idl-uptodate">
+ <mkdir dir="target/idlj-source"/>
+ <exec executable="${java.home}/../bin/idlj">
+ <arg line="-fall -td target/idlj-source src/main/resources/${idlfile}"/>
+ </exec>
+ <javac destdir="target/classes" debug="on" source="1.5" target="1.5">
+ <src path="target/idlj-source"/>
+ </javac>
+ </target>
+
<!-- check whether there are any Java source files to compile -->
<target name="#find-javafiles">
<fileset id="#alljava" dir="src/main/java">
@@ -239,7 +291,7 @@
<!-- perform additional test setup if required -->
<target name="#test-setup" if="test-setup">
- <antcall target="test-setup"/>
+ <antcall target="testsetup"/>
</target>
<!-- check whether a dependency path for the unit tests was specified -->
@@ -262,13 +314,14 @@
</target>
<!-- run the junit task -->
- <target name="#run-junit" depends="#set-test-classpath, #default-test-classpath">
+ <target name="#run-junit" depends="#set-test-classpath, #default-test-classpath, #set-classpath, #default-classpath">
<junit printsummary="no" haltonfailure="yes" dir="."
fork="yes" forkmode="once">
<classpath>
<pathelement location="target/test-classes"/>
- <pathelement location="target/classes"/>
<path refid="#test-classpath"/>
+ <pathelement location="target/classes"/>
+ <path refid="#javac-classpath"/>
<pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
<pathelement location="${env.JUNIT_JAR}"/>
</classpath>
@@ -309,14 +362,42 @@
<!-- build a jar file if there are no files in the webapp directory -->
<target name="#package-jar" depends="#check-webapp" unless="#webapp">
- <jar destfile="target/${ant.project.name}.jar"
- basedir="target/classes"/>
+ <antcall target="#create-jar"/>
+ </target>
+
+ <!-- create a jar file with or without a Class-Path attribute -->
+ <target name="#create-jar" depends="#create-jar-path, #create-jar-nopath"/>
+
+ <!-- check whether a dependency path for the package target was specified -->
+ <target name="#check-package-path">
+ <condition property="#package-path">
+ <isreference refid="package-path"/>
+ </condition>
+ </target>
+
+ <!-- create a jar file with a Class-Path attribute -->
+ <target name="#create-jar-path" depends="#check-package-path" if="#package-path">
+ <property name="#parentdir" location=".."/>
+ <pathconvert property="#package-classpath" refid="package-path" pathsep=" " dirsep="/">
+ <map from="${#parentdir}" to="../.."/>
+ </pathconvert>
+ <jar destfile="target/${ant.project.name}.jar" basedir="target/classes">
+ <manifest>
+ <attribute name="Class-Path" value="${#package-classpath}"/>
+ </manifest>
+ </jar>
+ </target>
+
+ <!-- create a jar file without a Class-Path attribute -->
+ <target name="#create-jar-nopath" depends="#check-package-path" unless="#package-path">
+ <jar destfile="target/${ant.project.name}.jar" basedir="target/classes"/>
</target>
<!-- for external use on the ant command line -->
<target name="compile">
<mkdir dir="target/classes"/>
<antcall target="#call-wsdljava"/>
+ <antcall target="#call-idljava"/>
<antcall target="#compile-src"/>
<antcall target="#copy-resources"/>
<antcall target="#call-test"/>
@@ -341,7 +422,10 @@
</target>
<!-- for external use on the ant command line -->
- <target name="package" depends="#package-war, #package-jar"/>
+ <target name="package" depends="#find-javafiles" if="#javafiles">
+ <antcall target="#package-war"/>
+ <antcall target="#package-jar"/>
+ </target>
<!-- for external use on the ant command line -->
<target name="clean">