Show build.xml syntax highlighted
<?xml version="1.0" encoding="UTF-8"?>
<project name="gb-agent" default="help" basedir="../..">
<!-- Set the relative path to current module directory -->
<property name="module.dir" value="${basedir}/gb-agent/gb-agent"/>
<!-- ================================================================== -->
<!-- Setup the builder environment-->
<!-- ================================================================== -->
<!-- Common GridBlocks build scripts -->
<import file="${basedir}/builder/builder.xml"/>
<!-- GridBlocks modules and their dependencies -->
<import file="${basedir}/builder/modules.xml"/>
<!-- ================================================================= -->
<!-- Initialisation-->
<!-- ================================================================= -->
<!-- Initialise the common build system.
Other targets should depend on this init before doing anything. -->
<target name="init" unless="builder:initialised" depends="modules:init, builder:init">
</target>
<!-- ================================================================= -->
<!-- Module dependent configuration-->
<!-- ================================================================= -->
<!-- Initialise module dependent configurations. Called automatically
from build script. -->
<target name="configure">
<!-- Module name and version -->
<property name="module.name" value="gb-agent"/>
<property name="module.version" value="${agent.version}"/>
<!-- local property names -->
<property name="module.lib-se" value="${module.dir}/lib-se"/>
<property name="source.agents" value="${module.source}/agents"/>
<property name="source.conf" value="${module.source}/conf"/>
<property name="source.extrastuff" value="${module.dir}/extrastuff"/>
<property name="build.agents" value="${module.output}/agents"/>
<property name="build.onelib" value="${module.output}/gen-onelib"/>
<property name="build.client" value="${module.output}/gb-agent_jar"/>
<property name="build.war" value="${module.output}/gb-agent_war"/>
<property name="build.sar" value="${module.output}/gb-agent_sar"/>
<property name="build.wstools" value="${module.output}/wstools"/>
<property name="release.client" value="gb-agent.jar"/>
<property name="release.bootclasspath" value="gb-boot.jar"/>
<property name="release.war" value="gb-agent.war"/>
<property name="release.sar" value="gb-agent.sar"/>
<property name="resource.agents" value="${source.resources}/agents"/>
<property name="resource.storage" value="${source.resources}/storage"/>
<!-- external libraries -->
<property name="ext.globus" value="${module.dir}/ext/globus/"/>
<property name="ext.jbossaop" value="${module.dir}/ext/aop/"/>
<property name="ext.jgroups" value="${module.dir}/ext/jgroups/"/>
<property name="ext.jbossws" value="${module.dir}/ext/jbossws/"/>
<!-- Javadoc package includes -->
<property name="javadoc.packages" value="fi.hip.gb.*"/>
<!-- Additional bootclasspath variables for building-->
<property name="bootclasspath.local" value=""/>
<!-- bootstrap classpath for AOP -->
<property name="build.bootclasspath" value="${module.output}/gen-bootclasspath"/>
<!-- External libraries needed for building-->
<path id="library.classpath">
<path location="/home/jboss/jboss/client/"/>
<!-- Module dependencies -->
<path refid="bluetooth.classpath"/>
<!-- for building -->
<fileset dir="${module.buildlib}">
<include name="**/*.jar"/>
</fileset>
<!-- J2EE libraries for J2SE environment -->
<fileset dir="${module.lib-se}">
<include name="**/*.jar"/>
</fileset>
<!-- 3rd party libraries -->
<fileset dir="${module.lib}">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${module.dir}/ext" includes="**/*.jar"/>
</path>
<!-- Classpath for building agents -->
<path id="agents.classpath">
<path location="${build.classes}"/>
<path refid="library.classpath"/>
</path>
<!-- Classpath for running code from Ant -->
<path id="run.classpath">
<path location="${source.conf}"/>
<path location="${build.etc}"/>
<path location="${build.etc}/WEB-INF/classes"/>
<path location="${build.classes}"/>
<path refid="library.classpath"/>
</path>
<!-- Used for aop classloading -->
<path id="aop.classpath">
<fileset dir="${module.lib-se}">
<include name="log4j*.jar"/>
<include name="jboss-common.jar"/>
</fileset>
<fileset dir="${ext.jbossaop}">
<include name="concurrent.jar"/>
<include name="javassist.jar"/>
<include name="jboss-aop*.jar"/>
<include name="jboss-dep.jar"/>
</fileset>
</path>
</target>
<!-- ================================================================= -->
<!-- Help-->
<!-- ================================================================= -->
<target name="help" depends="init,builder:help">
<echo>
Full documentation of build tasks can be found
from application documents package:
- docs/ant.html
- http://gridblocks.sourceforge.net/agent/ant.html
</echo>
</target>
<!-- ================================================================= -->
<!-- Default task-->
<!-- ================================================================= -->
<target name="all" depends="init, clean, test, release"
description="Clean, compile and release everything">
</target>
<!-- ================================================================= -->
<!-- Compilations-->
<!-- ================================================================= -->
<target name="compile"
depends="init,require:bluetooth,builder:compile-classes, compile-agents, compile-etc, compile-classloader"
description="Compile all class files">
</target>
<target name="compile-agents"
depends="init, require:bluetooth, builder:compile-classes"
description="Compiles sample agents.">
<mkdir dir="${build.agents}"/>
<javac
destdir="${build.agents}"
srcdir="${source.agents}"
classpathref="javac.classpath"
excludes=""
debug="${javac.debug}"
depend="${javac.depend}"
deprecation="${javac.deprecation}"
optimize="${javac.optimize}"
verbose="${javac.verbose}"
failonerror="${javac.fail.onerror}"
source="1.5">
<bootclasspath>
<path refid="javac.bootclasspath"/>
</bootclasspath>
<classpath refid="agents.classpath"/>
</javac>
<!--
<taskdef name="aopc" classname="org.jboss.aop.ant.AopC" classpathref="aop.classpath"/>
<aopc compilerclasspathref="aop.classpath" verbose="false">
<src path="${build.agents}"/>
<include name="**/HelloWorld.class"/>
<aoppath path="${source.conf}/jboss-aop.xml"/>
<classpath path="${build.agents}"/>
<classpath refid="library.classpath"/>
</aopc>
-->
</target>
<target name="compile-classloader" description=
"Generate a new modified class loader so we can perform load time instrumentation">
<java classname="org.jboss.aop.hook.GenerateInstrumentedClassLoader">
<classpath>
<path refid="aop.classpath"/>
</classpath>
<arg value="${build.bootclasspath}"/>
</java>
<path id="bootclasspath">
<pathelement location="${build.bootclasspath}"/>
<path refid="aop.classpath"/>
</path>
<property name="bootclasspath" refid="bootclasspath"/>
</target>
<target name="compile-etc" depends="init, compile-wstools" description="Copy etc files">
<mkdir dir="${build.etc}"/>
<mkdir dir="${build.etc}/WEB-INF"/>
<mkdir dir="${build.etc}/WEB-INF/classes"/>
<copy todir="${build.etc}" filtering="yes" overwrite="yes">
<fileset dir="${source.etc}">
<include name="**/*"/>
</fileset>
<filterset>
<filter token="gb.host.name" value="${hostname}"/>
</filterset>
</copy>
<!-- Compile all generated Java-code -->
<javac destdir="${build.etc}/WEB-INF/classes" classpathref="test.classpath" debug="on">
<src path="${build.etc}/WEB-INF"/>
</javac>
<copy todir="${build.classes}">
<fileset dir="${build.etc}/WEB-INF/classes" includes="**/*.class"/>
</copy>
</target>
<!-- generate artifacts, generated WSDL files are replaced later with manually
modified versions for attachment support -->
<target name="compile-wstools" depends="init" description="Create WS-configurations">
<!-- Define a taskdef for the wstools ant task -->
<taskdef name="wstools" classname="org.jboss.ws.tools.ant.wstools">
<classpath refid="javac.classpath"/>
<classpath path="${build.classes}"/>
</taskdef>
<!-- Generate code -->
<wstools dest="${build.etc}/WEB-INF" config="${source.conf}/wstools-config.xml"/>
</target>
<!-- ================================================================= -->
<!-- Documenting-->
<!-- ================================================================= -->
<target name="docs" depends="init,builder:docs-api"
description="Build Java documentation">
</target>
<!-- ================================================================= -->
<!-- Archives -->
<!-- ================================================================= -->
<target name="jars" depends="init,compile"
description="Build JAR class files">
<mkdir dir="${build.lib}"/>
<!-- core classes -->
<delete file="${build.lib}/gb-core.jar"/>
<jar jarfile="${build.lib}/gb-core.jar" update="false">
<fileset dir="${build.classes}">
<include name="fi/hip/gb/bluetooth/**/*.class"/>
<include name="fi/hip/gb/core/**/*.class"/>
<include name="fi/hip/gb/data/**/*.class"/>
<include name="fi/hip/gb/net/**/*.class"/>
<include name="fi/hip/gb/mobile/**/*.class"/>
<include name="fi/hip/gb/serializer/**/*.class"/>
<include name="fi/hip/gb/utils/**/*.class"/>
<include name="org/edg/security/**/*.class"/>
<include name="org/glite/security/**/*.class"/>
</fileset>
</jar>
<!-- GUI classes -->
<delete file="${build.lib}/gb-gui.jar"/>
<jar jarfile="${build.lib}/gb-gui.jar" update="false">
<fileset dir="${build.classes}">
<include name="fi/hip/gb/client/**/*.class"/>
</fileset>
</jar>
<!-- server classes -->
<delete file="${build.lib}/gb-server.jar"/>
<jar jarfile="${build.lib}/gb-server.jar" update="false">
<fileset dir="${build.classes}">
<include name="fi/hip/gb/server/**/*.class"/>
</fileset>
</jar>
<!-- sample agents -->
<delete file="${build.lib}/sampleagents.jar"/>
<jar jarfile="${build.lib}/sampleagents.jar" update="false">
<fileset dir="${build.agents}">
<include name="**/*.class"/>
<!--exclude name="**/ImageGallery*.class"/>
<exclude name="**/ImageObserver*.class"/>
<exclude name="**/EcwImage.class"/-->
</fileset>
<fileset dir="${resource.agents}"/>
</jar>
<!-- unosat agents -->
<!--delete file="${build.lib}/unosatagents.jar"/>
<jar jarfile="${build.lib}/unosatagents.jar" update="false">
<fileset dir="${build.agents}">
<include name="**/ImageGallery*.class"/>
<include name="**/ImageObserver*.class"/>
<include name="**/EcwImage.class"/>
</fileset>
</jar-->
</target>
<!-- ================================================================= -->
<!-- Install and release -->
<!-- ================================================================= -->
<target name="release" depends="init, sar, war, client"
description="Release the module">
<copy file="${release.dir}/${release.client}" tofile="${release.dir}/${release.id}.jar" overwrite="true"/>
<copy file="${release.dir}/${release.sar}" tofile="${release.dir}/${release.id}.sar" overwrite="true"/>
<copy file="${release.dir}/${release.war}" tofile="${release.dir}/${release.id}.war" overwrite="true"/>
</target>
<!-- ================================================================= -->
<!-- Server distribution -->
<!-- ================================================================= -->
<target name="prepare-server" depends="init, require:midp, jars"
description="Copy needed files from source directory to deploy directory.">
<mkdir dir="${build.war}"/>
<copy todir="${build.war}/" flatten="true" overwrite="true">
<fileset dir="${source.web}"/>
<!-- include MIDP release files if they exist -->
<fileset dir="${midp.dir}" includes="${midp.release}"/>
</copy>
<mkdir dir="${build.war}/jobs"/>
<mkdir dir="${build.war}/jobs/storage"/>
<mkdir dir="${resource.storage}"/>
<copy todir="${build.war}/jobs/storage" overwrite="true">
<fileset dir="${resource.storage}"/>
</copy>
<copy todir="${build.war}" overwrite="true">
<fileset dir="${build.etc}" includes="WEB-INF/**"/>
</copy>
<!--copy file="${build.etc}/log4j.xml" todir="${build.war}/WEB-INF/classes" overwrite="true"/-->
<mkdir dir="${build.war}/WEB-INF/lib"/>
<mkdir dir="${build.war}/deploy"/>
<copy todir="${build.war}/deploy" flatten="true" overwrite="true">
<fileset file="${build.lib}/sampleagents.jar"/>
<!-- Unosat agents with bluetooth dependency jar -->
<!--fileset file="${build.lib}/unosatagents.jar"/>
<fileset dir="${bluetooth.dir}" includes="${bluetooth.jars}"/-->
</copy>
</target>
<target name="prepare-war" depends="init, prepare-server"
description="Prepare WAR file for Tomcat with J2EE libraries.">
<copy todir="${build.war}/WEB-INF/lib" flatten="true" overwrite="true">
<!-- J2EE libraries for JavaSE -->
<fileset dir="${module.lib-se}"/>
<fileset dir="${ext.jbossaop}" includes="*.jar"/>
<!--fileset dir="${ext.jbossws}" includes="jbossws-client.jar"/-->
<!-- include Bluetooth release -->
<!--fileset dir="${bluetooth.dir}" includes="${bluetooth.jars}"/-->
<fileset dir="${module.lib}"/>
<fileset dir="${ext.globus}" includes="*.jar"/>
<!-- release jars -->
<fileset dir="${agent.dir}" includes="${agent.jars}" />
</copy>
</target>
<target name="server" depends="sar, war"
description="Build server distributions (WAR and SAR)">
</target>
<!-- creates WAR file -->
<target name="createwar" depends="init, prepare-server"
description="Build WAR file (for internal use only).">
<delete file="${release.dir}/${release.war}"/>
<jar jarfile="${release.dir}/${release.war}"
basedir="${build.war}"/>
<!--war warfile="${release.dir}/${release.war}"
webxml="${build.etc}/WEB-INF/web.xml"
basedir="${build.war}">
<classes dir="${build.dir}/classes">
<include name="org/jboss/test/ws/samples/jsr181pojo/JSEBean01.class"/>
<include ="org/jboss/test/ws/samples/jsr181pojo/JSEBean01.class"/>
</classes>
</war-->
</target>
<!-- WAR release for Tomcat -->
<target name="war" depends="init, prepare-war, createwar"
description="Build WAR file for Tomcat.">
</target>
<target name="sar" depends="init, prepare-server, createwar"
description="Build SAR file for JBoss">
<copy file="${release.dir}/${release.war}" tofile="${build.sar}/${release.war}" overwrite="true"/>
<copy todir="${build.sar}" overwrite="true">
<fileset dir="${build.etc}" includes="META-INF/**"/>
<fileset dir="${build.etc}/WEB-INF/classes" includes="gb-agent.*"/>
</copy>
<mkdir dir="${build.sar}/lib"/>
<copy todir="${build.sar}/lib" flatten="true" overwrite="true">
<!--fileset dir="${module.lib}"/-->
<fileset dir="${ext.globus}" includes="*.jar"/>
<!-- release jars -->
<fileset dir="${agent.dir}" includes="${agent.jars}" />
</copy>
<!-- AOP interceptors <fileset dir="${build.etc}" includes="META-INF/jboss-aop.xml"/> -->
<!--
<delete file="${build.sar}/gb-agent.aop"/>
<jar jarfile="${build.sar}/gb-agent.aop">
<fileset dir="${build.etc}" includes="META-INF/jboss-aop.xml"/>
<fileset dir="${build.classes}">
<include name="fi/hip/gb/server/*Interceptor.class"/>
</fileset>
</jar>
-->
<delete file="${release.dir}/${release.sar}"/>
<jar jarfile="${release.dir}/${release.sar}"
basedir="${build.sar}">
</jar>
</target>
<target name="deploy-war" depends="builder:require_tomcat,war"
description="Deploy the WAR under TOMCAT.">
<echo message="Tomcat deploy directory = ${tomcat.deploy.dir}"/>
<copy file="${release.dir}/${release.war}" todir="${tomcat.deploy.dir}" overwrite="true"/>
<!-- The application dir could be symlink to deploy/${app.name} -->
<delete dir="${tomcat.deploy.dir}/${module.name}"/>
</target>
<target name="deploy-sar" depends="builder:require_jboss,sar"
description="Deploy the SAR file under JBOSS.">
<echo message="JBoss deploy directory is = ${jboss.deploy.dir}"/>
<copy file="${release.dir}/${release.sar}" todir="${jboss.deploy.dir}" overwrite="true"/>
</target>
<target name="deploy-unwar" depends="builder:require_jboss,war"
description="Deploy exploded WAR file under JBOSS.">
<echo message="JBoss deploy directory is = ${jboss.deploy.dir}/${release.war}"/>
<unwar src="${release.dir}/${release.war}"
dest="${jboss.deploy.dir}/${release.war}" overwrite="yes"/>
</target>
<!-- ================================================================= -->
<!-- Client distribution -->
<!-- ================================================================= -->
<target name="prepare-gui" depends="init, jars"
description="Prepares the client distribution. This is enought to run the client.">
<mkdir dir="${build.gui}"/>
<mkdir dir="${build.gui}/bin"/>
<mkdir dir="${build.gui}/conf"/>
<mkdir dir="${build.gui}/lib"/>
<mkdir dir="${build.gui}/resources"/>
<mkdir dir="${build.gui}/src"/>
<mkdir dir="${build.gui}/src/agents"/>
<copy todir="${build.gui}" overwrite="true">
<fileset dir="." excludes="~ **/CVS">
<include name="CHANGES"/>
<include name="README"/>
<include name="INSTALL"/>
<include name="TODO"/>
</fileset>
<fileset dir="${build.lib}" includes="*agents.jar"/>
</copy>
<copy todir="${build.gui}/bin" overwrite="true">
<fileset dir="${source.bin}" includes="*.bat, *.sh"/>
<fileset dir="${build.bootclasspath}"/>
</copy>
<chmod dir="${build.gui}/bin" perm="0755" includes="*.sh"/>
<copy todir="${build.gui}/conf" overwrite="true">
<fileset dir="${source.conf}" excludes="gb-agent.properties"/>
<fileset dir="${build.etc}" includes="WEB-INF/**"/>
</copy>
<copy todir="${build.gui}/lib" flatten="true" overwrite="true">
<!-- include Bluetooth release and libraries -->
<fileset dir="${bluetooth.dir}" includes="${bluetooth.jars}"/>
<!-- release jars -->
<fileset dir="${agent.dir}" includes="${agent.jars}" />
<fileset dir="${ext.jbossaop}" includes="*.jar"/>
<fileset dir="${ext.jbossws}" includes="*.jar"/>
<fileset dir="${ext.globus}" includes="*.jar"/>
<fileset dir="${module.lib-se}" includes="*.jar"/>
<fileset dir="${module.lib}" includes="*.jar"/>
</copy>
<copy todir="${build.gui}/resources" overwrite="true">
<fileset dir="${source.resources}"/>
</copy>
<copy todir="${build.gui}/src/agents" overwrite="true">
<fileset dir="${source.agents}" includes="**/*.java"/>
</copy>
</target>
<target name="client" depends="init,jars"
description="Create a client library and dependencies for AOP" >
<!-- target directory for all client distribution -->
<mkdir dir="${build.client}"/>
<!-- package the boot libraries -->
<mkdir dir="${build.bootclasspath}"/>
<unjar dest="${build.bootclasspath}">
<fileset dir="${ext.jbossaop}"/>
<fileset file="${module.lib-se}/jboss-common.jar"/>
<fileset file="${module.lib-se}/log4j*.jar"/>
</unjar>
<delete file="${build.client}/${release.bootclasspath}"/>
<jar jarfile="${build.client}/${release.bootclasspath}" manifest="${source.conf}/MANIFEST.MF">
<zipfileset dir="${build.bootclasspath}"/>
</jar>
<!-- package all the required runtime libraries in one JAR file -->
<mkdir dir="${build.onelib}"/>
<unjar dest="${build.onelib}">
<fileset file="${build.lib}/gb-core.jar"/>
<fileset file="${module.lib}/jboss-serialization.jar"/>
<fileset file="${module.lib-se}/jboss-remoting.jar"/>
<fileset file="${module.lib-se}/commons-logging.jar"/>
<fileset file="${module.lib-se}/log4j*.jar"/>
<fileset file="${module.lib-se}/xercesImpl.jar"/>
<fileset dir="${ext.jbossws}" includes="wsdl4j.jar, jboss-saaj.jar, jboss-jaxrpc.jar, jboss-xml-binding.jar, jbossws-client.jar, jboss-jaxws.jar"/>
</unjar>
<copy todir="${build.onelib}" overwrite="true">
<fileset dir="${source.conf}" excludes="mobileagent.properties, jboss-aop.xml"/>
<fileset dir="${build.etc}" includes="WEB-INF/**"/>
</copy>
<delete file="${build.client}/gb-libs.jar"/>
<jar jarfile="${build.client}/gb-libs.jar" manifest="${source.conf}/MANIFEST.MF">
<zipfileset dir="${build.onelib}"/>
</jar>
<!-- other files required, signed jars and configuration files -->
<copy todir="${build.client}" flatten="true" overwrite="true">
<fileset dir="${ext.jbossws}" includes="mailapi.jar, activation.jar"/>
<fileset dir="${source.conf}" includes="mobileagent.properties, jboss-aop.xml"/>
</copy>
<jar jarfile="${release.dir}/${release.client}" manifest="${source.conf}/MANIFEST.MF">
<zipfileset dir="${build.client}"/>
</jar>
</target>
<!-- ================================================================= -->
<!-- Testing -->
<!-- ================================================================= -->
<target name="prepare-test" depends="init, compile"
description="Prepare for Unit testing">
<copy todir="${build.test}" overwrite="true">
<fileset dir="${source.conf}" includes="log4j.xml"/>
<fileset dir="${source.conf}" includes="gb-agent.*"/>
<fileset dir="${source.conf}" includes="english.properties"/>
</copy>
</target>
<target name="test" depends="init,prepare-test,builder:test"
description="Unit testing for all tests">
</target>
<target name="onetest" depends="builder:init,builder:compiletests"
description="Perform one unit test">
<taskdef name="junit"
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask">
<classpath refid="test.classpath"/>
</taskdef>
<delete dir="${build.reports}"/>
<mkdir dir="${build.reports}"/>
<!--
fi.hip.gb.test.net.TestWSService
fi.hip.gb.test.serializer.TestSerializer
-->
<junit fork="yes" haltonfailure="yes">
<sysproperty key="GB_HOME" value="${module.dir}"/>
<test name="fi.hip.gb.test.net.TestWSService" todir="${build.reports}"/>
<formatter type="plain" usefile="false"/>
<formatter type="xml"/>
<classpath refid="test.classpath"/>
</junit>
</target>
<target name="run" depends="init"
description="Run the code">
<!--
fi.hip.gb.net.SessionFactory
fi.hip.gb.net.discovery.JAXRClient
fi.hip.gb.client.Main
fi.hip.gb.serializer.XMLSerializer
-->
<property name="myclasspath" refid="run.classpath"/>
<echo message="classpath= ${myclasspath}"/>
<java classname="fi.hip.gb.net.SessionFactory" fork="true">
<classpath refid="run.classpath"></classpath>
<!--arg value="-r"/-->
<!--sysproperty key="user.dir" value="${module.dir}"/-->
</java>
</target>
<!-- ================================================================= -->
<!-- Cleaning -->
<!-- ================================================================= -->
<target name="clean" depends="init,builder:clean"
description="Clean up everything">
</target>
</project>
See more files for this project here