Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="UTF-8"?>
- <project name="museumdb" default="dist" basedir=".">
- <description>Builds, tests, and runs the project.</description>
- <!-- ******************************************************************* -->
- <!-- * Project Home Directories * -->
- <!-- ******************************************************************* -->
- <!-- * We should include most dependancy jars in the repository. * -->
- <!-- ******************************************************************* -->
- <!-- Override this with "ant -Dconf.home=./conf.example deploy" -->
- <property name="conf.home" value="${basedir}/conf/local" />
- <!-- Load the build environment properties -->
- <property file="${conf.home}/build.properties"/>
- <!-- ******************************************************************* -->
- <!-- * Classpath Parameters * -->
- <!-- ******************************************************************* -->
- <!-- * The different classpaths that are used in the build process. * -->
- <!-- ******************************************************************* -->
- <path id="log4j.classpath">
- <fileset dir="${log4j.home}" id="log4j.files" includes="log4j-1.2.8.jar"/>
- </path>
- <path id="dist.classpath">
- <pathelement location="${dist.home}"/>
- </path>
- <path id="bin.classpath">
- <pathelement location="${bin.home}"/>
- </path>
- <path id="json-simple.classpath">
- <fileset dir="${json-simple.home}" id="json-simple.files" includes="json_simple-1.1.jar"/>
- </path>
- <path id="cas.classpath">
- <fileset dir="${cas.home}">
- <include name="cas.jar"/>
- <include name="cas-client-core-3.1.10.jar"/>
- </fileset>
- </path>
- <path id="jdbc.classpath">
- <fileset dir="${jdbc.home}" id="jdbc.files">
- <include name="postgres-*.jar"/>
- <include name="mysql-connector*.jar"/>
- <include name="commons-logging-1.1*.jar"/>
- </fileset>
- </path>
- <path id="tomcat.classpath">
- <fileset dir="${tomcat.home}" id="tomcat.files">
- <include name="catalina-ant.jar"/>
- <include name="servlet-api-2.5.jar"/>
- </fileset>
- </path>
- <path id="ant-contrib.classpath">
- <fileset dir="${ant-contrib.home}" id="ant-contrib.files">
- <include name="ant-contrib-0.6.jar"/>
- </fileset>
- </path>
- <path id="sysUtil.classpath">
- <fileset dir="${sysUtil.home}" id="sysUtil.files">
- <include name="ca.usask.cs.sysUtil.jar"/>
- </fileset>
- </path>
- <!-- TODO FIXME added by Dylan. Clean as necessary! -->
- <path id="junit.classpath">
- <fileset dir="${junit.home}" id="junit.files">
- <include name="junit-4.8.2.jar"/>
- </fileset>
- </path>
- <path id="lib.classpath">
- <pathelement location="${lib.home}"/>
- </path>
- <path id="test.classpath">
- <pathelement location="${test.home}"/>
- </path>
- <path id="selenium.rc.classpath">
- <fileset dir="${selenium.rc.home}" id="selenium.rc.files">
- <include name="selenium-java-client-driver.jar"/>
- </fileset>
- </path>
- <path id="spring.classpath">
- <fileset dir="${spring.home}" id="spring.files">
- <include name="spring*.jar"/>
- </fileset>
- </path>
- <path id="transaction.classpath">
- <fileset dir="${lib.home}" id="transaction.files">
- <include name="aopalliance.jar"/>
- </fileset>
- </path>
- <path id="jstl.classpath">
- <fileset dir="${lib.home}" id="jstl.files">
- <include name="jstl-impl-1.2.jar"/>
- <include name="standard.jar" />
- </fileset>
- </path>
- <path id="mockito.classpath">
- <fileset dir="${lib.home}" id="mockito.files">
- <include name="mockito-all-1.8.5.jar"/>
- </fileset>
- </path>
- <path id="reflections.classpath">
- <fileset dir="${lib.home}" id="reflections.files">
- <include name="reflections-0.9.5-RC2.jar"/>
- <include name="google-collections-1.0.jar"/>
- <include name="slf4j-api-1.5.6.jar"/>
- <include name="logback-classic-0.9.9.jar"/>
- <include name="gson-1.4.jar"/>
- <include name="dom4j-1.6.jar"/>
- <include name="xml-apis-1.0.b2.jar"/>
- <include name="servlet-api-2.5.jar"/>
- <include name="javassist-3.8.0.GA.jar"/>
- <include name="logback-core-0.9.9.jar"/>
- </fileset>
- </path>
- <path id="cobertura.classpath">
- <fileset dir="${cobertura.home}">
- <include name="cobertura.jar" />
- <include name="asm-3.0.jar" />
- <include name="asm-tree-3.0.jar" />
- <include name="jakarta-oro-2.0.8.jar" />
- <include name="log4j-1.2.9.jar" />
- </fileset>
- </path>
- <!-- ******************************************************************* -->
- <!-- * Task Definitions * -->
- <!-- ******************************************************************* -->
- <!-- * This area identifies the external ant tasks that we want to be * -->
- <!-- * able to use. Of particular interest are the tomcat tasks, * -->
- <!-- * which can be used for automatic deployment, as well as the * -->
- <!-- * ant-contrib tasks which contain additional useful ant routines. * -->
- <!-- ******************************************************************* -->
- <taskdef name="tomcat-stop" classname="org.apache.catalina.ant.StopTask">
- <classpath refid="tomcat.classpath"/>
- </taskdef>
- <taskdef name="tomcat-start" classname="org.apache.catalina.ant.StartTask">
- <classpath refid="tomcat.classpath"/>
- </taskdef>
- <taskdef name="tomcat-deploy" classname="org.apache.catalina.ant.DeployTask">
- <classpath refid="tomcat.classpath"/>
- </taskdef>
- <taskdef name="tomcat-undeploy" classname="org.apache.catalina.ant.UndeployTask">
- <classpath refid="tomcat.classpath"/>
- </taskdef>
- <taskdef resource="net/sf/antcontrib/antcontrib.properties">
- <classpath refid="ant-contrib.classpath"/>
- </taskdef>
- <taskdef classpathref="cobertura.classpath" resource="tasks.properties"/>
- <!-- ******************************************************************* -->
- <!-- * Targets * -->
- <!-- ******************************************************************* -->
- <!-- * The meat of the ant build file, each target is an action that * -->
- <!-- * you want to be able to perform. * -->
- <!-- ******************************************************************* -->
- <target name="clean"
- description="Removes the built classes." >
- <delete dir="${dist.home}" />
- <delete dir="${admin.home}" />
- </target>
- <target name="doc" description="Builds javadoc documentation." >
- <echo> Generating javadoc at ${src.home}</echo>
- <javadoc destdir="${docs.home}/api"
- sourcepath="${src.home}/java/ca/usask/cs/museum/"
- source="1.6"
- windowtitle="API Documentation">
- <classpath>
- <!--<pathelement location="${bin.home}" />-->
- <fileset dir="${basedir}/lib">
- <include name="*.jar"/>
- </fileset>
- </classpath>
- <fileset dir="${basedir}/src/java/ca/usask/cs/museum">
- <!--<include name="acquisition/controllers/*.java"/>-->
- <include name="**/**/*.java"/>
- </fileset>
- </javadoc>
- </target>
- <target name="build"
- depends="clean"
- description="Builds class tree from sources." >
- <echo message="Building."/>
- <mkdir dir="${bin.home}"/>
- <javac source="1.6" debug="true" deprecation="true"
- destdir="${bin.home}" fork="true" srcdir="${src.home}"
- includeantruntime="false">
- <classpath refid="tomcat.classpath"/>
- <classpath refid="cas.classpath"/>
- <classpath refid="log4j.classpath"/>
- <classpath refid="json-simple.classpath" />
- <classpath refid="sysUtil.classpath"/>
- <classpath refid="jdbc.classpath"/>
- <classpath refid="spring.classpath"/>
- <classpath refid="transaction.classpath" />
- <classpath refid="jstl.classpath" />
- </javac>
- </target>
- <!-- Cleans some directories prior to tests.-->
- <target name="pre-test">
- <echo message="Cleaning old coverage reports."/>
- <delete dir="${cobertura.report.home}"/>
- <mkdir dir="${cobertura.report.home}"/>
- </target>
- <target name="build-test"
- description="Compile the test source tree"
- depends="pre-test">
- <echo message="Building test files."/>
- <mkdir dir="${bin.home}" />
- <javac destdir="${bin.home}" source="1.6" target="1.6"
- debug="true" fork="true" deprecation="false"
- optimize="false" failonerror="true"
- includeantruntime="false" >
- <src path="${test.home}" />
- <classpath refid="tomcat.classpath"/>
- <classpath refid="cas.classpath"/>
- <classpath refid="log4j.classpath"/>
- <classpath refid="json-simple.classpath" />
- <classpath refid="sysUtil.classpath"/>
- <classpath refid="selenium.rc.classpath"/>
- <classpath refid="junit.classpath"/>
- <classpath refid="spring.classpath"/>
- <classpath refid="mockito.classpath"/>
- <classpath refid="reflections.classpath"/>
- <classpath refid="transaction.classpath" />
- <classpath refid="jstl.classpath" />
- </javac>
- <!-- Cobertura stuff. -->
- <cobertura-instrument todir="${cobertura.bin.home}">
- <fileset dir="${bin.home}">
- <include name="**/*.class"/>
- </fileset>
- </cobertura-instrument>
- </target>
- <target name="dist"
- depends="build"
- description="Creates war archive to deploy application" >
- <!-- Copy configuration files into classes dir (so they're in the classpath) -->
- <copy overwrite="yes" todir="${dist.home}/WEB-INF/classes">
- <fileset dir="${conf.home}" includes="*.properties" />
- </copy>
- <!-- Copy context.xml to META-INF -->
- <copy overwrite="yes" file="${conf.home}/context.xml" tofile="${dist.home}/META-INF/context.xml" />
- <!-- Copy web.xml to WEB-INF -->
- <copy overwrite="yes" file="${conf.home}/web.xml" tofile="${dist.home}/WEB-INF/web.xml" />
- <!-- Copy *some of the* libraries into lib dir -->
- <copy overwrite="yes" todir="${dist.home}/WEB-INF/lib">
- <!--<fileset dir="${cas.home}" includes="**/*" />
- <fileset dir="${log4j.home}" includes="**/*" />
- <fileset dir="${json-simple.home}" includes="**/*" />
- <fileset dir="${sysUtil.home}" includes="**/*" />
- <fileset dir="${jdbc.home}" includes="**/*" />
- <fileset dir="${spring.home}" includes="**/*.jar" />-->
- <fileset dir="${lib.home}" includes="**/*.jar" />
- </copy>
- <!-- Copy web stuff into deploy root -->
- <copy overwrite="yes" todir="${dist.home}">
- <fileset dir="${basedir}/web" includes="**/*" />
- </copy>
- <jar destfile="${basedir}/${dist.name}.war" compress="true">
- <fileset dir="${dist.home}" />
- </jar>
- </target>
- <target name="deploy"
- description="Deploys to remote tomcat instances."
- depends="dist,astyle">
- <foreach list="${machines}"
- target="_deploy-single"
- param="identifier" />
- </target>
- <!--Added by: Jordan Johns
- Purpose: To run Artistic Style on your source to ensure all our coding style/format is the same. -->
- <target name="astyle" description="Runs astyle on your source.">
- <!-- LINUX CONDITIONAL EXECUTION-->
- <exec executable="${basedir}/lib/astyle/linux/astyle" osfamily="unix">
- <arg value="--style=allman"/>
- <arg value="--recursive"/>
- <arg value="${basedir}/*.java"/>
- </exec>
- <!-- MAC CONDITIONAL EXECUTION-->
- <exec executable="${basedir}/lib/astyle/mac/astyle" osfamily="mac">
- <arg value="--style=allman"/>
- <arg value="--recursive"/>
- <arg value="${basedir}/*.java"/>
- </exec>
- <!-- WINDOWS CONDITIONAL EXECUTION-->
- <exec executable="${basedir}/lib/astyle/windows/Astyle.exe" osfamily="windows">
- <arg value="--style=allman"/>
- <arg value="--recursive"/>
- <arg value="${basedir}/*.java"/>
- </exec>
- </target>
- <condition property="foo.path" value="C:\Foo\Dir">
- <os family="windows"/>
- </condition>
- <condition property="foo.path" value="/home/foo/dir">
- <os family="unix"/>
- </condition>
- <!--<target name="tomcat-start">
- <java jar="${catalina.home}/bin/bootstrap.jar" fork="true">
- <jvmarg value="-Dcatalina.home=${catalina.home}"/>
- </java>
- </target>
- <target name="tomcat-stop">
- <java jar="${catalina.home}/bin/bootstrap.jar" fork="true">
- <jvmarg value="-Dcatalina.home=${catalina.home}"/>
- <arg line="stop"/>
- </java>
- </target>-->
- <target name="_deploy-single"
- description="Deploys web app to a single tomcat instance from passed in identifier variable" >
- <!-- get specific properties from passed in machine name -->
- <propertycopy property="current.manager.url" from="${identifier}.manager.url" />
- <propertycopy property="current.manager.username" from="${identifier}.manager.username" />
- <propertycopy property="current.manager.password" from="${identifier}.manager.password" />
- <propertycopy property="current.manager.path" from="${identifier}.manager.path" />
- <echo message="Preparing to deploy to ${identifier}" />
- <echo message="Using ${current.manager.username} on ${current.manager.url} with path ${current.manager.path}" />
- <!-- stop the current service -->
- <echo>Stopping old museumdb instance.</echo>
- <trycatch>
- <try>
- <tomcat-stop url="${current.manager.url}"
- username="${current.manager.username}"
- password="${current.manager.password}"
- path="${current.manager.path}"/>
- </try>
- <catch>
- </catch>
- </trycatch>
- <!-- undeploy the old war -->
- <echo>Undeploying old museumdb instance.</echo>
- <trycatch>
- <try>
- <tomcat-undeploy url="${current.manager.url}"
- username="${current.manager.username}"
- password="${current.manager.password}"
- path="${current.manager.path}"/>
- </try>
- <catch>
- </catch>
- </trycatch>
- <!-- deploy the new war -->
- <echo>Deploying new museumdb instance.</echo>
- <trycatch>
- <try>
- <tomcat-deploy url="${current.manager.url}"
- username="${current.manager.username}"
- password="${current.manager.password}"
- war="${basedir}/${dist.name}.war"
- path="${current.manager.path}"/>
- <echo message="Deployed to ${current.manager.path}" />
- </try>
- <catch>
- </catch>
- </trycatch>
- <echo>Starting new museumdb instance.</echo>
- <trycatch>
- <try>
- <tomcat-start url="${current.manager.url}"
- username="${current.manager.username}"
- password="${current.manager.password}"
- path="${current.manager.path}"/>
- </try>
- <catch>
- </catch>
- </trycatch>
- </target>
- <!-- TODO FIXME Added by Dylan. Buildmasta, please clean this up to your standards! TODO FIXME -->
- <!-- Runs JUnit tests on the project -->
- <target name="test" depends="build,build-test,deploy" >
- <echo message="Running all tests to make sure the project is sound" />
- <junit printsummary="yes" haltonfailure="no" showoutput="yes" >
- <sysproperty key="museumdb.website.address" value="${museumdb.website.address}"/>
- <sysproperty key="selenium.port" value="${selenium.port}"/>
- <!-- Specify the name of the coverage data file to use. -->
- <sysproperty key="net.sourceforge.cobertura.datafile" file="${cobertura.ser}" />
- <classpath location="${cobertura.bin.home}" />
- <classpath location="${bin.home}" />
- <classpath>
- <path refid="junit.classpath" />
- <path refid="lib.classpath" />
- <path refid="test.classpath" />
- <path refid="selenium.rc.classpath" />
- <path refid="spring.classpath" />
- <path refid="log4j.classpath" />
- <path refid="mockito.classpath"/>
- <path refid="reflections.classpath"/>
- <path refid="transaction.classpath" />
- <path refid="cobertura.classpath" />
- <path refid="jdbc.classpath" />
- </classpath>
- <formatter type="brief" usefile="false" />
- <formatter type="plain" />
- <batchtest fork="yes" >
- <fileset dir="${test.home}" >
- <include name="**/*Test*.java" />
- <exclude name="**/example/**" />
- <exclude name="**/test/utility/**" />
- <exclude name="**/test/annotations/**" />
- <exclude name="**/SmokeTestSuite.java" />
- </fileset>
- </batchtest>
- </junit>
- </target>
- <!-- Runs tests on the project, excluding GUI tests. -->
- <target name="no-gui-test" depends="build,build-test,deploy" >
- <echo message="Running all tests to make sure the project is sound" />
- <junit printsummary="yes" haltonfailure="no" showoutput="yes" >
- <sysproperty key="museumdb.website.address" value="${museumdb.website.address}"/>
- <sysproperty key="selenium.port" value="${selenium.port}"/>
- <!-- Specify the name of the coverage data file to use. -->
- <sysproperty key="net.sourceforge.cobertura.datafile" file="${cobertura.ser}" />
- <classpath location="${cobertura.bin.home}" />
- <classpath location="${bin.home}" />
- <classpath>
- <path refid="junit.classpath" />
- <path refid="lib.classpath" />
- <path refid="test.classpath" />
- <path refid="selenium.rc.classpath" />
- <path refid="spring.classpath" />
- <path refid="log4j.classpath" />
- <path refid="mockito.classpath"/>
- <path refid="reflections.classpath"/>
- <path refid="transaction.classpath" />
- <path refid="cobertura.classpath" />
- <path refid="jdbc.classpath" />
- </classpath>
- <formatter type="brief" usefile="false" />
- <formatter type="plain" />
- <batchtest fork="yes" >
- <fileset dir="${test.home}">
- <include name="**/*Test*.java" />
- <exclude name="**/test/gui/**" />
- <exclude name="**/example/**" />
- <exclude name="**/test/utility/**" />
- <exclude name="**/test/annotations/**" />
- <exclude name="**/SmokeTestSuite.java" />
- </fileset>
- </batchtest>
- </junit>
- </target>
- <!-- Runs the Smoke Test -->
- <target name="smoke-test" depends="build,build-test,deploy" >
- <echo message="Running smoke tests to make sure basic functionality is not compromised." />
- <junit printsummary="yes" haltonfailure="no" showoutput="yes" >
- <sysproperty key="museumdb.website.address" value="${museumdb.website.address}"/>
- <sysproperty key="selenium.port" value="${selenium.port}"/>
- <!-- Specify the name of the coverage data file to use. -->
- <sysproperty key="net.sourceforge.cobertura.datafile" file="${cobertura.ser}" />
- <classpath location="${cobertura.bin.home}" />
- <classpath location="${bin.home}" />
- <classpath>
- <path refid="junit.classpath" />
- <path refid="lib.classpath" />
- <path refid="test.classpath" />
- <path refid="selenium.rc.classpath" />
- <path refid="spring.classpath" />
- <path refid="log4j.classpath" />
- <path refid="mockito.classpath"/>
- <path refid="reflections.classpath"/>
- <path refid="transaction.classpath" />
- <path refid="cobertura.classpath" />
- <path refid="jdbc.classpath" />
- </classpath>
- <formatter type="brief" usefile="false" />
- <formatter type="plain" />
- <batchtest fork="yes" >
- <fileset dir="${test.home}" >
- <!-- IF THIS IS CHANGED, the "test" target must be updated as well, as it explicitly excludes the SmokeTestSuite class
- on the assumption that it runs all smoke tests.-->
- <include name="**/SmokeTestSuite.java" />
- </fileset>
- </batchtest>
- </junit>
- </target>
- <target name="generate-coverage-report">
- <cobertura-report srcdir="${src.home}" destdir="${cobertura.report.home}" datafile="${cobertura.ser}">
- <fileset dir="${src.home}">
- <include name="**/*.java" />
- </fileset>
- </cobertura-report>
- </target>
- </project>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement