build_template.xml
<?xml version="1.0"?>
<!-- This is a technique used to include define a
file to include -->
<!DOCTYPE project [
<!ENTITY IncludeBuildEnv
SYSTEM "RELATIVE_PATH_HERE\
buildEnv.xml
%IncludeBuildEnv;
]>
<!--
This document is an ant build file for the openwings
components. Ant is a cross platform java build tool that
uses xml files such as this one to describe what will be
made. Ant has several built in elements that allow
various build actions to be taken. Ant works a lot
like make in that handles dependency resolution. Ant
provides variable subsitution through properties.
Properties are referenced as follows: ${property_name}.
Ant is written in java and is easily extensible
to define new commands.
The following general targets are defined in this file.
all - depends="clean,build,image,deploy,test,publish"
This target does everything this build file is
capable of. This includes cleaning, building, imaging,
deploying, testing, and publishing the component.
main - depends="build,image"
This is the default target. This target builds and
images the component.
build - depends="compile,jar,connector"
This target will build the component. This includes
compiling component code, generating policies, jaring
the main classes, and generating connectors.
clean -
This target will clean up all products normally
created by this build file.
compile -
This target compiles the main classes of this component.
policy - depends="policy1,etc."
This target generates all policies associated
with this component. This should be an empty target
that depends on each policy to be generated, i.e.
policy1, policy2, etc. Policies typically get put
in the main jar file.
jar - depends="compile"
This target creates the main jar file.
connector - depends="connector1, etc."
This target generates all connectors associated with
this component. This should be an empty target that
depends on each connector to be generated, i.e.
connector1, connector2, etc. Connector each go in
their own jar file.
image - depends="docs"
This target creates an installable component jar.
Part of imaging includes creating javadocs.
docs
This targets creates any javadocs for the component.
deploy
This target will try to install the component
somewhere.
test
This target will perform regression testing of
the component.
publish
This target will publish the installable component jar.
@version 1
@author Guy Bieber
-->
<project name="PACKAGE_NAME_HERE" default="main" basedir=".">
<!-- includes -->
&IncludeBuildEnv;
<!-- local properties -->
<property name="compDir"
value="COMPONENT_NAME[-VERSION]" />
<property name="relativeSrcDir"
value="RELATIVE_SRC_DIR_HERE" />
<property name="srcDir"
value="${buildRoot}\${compDir}\src\${relativeSrcDir}" />
<property name="targetSrcDir"
value="${srcDir}" />
<property name="targetImageDir"
value="${targetSrcDir}/image"/>
<property name="classDir"
value="${buildRoot}\${openwingsDir}\lib" />
<property name="targetClassDir" value="${classDir}"/>
<property name="targetLibDir" value="${libDir}"/>
<property name="package" value="PACKAGE_NAME_HERE" />
<property name="targetJarFile"
value="${buildRoot}/${compDir}/lib/COMPONENT_JAR_NAME_HERE.jar" />
<property name="imageJarFile"
value="${srcDir}/INSTALLABLE_JAR_NAME_HERE.jar" />
<property name="connectorJarFile1"
value="${buildRoot}/$compDir}/lib/CONNECTOR_JAR_NAME_HERE.jar"/>
<property name="connectorInterface1"
value="${package}.CONNECTOR_IF_NAME_HERE"/>
<property name="connectorJarFile2"
value="${buildRoot}/${compDir}/lib/CONNECTOR_JAR_NAME_HERE.jar"/>
<property name="connectorInterface2"
value="${package}.CONNECTOR_IF_NAME_HERE"/>
<property name="connectorJarFile3"
value="${buildRoot}/${compDir}/lib/CONNECTOR_JAR_NAME_HERE.jar"/>
<property name="connectorInterface3"
value="${package}.CONNECTOR_IF_NAME_HERE"/>
<!-- This target tries to do everything this build
file is capable of -->
<target name="all"
depends="clean,build,image,deploy,test,publish">
</target>
<!-- This target executes the default behavior of
this make file -->
<target name="main" depends="build,image">
</target>
<!-- This target performs the compiles and jars. -->
<target name="build" depends="compile,jar,connector">
</target>
<!-- This target performs the compiles and jars. -->
<target name="connector"
depends="connector1,connector2,connector3">
</target>
<!-- This target performs the compiles and jars. -->
<target name="policy" depends="policy1">
</target>
<!-- This target cleans up build products to guarantee
new ones are made -->
<target name="clean">
<!-- delete the build.compile products -->
<delete dir="${srcDir}/com" />
<delete dir="${srcDir}/docs" />
<!-- delete build.policy products -->
<!-- delete build.jar products -->
<delete file="${targetJarFile}" />
<!-- delete build.connector products -->
<!-- delete the image products -->
<delete file="${imageJarFile}" />
<delete dir="${targetImageDir}/" />
<!-- delete deploy products -->
<!-- delete test products -->
<!-- delete publish products -->
</target>
<!-- This target compiles code -->
<target name="compile">
<javac srcdir="."
destdir="${srcDir}"
debug="on"
includes="*.java" >
<classpath>
<pathelement path="${sunXmlHome}/lib/xml.jar"/>
<pathelement path="${xercesHome}/lib/xerces.jar"/>
<pathelement path="${libDir}/ow_policy.jar"/>
<pathelement path="${libDir}/ow_ui.jar"/>
<pathelement path="${libDir}/ow_component.jar"/>
<pathelement path="${libDir}/ow_identity.jar"/>
<pathelement path=
"${libDir}/mot_component_policy.jar"/>
<pathelement path="${libDir}/mot_component.jar"/>
<pathelement path="${libDir}/mot_identity.jar"/>
<pathelement path="${libDir}/mot_policy_core.jar"/>
<pathelement path="${libDir}/mot_java.jar"/>
</classpath>
</javac>
</target>
<!-- This target creates jar files -->
<target name="jar" depends="compile">
<jar jarfile="${targetJarFile}"
basedir="${srcDir}"
includes="${relativeSrcDir}/*"
/>
</target>
<!-- This target is building a specific RMI connector -->
<target name="connector1" depends="jar">
<java classname=
"com.mot.openwings.connector.synchronous.rmi.RMIConnectorBuilder"
fork="yes">
<classpath>
<pathelement location=
"${libDir}/ow_connector.jar" />
<pathelement location=
"${libDir}/mot_connector.jar" />
<pathelement location="${libDir}/mot_java.jar"/>
<pathelement location="${targetJarFile}"/>
<pathelement location="${targetClassDir}"/>
</classpath>
<arg value="ijs"/>
<arg value="${connectorInterface1}"/>
<arg value="${connectorJarFile1}"/>
<arg value="connector1"/>
</java>
</target>
<!-- This target is building a specific IIOP connector -->
<target name="connector2" depends="jar">
<java classname=
"com.mot.openwings.connector.synchronous.iiop.IIOPConnectorBuilder"
fork="yes">
<classpath>
<pathelement location=
"${libDir}/ow_connector.jar" />
<pathelement location=
"${libDir}/mot_connector.jar" />
<pathelement location="${libDir}/mot_java.jar"/>
<pathelement location="${targetJarFile}"/>
<pathelement location="${targetClassDir}"/>
</classpath>
<arg value="ijs"/>
<arg value="${connectorInterface2}"/>
<arg value="${connectorJarFile2}"/>
<arg value="connector2"/>
</java>
</target>
<!-- This target is building a specific JMS connector -->
<target name="connector3" depends="jar">
<property name="connectorJarFile" value="${connectorJarFile3}"/>
<java classname=
"com.mot.openwings.connector.asynchronous.openjms.broadcast.JMSConnectorBuilder"
fork="yes">
<classpath>
<pathelement location="${targetJarFile}"/>
<pathelement location="${targetClassPath}"/>
<pathelement location=
"${libDir}/ow_connector.jar"/>
<pathelement location=
"${libDir}/mot_connector.jar"/>
<pathelement location="${libDir}/mot_java.jar"/>
</classpath>
<arg value="injs"/>
<arg value="${connectorInterface3}"/>
<arg value="HelloWorldServiceAsynchronousBroadcastConnector"/>
<arg value="${connectorJarFile3}"/>
<arg value="connector3"/>
</java>
</target>
<!-- This target creates a deployment image -->
<target name="image" depends="docs">
<!-- create main image directory -->
<mkdir dir="${targetImageDir}" />
<!-- populate lib -->
<mkdir dir="${targetImageDir}/lib" />
<copy todir="${targetImageDir}/lib" file="${targetJarFile}" />
<copy todir="${targetImageDir}/lib" file="${connectorJarFile1}" />
<copy todir="${targetImageDir}/lib" file="${connectorJarFile2}" />
<copy todir="${targetImageDir}/lib" file="${connectorJarFile3}" />
<!-- populate docs -->
<mkdir dir="docs" />
<!-- populate http -->
<mkdir dir="http" />
<copy todir="http" file="${connectorJarFile1}" />
<copy todir="http" file="${connectorJarFile2}" />
<copy todir="http" file="${connectorJarFile3}" />
<mkdir dir="${targetImageDir}/http" />
<copy todir="${targetImageDir}/http">
<fileset dir="http"/>
</copy>
<!-- populate policies -->
<!-- assumes InstallableComponentDescriptor.xml
or ComponentDescriptor.xml exists in the policy directory -->
<mkdir dir="policies" />
<mkdir dir="${targetImageDir}/policies" />
<copy todir="${targetImageDir}/policies">
<fileset dir="policies"/>
</copy>
<!-- populate src -->
<mkdir dir="${targetImageDir}/src/${relativeSrcDir}/policies" />
<copy todir="${targetImageDir}/src/${relativeSrcDir}"
file="build.xml" />
<copy todir="${targetImageDir}/src/${relativeSrcDir}">
<fileset dir="." includes="*.java"/>
</copy>
<copy todir="${targetImageDir}/src"
file="${srcDir}/buildEnv.xml" />
<copy todir="${targetImageDir}/src/${relativeSrcDir}/policies">
<fileset dir="policies"/>
</copy>
<mkdir dir="${targetImageDir}/src/${relativeSrcDir}/data" />
<copy todir="${targetImageDir}/src/${relativeSrcDir}/data">
<fileset dir="data"/>
</copy>
<mkdir dir="${targetImageDir}/src/${relativeSrcDir}/http" />
<copy todir="${targetImageDir}/src/${relativeSrcDir}/http">
<fileset dir="http"/>
</copy>
<!-- jar up the image -->
<jar jarfile="${imageJarFile}" basedir="${targetImageDir}"
includes="**" />
</target>
<!-- This target creates documents, in particular javadocs -->
<target name="docs">
<!-- create javadocs -->
<mkdir dir="docs/javadocs" />
<!-- generate the javadocs you want here -->
<javadoc
sourcefiles="*.java"
sourcepath=""
destdir="docs/javadocs"
author="true"
version="true"
use="true"
windowtitle="Test API"
doctitle="<h1>Test<h1>"
bottom="<i>Copyright © 2001 General Dynamics Decision Systems Inc. All Rights Reserved.</i>">
</javadoc>
</target>
<!-- This target will generate any policies -->
<target name="policy">
<!-- generate the policy -->
<java classname="com.mot.openwings.policy.core.PolicyBuilder"
fork="yes">
<sysproperty
key="com.mot.openwings.policy.core.ParserBuilder"
value="com.mot.openwings.policy.core.SaxParserBuilder"/>
<classpath>
<pathelement location="${targetClassDir}"/>
<pathelement location="${sunXmlHome}/lib/xml.jar"/>
<pathelement location="${xercesHome}/lib/xerces.jar"/>
<pathelement location=
"${libDir}/ow_policy.jar"/>
<pathelement location=
"${libDir}/mot_policy_core.jar"/>
</classpath>
<arg value="${package}.POLICY_NAME_HERE"/>
<arg value="${package}"/>
</java>
<!-- the policy gets generated under a sub-directory -->
<copy todir=".">
<fileset dir="${relativeSrcDir}"
includes="POLICY_NAME_HEREImpl.java"/>
</copy>
<copy todir="policies">
<fileset dir="${relativeSrcDir}" includes="*.xml"/>
</copy>
<copy todir="policies">
<fileset dir="${relativeSrcDir}" includes="*.xsd"/>
</copy>
<!-- compile it -->
<javac srcdir="."
destdir="${classDir}"
debug="on"
includes="ImagePolicyImpl.java" >
<classpath>
<pathelement location="${targetClassDir}"/>
<pathelement location="${sunXmlHome}/lib/xml.jar"/>
<pathelement location="${xercesHome}/lib/xerces.jar"/>
<pathelement location="${libDir}/ow_policy.jar"/>
<pathelement location=
"${libDir}/mot_policy_core.jar"/>
</classpath>
</javac>
<!-- save the POLICY_NAME_HERE -->
<java classname="${package}.POLICY_NAME_HERESaver" fork="yes">
<classpath>
<pathelement location="${targetClassDir}"/>
<pathelement location="${sunXmlHome}/lib/xml.jar"/>
<pathelement location="${xercesHome}/lib/xerces.jar"/>
<pathelement location="${libDir}/ow_policy.jar"/>
<pathelement location=
"${libDir}/mot_policy_core.jar"/>
</classpath>
<arg value="${targetSrcDir}/policies/ImagePolicy.xml"/>
</java>
</target>
<!-- This target will cause this component regression tested. -->
<target name="test">
<!-- execute test suite here -->
</target>
<!-- This target will cause this component to be deployed, requires
an image target -->
<target name="deploy">
<!-- copy the install jar to the the openwings hotinstall
directory -->
</target>
<!-- This target will cause this component to be published on a web
server. This requires a image target -->
<target name="publish">
<!-- copy the install jar to a web server -->
</target>
</project>
|