8904a42a2b
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@949356 13f79535-47bb-0310-9956-ffa450edef68
795 lines
37 KiB
XML
795 lines
37 KiB
XML
<!--
|
|
* 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.
|
|
-->
|
|
|
|
<!--
|
|
This file is designed to be imported by build.xml files to provide
|
|
definitions for a default set of build targets. The build.xml file
|
|
can include additional definitions to configure the behavior of these
|
|
default targets. The build.xml file can also define any additional
|
|
targets that are needed by the project.
|
|
|
|
This build file has been tested with JDK 5 update 22 and JDK 6 update 7.
|
|
|
|
When invoking a build.xml file that imports this file, the following
|
|
environment variable must be set:
|
|
TUSCANY_HOME A directory containing the Tuscany SCA binary distribution.
|
|
This build file has been tested with Tuscany SCA version 1.6.
|
|
|
|
When building from a svn checkout (but not when building from a downloaded
|
|
distribution), the following environment variables must be set:
|
|
JUNIT_JAR The location of the JUnit jar file. This build file has
|
|
been tested with JUnit version 4.5.
|
|
JAXWS_HOME (only if using JDK 5) A directory containing the JAX-WS
|
|
reference implementation. This build file has been tested with
|
|
the JAX-WS RI version 2.1.7.
|
|
OPENEJB_HOME A directory containing the OpenEJB binary distribution.
|
|
This build file has been tested with OpenEJB 3.1.2.
|
|
|
|
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
|
|
class file, and copies any files in or under the src/main/resources
|
|
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
|
|
.wsdl files in or under the resource directory
|
|
. "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
|
|
If the build.xml file defines the "run-update-resources" property,
|
|
the "update-resources" target in the build.xml file is invoked after
|
|
copying resources.
|
|
"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
|
|
unit tests. In addition, the "compile-path" setting (if specified)
|
|
is used for running unit tests. If the build.xml file defines the
|
|
"run-update-test-resources" property, the "update-test-resources"
|
|
target in the build.xml file is invoked after copying 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.
|
|
The contents of the jar file are taken from the target/classes
|
|
directory unless the target/jar-classes directory exists, in which
|
|
case this directory is used in preference to target/classes. If the
|
|
build.xml file defines a property named "package-path", a Class-Path
|
|
manifest entry is created and set to the value of this property.
|
|
"clean" Deletes all the files produced by the build.
|
|
|
|
This file also defines the following targets for invocation by <antcall>
|
|
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 wsimport command (on JDK 6)
|
|
or by calling the equivalent class in the JAX-WS RI (on JDK 5).
|
|
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 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
|
|
"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:
|
|
. <idljopts> the options to be used on this idlj command invocation
|
|
. <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
|
|
"add-implementation-web" Adds implementation.web support to the
|
|
installed Tuscany SCA binary distribution if not already there.
|
|
|
|
This file also defines the following targets for use with the "depends"
|
|
attribute on targets in the build.xml file:
|
|
"locate-openejb" Locates the OpenEJB dependencies needed by some
|
|
modules and creates a path with id "openejb-path" to bring in
|
|
these dependencies.
|
|
"locate-jaxws" Locates the JAX-WS dependencies needed by some modules
|
|
when running on JDK 5, and creates a path with id "jaxws-path"
|
|
to bring in these dependencies.
|
|
|
|
All other targets defined by this file (with names starting with "#")
|
|
are for internal use within this file and should not be used externally.
|
|
-->
|
|
|
|
<project name="antdefs">
|
|
<property environment="env"/>
|
|
<fail unless="env.TUSCANY_HOME">
|
|
Error: Please set the TUSCANY_HOME environment variable.
|
|
</fail>
|
|
|
|
<!-- check whether there are any WSDL files in or under the resource directory -->
|
|
<target name="#find-wsdlfiles">
|
|
<fileset id="#allwsdl" dir="src/main/resources">
|
|
<include name="**/*.wsdl"/>
|
|
</fileset>
|
|
<condition property="#wsdlfiles">
|
|
<and>
|
|
<available file="src/main/resources" type="dir"/>
|
|
<resourcecount refid="#allwsdl" when="greater" count="0"/>
|
|
</and>
|
|
</condition>
|
|
</target>
|
|
|
|
<!-- call the wsdljava target in the build.xml file if required -->
|
|
<target name="#call-wsdljava" depends="#find-wsdlfiles" if="#wsdlfiles">
|
|
<antcall target="wsdljava"/>
|
|
</target>
|
|
|
|
<!-- check whether the WSDL-generated Java code is already up to date -->
|
|
<target name="#wsdlcheck">
|
|
<condition property="#wsdl-uptodate">
|
|
<uptodate srcfile="src/main/resources/${wsdlfile}"
|
|
targetfile="target/classes/${javaclass}"/>
|
|
</condition>
|
|
</target>
|
|
|
|
<!-- run the wsimport command if required -->
|
|
<target name="wsimport" depends="#wsdlcheck" unless="#wsdl-uptodate">
|
|
<antcall target="#wsimport"/>
|
|
</target>
|
|
|
|
<!-- check whether the wsimport command is available in the JDK -->
|
|
<target name="#is-jdk-wsimport">
|
|
<condition property="#jdk-wsimport">
|
|
<or>
|
|
<available file="${java.home}/../bin/wsimport" type="file"/>
|
|
<available file="${java.home}/../bin/wsimport.exe" type="file"/>
|
|
</or>
|
|
</condition>
|
|
</target>
|
|
|
|
<!-- run the JDK wsimport command if available, then compile the generated Java source -->
|
|
<target name="#wsimport-jdk" if="#jdk-wsimport">
|
|
<property name="#jaxws-tools-dir" value=""/>
|
|
<mkdir dir="target/jaxws-source"/>
|
|
<exec executable="${java.home}/../bin/wsimport" dir="." failonerror="true">
|
|
<arg line="-keep -s ./target/jaxws-source -p ${package}
|
|
-Xnocompile src/main/resources/${wsdlfile}"/>
|
|
</exec>
|
|
<javac destdir="target/classes" debug="true" source="1.5" target="1.5">
|
|
<src path="target/jaxws-source"/>
|
|
</javac>
|
|
</target>
|
|
|
|
<!-- If building a downloaded distribution, the JAX-WS jars are in lib/jaxws -->
|
|
<target name="#lib-jaxws-tools" unless="#jdk-wsimport">
|
|
<condition property="#jaxws-tools-dir" value="../../../lib/jaxws">
|
|
<available file="../../../lib/jaxws" type="dir"/>
|
|
</condition>
|
|
</target>
|
|
|
|
<!-- Set the path as the JAX-WS directory and the Tuscany runtime -->
|
|
<target name="#tuscany-jaxws-tools" if="#jaxws-tools-dir">
|
|
<path id="#jaxws-tools-path">
|
|
<fileset dir="${#jaxws-tools-dir}"/>
|
|
<fileset dir="${env.TUSCANY_HOME}/lib"/>
|
|
</path>
|
|
</target>
|
|
|
|
<!-- If JAX-WS jars not found in lib, try the JAXWS_HOME environment variable -->
|
|
<target name="#env-jaxws-tools" unless="#jaxws-tools-dir">
|
|
<condition property="#jaxws-tools-home" value="${env.JAXWS_HOME}/lib">
|
|
<available file="${env.JAXWS_HOME}/lib" type="dir"/>
|
|
</condition>
|
|
</target>
|
|
|
|
<!-- Set the path as the JAXWS_HOME directory -->
|
|
<target name="#home-jaxws-tools" if="#jaxws-tools-home">
|
|
<path id="#jaxws-tools-path">
|
|
<fileset dir="${#jaxws-tools-home}"/>
|
|
</path>
|
|
<property name="#jaxws-tools-dir" value="${#jaxws-tools-home}"/>
|
|
</target>
|
|
|
|
<!-- run the com.sun.tools.ws.WsImport class in jaxws-tools.jar if available -->
|
|
<target name="#wsimport-jaxws" unless="#jdk-wsimport">
|
|
<fail unless="#jaxws-tools-dir">
|
|
Error: Could not find wsimport executable or jaxws-tools.jar.
|
|
</fail>
|
|
<mkdir dir="target/jaxws-source"/>
|
|
<java classname="com.sun.tools.ws.WsImport" fork="true" dir="." failonerror="true">
|
|
<arg line="-keep -s ./target/jaxws-source -p ${package}
|
|
-d ./target/classes src/main/resources/${wsdlfile}"/>
|
|
<classpath>
|
|
<path refid="#jaxws-tools-path"/>
|
|
</classpath>
|
|
</java>
|
|
</target>
|
|
|
|
<!-- run the wsimport command in JDK 6 or use jaxws-tools.jar on JDK 5 -->
|
|
<target name="#wsimport" depends="#is-jdk-wsimport, #wsimport-jdk, #lib-jaxws-tools, #tuscany-jaxws-tools, #env-jaxws-tools, #home-jaxws-tools, #wsimport-jaxws"/>
|
|
|
|
<!-- run the SDO XSD2JavaGenerator if required, then compile the generated Java source -->
|
|
<target name="sdojavagen" depends="#wsdlcheck" unless="#wsdl-uptodate">
|
|
<mkdir dir="target/sdo-source"/>
|
|
<java classname="org.apache.tuscany.sdo.generate.XSD2JavaGenerator" fork="true" dir="." failonerror="true">
|
|
<arg value="-javaPackage"/>
|
|
<arg value="${package}"/>
|
|
<arg value="-prefix"/>
|
|
<arg value="${prefix}"/>
|
|
<arg value="-noNotification"/>
|
|
<arg value="-noContainment"/>
|
|
<arg value="-noUnsettable"/>
|
|
<arg value="-targetDirectory"/>
|
|
<arg value="target/sdo-source"/>
|
|
<arg value="src/main/resources/${wsdlfile}"/>
|
|
<classpath location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
|
|
</java>
|
|
<javac destdir="target/classes" debug="true" source="1.5" target="1.5">
|
|
<src path="target/sdo-source"/>
|
|
<classpath location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
|
|
</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" dir="." failonerror="true">
|
|
<arg value="${idljopts}"/>
|
|
<arg value="-td"/>
|
|
<arg value="target/idlj-source"/>
|
|
<arg value="src/main/resources/${idlfile}"/>
|
|
</exec>
|
|
<javac destdir="target/classes" debug="true" 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">
|
|
<include name="**/*.java"/>
|
|
</fileset>
|
|
<condition property="#javafiles">
|
|
<and>
|
|
<available file="src/main/java" type="dir"/>
|
|
<resourcecount refid="#alljava" when="greater" count="0"/>
|
|
</and>
|
|
</condition>
|
|
</target>
|
|
|
|
<!-- compile the Java source files -->
|
|
<target name="#src-compile" depends="#find-javafiles" if="#javafiles">
|
|
<antcall target="#run-compile"/>
|
|
</target>
|
|
|
|
<!-- check whether a dependency path for the Java compiler was specified -->
|
|
<target name="#check-compile-path">
|
|
<condition property="#compile-path">
|
|
<isreference refid="compile-path"/>
|
|
</condition>
|
|
</target>
|
|
|
|
<!-- set classpath for Java compiler to include specified additional path -->
|
|
<target name="#set-compile-path" if="#compile-path">
|
|
<path id="#javac-classpath">
|
|
<path refid="compile-path"/>
|
|
</path>
|
|
</target>
|
|
|
|
<!-- set default classpath for Java compiler if no additional path specified -->
|
|
<target name="#default-compile-path" unless="#compile-path">
|
|
<path id="#javac-classpath"/>
|
|
</target>
|
|
|
|
<!-- set the Java compiler classpath -->
|
|
<target name="#set-javac-classpath" depends="#check-compile-path, #set-compile-path, #default-compile-path"/>
|
|
|
|
<!-- compile the Java source files -->
|
|
<target name="#run-compile" depends="#set-javac-classpath">
|
|
<javac destdir="target/classes" debug="true" source="1.5" target="1.5">
|
|
<src path="src/main/java"/>
|
|
<classpath>
|
|
<path refid="#javac-classpath"/>
|
|
<pathelement path="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
|
|
</classpath>
|
|
</javac>
|
|
</target>
|
|
|
|
<!-- check whether there are any resources to copy -->
|
|
<target name="#find-resources">
|
|
<fileset id="#allresources" dir="src/main/resources"/>
|
|
<condition property="#resources">
|
|
<and>
|
|
<available file="src/main/resources" type="dir"/>
|
|
<resourcecount refid="#allresources" when="greater" count="0"/>
|
|
</and>
|
|
</condition>
|
|
</target>
|
|
|
|
<!-- copy the contents of the resource directory -->
|
|
<target name="#copy-resources" depends="#find-resources" if="#resources">
|
|
<copy todir="target/classes">
|
|
<fileset dir="src/main/resources"/>
|
|
</copy>
|
|
</target>
|
|
|
|
<!-- update copied resources if required -->
|
|
<target name="#update-resources" if="run-update-resources">
|
|
<antcall target="update-resources"/>
|
|
</target>
|
|
|
|
<!-- check whether there are any Java files in or under the test directory -->
|
|
<target name="#find-testjava">
|
|
<fileset id="#alltestjava" dir="src/test/java">
|
|
<include name="**/*.java"/>
|
|
</fileset>
|
|
<condition property="#testjava">
|
|
<and>
|
|
<available file="src/test/java" type="dir"/>
|
|
<resourcecount refid="#alltestjava" when="greater" count="0"/>
|
|
</and>
|
|
</condition>
|
|
</target>
|
|
|
|
<!-- check whether there are any test resources to copy -->
|
|
<target name="#find-test-resources">
|
|
<fileset id="#alltestresources" dir="src/test/resources"/>
|
|
<condition property="#testresources">
|
|
<and>
|
|
<available file="src/test/resources" type="dir"/>
|
|
<resourcecount refid="#alltestresources" when="greater" count="0"/>
|
|
</and>
|
|
</condition>
|
|
</target>
|
|
|
|
<!-- copy the test resources -->
|
|
<target name="#copy-test-resources" depends="#find-test-resources" if="#testresources">
|
|
<copy todir="target/test-classes">
|
|
<fileset dir="src/test/resources"/>
|
|
</copy>
|
|
</target>
|
|
|
|
<!-- update copied test resources if required -->
|
|
<target name="#update-test-resources" if="run-update-test-resources">
|
|
<antcall target="update-test-resources"/>
|
|
</target>
|
|
|
|
<!-- check whether a dependency path for the unit tests was specified -->
|
|
<target name="#check-test-path">
|
|
<condition property="#test-path">
|
|
<isreference refid="test-path"/>
|
|
</condition>
|
|
</target>
|
|
|
|
<!-- set classpath for unit tests to include specified additional path -->
|
|
<target name="#set-test-path" if="#test-path">
|
|
<path id="#test-classpath">
|
|
<path refid="test-path"/>
|
|
</path>
|
|
</target>
|
|
|
|
<!-- set default classpath for unit tests if no additional path specified -->
|
|
<target name="#default-test-path" unless="#test-path">
|
|
<path id="#test-classpath"/>
|
|
</target>
|
|
|
|
<!-- set the Java compiler test classpath -->
|
|
<target name="#set-test-classpath" depends="#check-test-path, #set-test-path, #default-test-path"/>
|
|
|
|
<!-- If building a downloaded distribution, the JUnit jar is in lib/junit -->
|
|
<target name="#lib-junit">
|
|
<condition property="#junit-dir" value="../../../lib/junit">
|
|
<available file="../../../lib/junit" type="dir"/>
|
|
</condition>
|
|
</target>
|
|
|
|
<!-- If building a svn checkout, try the JUNIT_JAR environment variable -->
|
|
<target name="#env-junit" unless="#junit-dir">
|
|
<condition property="#junit-file" value="${env.JUNIT_JAR}">
|
|
<available file="${env.JUNIT_JAR}" type="file"/>
|
|
</condition>
|
|
<fail unless="#junit-file">
|
|
Error: Couldn't find JUnit jar file.
|
|
</fail>
|
|
</target>
|
|
|
|
<!-- Define JUnit fileset using a directory -->
|
|
<target name="#dir-junit" if="#junit-dir">
|
|
<fileset id="#junit-fileset" dir="${#junit-dir}"/>
|
|
</target>
|
|
|
|
<!-- Define JUnit fileset using a file -->
|
|
<target name="#file-junit" if="#junit-file">
|
|
<fileset id="#junit-fileset" file="${#junit-file}"/>
|
|
</target>
|
|
|
|
<!-- Locate the JUnit jar file -->
|
|
<target name="#locate-junit" depends="#lib-junit, #env-junit, #dir-junit, #file-junit"/>
|
|
|
|
<!-- compile the test classes -->
|
|
<target name="#test-compile" depends="#set-test-classpath, #locate-junit">
|
|
<javac destdir="target/test-classes" debug="true" source="1.5" target="1.5">
|
|
<src path="src/test/java"/>
|
|
<classpath>
|
|
<pathelement location="target/classes"/>
|
|
<path refid="#test-classpath"/>
|
|
<pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
|
|
<fileset refid="#junit-fileset"/>
|
|
</classpath>
|
|
</javac>
|
|
</target>
|
|
|
|
<!-- run the junit task -->
|
|
<target name="#run-junit" depends="#set-test-classpath, #set-javac-classpath, #locate-junit">
|
|
<junit printsummary="no" dir="." fork="true" forkmode="once" haltonfailure="true">
|
|
<classpath>
|
|
<pathelement location="target/test-classes"/>
|
|
<path refid="#test-classpath"/>
|
|
<pathelement location="target/classes"/>
|
|
<path refid="#javac-classpath"/>
|
|
<pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
|
|
<fileset refid="#junit-fileset"/>
|
|
</classpath>
|
|
<formatter type="plain" usefile="false"/>
|
|
<batchtest>
|
|
<fileset dir="src/test/java">
|
|
<include name="**/*TestCase.java"/>
|
|
</fileset>
|
|
</batchtest>
|
|
</junit>
|
|
</target>
|
|
|
|
<!-- check whether the Tuscany SCA version is 1.5.1 -->
|
|
<target name="#find-tuscany-1.5.1">
|
|
<fileset id="#tuscany-assembly-1.5.1" dir="${env.TUSCANY_HOME}/modules">
|
|
<include name="tuscany-assembly-1.5.1.jar"/>
|
|
</fileset>
|
|
<condition property="#tuscany-version" value="1.5.1">
|
|
<resourcecount refid="#tuscany-assembly-1.5.1" when="greater" count="0"/>
|
|
</condition>
|
|
<condition property="#tuscany-repo" value="m2-ibiblio-rsync-repository">
|
|
<resourcecount refid="#tuscany-assembly-1.5.1" when="greater" count="0"/>
|
|
</condition>
|
|
</target>
|
|
|
|
<!-- check whether the Tuscany SCA version is 1.6-SNAPSHOT -->
|
|
<target name="#find-tuscany-1.6-SNAPSHOT" unless="#tuscany-version">
|
|
<fileset id="#tuscany-assembly-1.6-SNAPSHOT" dir="${env.TUSCANY_HOME}/modules">
|
|
<include name="tuscany-assembly-1.6-SNAPSHOT.jar"/>
|
|
</fileset>
|
|
<condition property="#tuscany-version" value="1.6-SNAPSHOT">
|
|
<resourcecount refid="#tuscany-assembly-1.6-SNAPSHOT" when="greater" count="0"/>
|
|
</condition>
|
|
<condition property="#tuscany-baseversion" value="1.6">
|
|
<resourcecount refid="#tuscany-assembly-1.6-SNAPSHOT" when="greater" count="0"/>
|
|
</condition>
|
|
<condition property="#tuscany-repo" value="m2-snapshot-repository">
|
|
<resourcecount refid="#tuscany-assembly-1.6-SNAPSHOT" when="greater" count="0"/>
|
|
</condition>
|
|
</target>
|
|
|
|
<!-- check whether the Tuscany SCA version is 1.6 -->
|
|
<target name="#find-tuscany-1.6" unless="#tuscany-version">
|
|
<fileset id="#tuscany-assembly-1.6" dir="${env.TUSCANY_HOME}/modules">
|
|
<include name="tuscany-assembly-1.6.jar"/>
|
|
</fileset>
|
|
<condition property="#tuscany-version" value="1.6">
|
|
<resourcecount refid="#tuscany-assembly-1.6" when="greater" count="0"/>
|
|
</condition>
|
|
<condition property="#tuscany-repo" value="m2-ibiblio-rsync-repository">
|
|
<resourcecount refid="#tuscany-assembly-1.6" when="greater" count="0"/>
|
|
</condition>
|
|
</target>
|
|
|
|
<!-- find the Tuscany SCA version that matches the TUSCANY_HOME environment variable -->
|
|
<target name="#find-tuscany-version" depends="#find-tuscany-1.5.1, #find-tuscany-1.6-SNAPSHOT, #find-tuscany-1.6">
|
|
<fail unless="#tuscany-version">
|
|
Error: Unable to copy implementation.web jars for this Tuscany version.
|
|
</fail>
|
|
</target>
|
|
|
|
<!-- check whether the installed Tuscany SCA binary distribution includes implementation.web support -->
|
|
<target name="#check-implementation-web">
|
|
<fileset id="#implweb-before-copy" dir="${env.TUSCANY_HOME}/modules">
|
|
<include name="tuscany-implementation-web-${#tuscany-version}.jar"/>
|
|
<include name="tuscany-implementation-web-runtime-${#tuscany-version}.jar"/>
|
|
</fileset>
|
|
<condition property="#has-implementation-web">
|
|
<resourcecount refid="#implweb-before-copy" when="equal" count="2"/>
|
|
</condition>
|
|
</target>
|
|
|
|
<!-- check whether the installed Tuscany SCA binary distribution is a snapshot -->
|
|
<target name="#check-tuscany-snapshot">
|
|
<condition property="#tuscany-snapshot">
|
|
<equals arg1="${#tuscany-repo}" arg2="m2-snapshot-repository"/>
|
|
</condition>
|
|
</target>
|
|
|
|
<!-- copy implementation.web support to the installed Tuscany SCA snapshot binary distribution -->
|
|
<target name="#copy-impl-web-snapshot" if="#tuscany-snapshot">
|
|
<xmlproperty>
|
|
<url url="http://people.apache.org/repo/${#tuscany-repo}/org/apache/tuscany/sca/tuscany-implementation-web/${#tuscany-version}/maven-metadata.xml"/>
|
|
</xmlproperty>
|
|
<copy todir="${env.TUSCANY_HOME}/modules" flatten="true">
|
|
<url url="http://people.apache.org/repo/${#tuscany-repo}/org/apache/tuscany/sca/tuscany-implementation-web/${#tuscany-version}/tuscany-implementation-web-${#tuscany-baseversion}-${metadata.versioning.snapshot.timestamp}-${metadata.versioning.snapshot.buildNumber}.jar"/>
|
|
<url url="http://people.apache.org/repo/${#tuscany-repo}/org/apache/tuscany/sca/tuscany-implementation-web-runtime/${#tuscany-version}/tuscany-implementation-web-runtime-${#tuscany-baseversion}-${metadata.versioning.snapshot.timestamp}-${metadata.versioning.snapshot.buildNumber}.jar"/>
|
|
</copy>
|
|
<!-- need to copy and move because of ant 1.7.1 bug when copying with tofile and url -->
|
|
<move file="${env.TUSCANY_HOME}/modules/tuscany-implementation-web-${#tuscany-baseversion}-${metadata.versioning.snapshot.timestamp}-${metadata.versioning.snapshot.buildNumber}.jar" tofile="${env.TUSCANY_HOME}/modules/tuscany-implementation-web-${#tuscany-version}.jar"/>
|
|
<move file="${env.TUSCANY_HOME}/modules/tuscany-implementation-web-runtime-${#tuscany-baseversion}-${metadata.versioning.snapshot.timestamp}-${metadata.versioning.snapshot.buildNumber}.jar" tofile="${env.TUSCANY_HOME}/modules/tuscany-implementation-web-runtime-${#tuscany-version}.jar"/>
|
|
</target>
|
|
|
|
<!-- copy implementation.web support to the installed Tuscany SCA non-snapshot binary distribution -->
|
|
<target name="#copy-impl-web-nonsnapshot" unless="#tuscany-snapshot">
|
|
<copy todir="${env.TUSCANY_HOME}/modules" flatten="true">
|
|
<url url="http://people.apache.org/repo/${#tuscany-repo}/org/apache/tuscany/sca/tuscany-implementation-web/${#tuscany-version}/tuscany-implementation-web-${#tuscany-version}.jar"/>
|
|
<url url="http://people.apache.org/repo/${#tuscany-repo}/org/apache/tuscany/sca/tuscany-implementation-web-runtime/${#tuscany-version}/tuscany-implementation-web-runtime-${#tuscany-version}.jar"/>
|
|
</copy>
|
|
</target>
|
|
|
|
<!-- copy implementation.web support to the installed Tuscany SCA binary distribution -->
|
|
<target name="#copy-implementation-web" depends="#check-tuscany-snapshot, #copy-impl-web-snapshot, #copy-impl-web-nonsnapshot"/>
|
|
|
|
<!-- add implementation.web support to the installed Tuscany SCA binary distribution if not already there -->
|
|
<target name="add-implementation-web" depends="#find-tuscany-version, #check-implementation-web" unless="#has-implementation-web">
|
|
<antcall target="#copy-implementation-web"/>
|
|
<fileset id="#implweb-after-copy" dir="${env.TUSCANY_HOME}/modules">
|
|
<include name="tuscany-implementation-web-${#tuscany-version}.jar"/>
|
|
<include name="tuscany-implementation-web-runtime-${#tuscany-version}.jar"/>
|
|
</fileset>
|
|
<condition property="#implementation-web-copied">
|
|
<resourcecount refid="#implweb-after-copy" when="equal" count="2"/>
|
|
</condition>
|
|
<fail unless="#implementation-web-copied">
|
|
Error: Unable to download tuscany-implementation-web and tuscany-implementation-web-runtime jars.
|
|
</fail>
|
|
</target>
|
|
|
|
<!-- check whether the target/jar-classes directory exists -->
|
|
<target name="#check-jar-classes">
|
|
<condition property="#jar-classes" value="target/jar-classes">
|
|
<available file="target/jar-classes" type="dir"/>
|
|
</condition>
|
|
<condition property="#jar-classes" value="target/classes">
|
|
<not>
|
|
<available file="target/jar-classes" type="dir"/>
|
|
</not>
|
|
</condition>
|
|
</target>
|
|
|
|
<!-- check whether there are any files in the webapp directory -->
|
|
<target name="#check-webapp">
|
|
<fileset id="#webappfiles" dir="src/main/webapp"/>
|
|
<condition property="#webapp">
|
|
<and>
|
|
<available file="src/main/webapp" type="dir"/>
|
|
<resourcecount refid="#webappfiles" when="greater" count="0"/>
|
|
</and>
|
|
</condition>
|
|
</target>
|
|
|
|
<!-- build a war file if there are files in the webapp directory -->
|
|
<target name="#package-war" if="#webapp">
|
|
<mkdir dir="target/lib"/>
|
|
<antcall target="copy-lib"/>
|
|
<war destfile="target/${ant.project.name}.war" webxml="src/main/webapp/WEB-INF/web.xml"
|
|
excludes="**/*.cbp">
|
|
<fileset dir="src/main/webapp"/>
|
|
<lib dir="target/lib"/>
|
|
<classes dir="${#jar-classes}"/>
|
|
</war>
|
|
</target>
|
|
|
|
<!-- create a jar file with a Class-Path attribute -->
|
|
<target name="#package-jar-path" unless="#webapp" if="package-path">
|
|
<jar destfile="target/${ant.project.name}.jar" basedir="${#jar-classes}"
|
|
excludes="**/*.cbp">
|
|
<manifest>
|
|
<attribute name="Class-Path" value="${package-path}"/>
|
|
</manifest>
|
|
</jar>
|
|
</target>
|
|
|
|
<target name="#not-package-path" unless="package-path">
|
|
<property name="#no-package-path" value=""/>
|
|
</target>
|
|
|
|
<!-- create a jar file without a Class-Path attribute -->
|
|
<target name="#package-jar-nopath" unless="#webapp" if="#no-package-path">
|
|
<jar destfile="target/${ant.project.name}.jar" basedir="${#jar-classes}"
|
|
excludes="**/*.cbp"/>
|
|
</target>
|
|
|
|
<!-- build a packaged jar file or war file -->
|
|
<target name="#build-package" depends="#check-jar-classes, #check-webapp, #package-war,
|
|
#package-jar-path, #not-package-path, #package-jar-nopath"/>
|
|
|
|
<!-- If running from a downloaded distribution, the OpenEJB jars are in lib/openejb -->
|
|
<target name="#lib-openejb">
|
|
<condition property="#openejb-dir" value="../../../lib/openejb">
|
|
<available file="../../../lib/openejb" type="dir"/>
|
|
</condition>
|
|
</target>
|
|
|
|
<!-- If running from a complete build, the OpenEJB jars are in binaries/target/openejb -->
|
|
<target name="#binaries-openejb" unless="#openejb-dir">
|
|
<condition property="#openejb-dir" value="../../binaries/target/openejb">
|
|
<available file="../../binaries/target/openejb" type="dir"/>
|
|
</condition>
|
|
</target>
|
|
|
|
<!-- Set the path as the OpenEJB directory and the Tuscany runtime -->
|
|
<target name="#tuscany-openejb" if="#openejb-dir">
|
|
<path id="openejb-path">
|
|
<fileset dir="${#openejb-dir}"/>
|
|
<!-- The openejb directory doesn't include all dependencies, so bring these in from Tuscany -->
|
|
<fileset dir="${env.TUSCANY_HOME}/lib">
|
|
<!-- exclude some jars to prevent them being loaded by OpenEJB -->
|
|
<exclude name="tuscany-sca-manifest.jar"/>
|
|
<exclude name="ode-*.jar"/>
|
|
<exclude name="jaxb-xjc-*.jar"/>
|
|
<exclude name="jython-*.jar"/>
|
|
<exclude name="activemq-all-*.jar"/>
|
|
<exclude name="js-*.jar"/>
|
|
<exclude name="org.apache.felix.main-*.jar"/>
|
|
<exclude name="saxon-*.jar"/>
|
|
</fileset>
|
|
</path>
|
|
</target>
|
|
|
|
<!-- If OpenEJB jars not found in lib or binaries, try the OPENEJB_HOME environment variable -->
|
|
<target name="#env-openejb" unless="#openejb-dir">
|
|
<condition property="#openejb-home" value="${env.OPENEJB_HOME}/lib">
|
|
<available file="${env.OPENEJB_HOME}/lib" type="dir"/>
|
|
</condition>
|
|
</target>
|
|
|
|
<!-- Set the path as the OPENEJB_HOME directory -->
|
|
<target name="#home-openejb" if="#openejb-home">
|
|
<path id="openejb-path">
|
|
<fileset dir="${#openejb-home}"/>
|
|
</path>
|
|
<property name="#openejb-dir" value="${#openejb-home}"/>
|
|
</target>
|
|
|
|
<!-- For use as a dependency of "run" targets that need OpenEJB -->
|
|
<target name="locate-openejb" depends="#lib-openejb, #binaries-openejb, #tuscany-openejb, #env-openejb, #home-openejb">
|
|
<fail unless="#openejb-dir">
|
|
Error: Couldn't find OpenEJB dependencies.
|
|
</fail>
|
|
</target>
|
|
|
|
<!-- check to see if we are running on JDK 6 -->
|
|
<target name="#is-jdk6">
|
|
<condition property="#jdk6">
|
|
<available classname="javax.xml.ws.Endpoint"/>
|
|
</condition>
|
|
</target>
|
|
|
|
<!-- JDK 6 contains JAX-WS so we don't need it on the classpath -->
|
|
<target name="#jaxws-jdk6" if="#jdk6">
|
|
<path id="jaxws-path"/>
|
|
<property name="#jaxws-dir" value=""/>
|
|
</target>
|
|
|
|
<!-- If running from a downloaded distribution, the JAX-WS jars are in lib/jaxws -->
|
|
<target name="#lib-jaxws" unless="#jaxws-dir">
|
|
<condition property="#jaxws-dir" value="../../../lib/jaxws">
|
|
<available file="../../../lib/jaxws" type="dir"/>
|
|
</condition>
|
|
</target>
|
|
|
|
<!-- If running from a complete build, the JAX-WS jars are in binaries/target/jaxws -->
|
|
<target name="#binaries-jaxws" unless="#jaxws-dir">
|
|
<condition property="#jaxws-dir" value="../../binaries/target/jaxws">
|
|
<available file="../../binaries/target/jaxws" type="dir"/>
|
|
</condition>
|
|
</target>
|
|
|
|
<!-- Set the path as the JAX-WS directory and the Tuscany runtime -->
|
|
<target name="#tuscany-jaxws" if="#jaxws-dir">
|
|
<path id="jaxws-path">
|
|
<fileset dir="${#jaxws-dir}"/>
|
|
<fileset dir="${env.TUSCANY_HOME}/lib"/>
|
|
</path>
|
|
</target>
|
|
|
|
<!-- If JAX-WS jars not found in lib or binaries, try the JAXWS_HOME environment variable -->
|
|
<target name="#env-jaxws" unless="#jaxws-dir">
|
|
<condition property="#jaxws-home" value="${env.JAXWS_HOME}/lib">
|
|
<available file="${env.JAXWS_HOME}/lib" type="dir"/>
|
|
</condition>
|
|
</target>
|
|
|
|
<!-- Set the path as the JAXWS_HOME directory -->
|
|
<target name="#home-jaxws" if="#jaxws-home">
|
|
<path id="jaxws-path">
|
|
<fileset dir="${#jaxws-home}"/>
|
|
</path>
|
|
<property name="#jaxws-dir" value="${#jaxws-home}"/>
|
|
</target>
|
|
|
|
<!-- For use as a dependency of "run" targets that need JAX-WS -->
|
|
<target name="locate-jaxws" depends="#is-jdk6, #jaxws-jdk6, #lib-jaxws, #binaries-jaxws, #tuscany-jaxws, #env-jaxws, #home-jaxws">
|
|
<fail unless="#jaxws-dir">
|
|
Error: Couldn't find JAX-WS dependencies.
|
|
</fail>
|
|
</target>
|
|
|
|
<!-- for external use on the ant command line -->
|
|
<target name="compile">
|
|
<echo message="Compiling project ${ant.project.name}"/>
|
|
<mkdir dir="target/classes"/>
|
|
<antcall target="#call-wsdljava"/>
|
|
<antcall target="#call-idljava"/>
|
|
<antcall target="#src-compile"/>
|
|
<antcall target="#copy-resources"/>
|
|
<antcall target="#update-resources"/>
|
|
<antcall target="test"/>
|
|
<antcall target="package"/>
|
|
</target>
|
|
|
|
<!-- for external use on the ant command line -->
|
|
<target name="test" depends="#find-testjava" if="#testjava">
|
|
<echo message="Testing project ${ant.project.name}"/>
|
|
<mkdir dir="target/test-classes"/>
|
|
<antcall target="#test-compile"/>
|
|
<antcall target="#copy-test-resources"/>
|
|
<antcall target="#update-test-resources"/>
|
|
<antcall target="#run-junit"/>
|
|
</target>
|
|
|
|
<!-- for external use on the ant command line -->
|
|
<target name="package">
|
|
<echo message="Packaging project ${ant.project.name}"/>
|
|
<antcall target="#build-package"/>
|
|
</target>
|
|
|
|
<!-- for external use on the ant command line -->
|
|
<target name="clean">
|
|
<echo message="Cleaning project ${ant.project.name}"/>
|
|
<delete dir="target" includeemptydirs="true"/>
|
|
</target>
|
|
|
|
</project>
|