2010-02-21 18:45:18 +00:00
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
|
2010-10-21 14:42:55 +00:00
|
|
|
<!-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
2010-02-21 18:45:18 +00:00
|
|
|
|
|
|
|
<!-- ======================================================================
|
|
|
|
Build script for the Vivo Products.
|
|
|
|
|
|
|
|
jeb228
|
|
|
|
======================================================================
-->
|
|
|
|
<project name="vivoProduct" default="describe">
|
|
|
|
|
|
|
|
<!--
|
|
|
|
This script should not be run on its own.
|
|
|
|
It should only be run from the build script of an individual Product.
|
|
|
|
-->
|
|
|
|
<fail>
|
|
|
|
<condition>
|
|
|
|
<equals arg1="${ant.file.vivoProduct}" arg2="${ant.file}" />
|
|
|
|
</condition>
|
|
|
|
This script should not be run by itself.
|
|
|
|
It should be invoked from the build script of a Vivo product.
|
|
|
|
</fail>
|
|
|
|
|
2010-08-03 18:53:55 +00:00
|
|
|
<fail unless="inner.basedir"
|
|
|
|
message="The build script for the product must define a value for inner.basedir" />
|
|
|
|
|
|
|
|
<!--
|
|
|
|
The build directory goes in the product directory.
|
|
|
|
Everything else hangs from the build directory.
|
|
|
|
-->
|
|
|
|
<property name="build.dir" location="./.build" />
|
|
|
|
<property name="war.dir" location="${build.dir}/war" />
|
|
|
|
<property name="war-webinf.dir" location="${war.dir}/WEB-INF" />
|
|
|
|
<property name="war-classes.dir" location="${war-webinf.dir}/classes" />
|
2010-10-25 21:29:25 +00:00
|
|
|
<property name="war-resources.dir" location="${war-webinf.dir}/resources" />
|
2010-08-03 18:53:55 +00:00
|
|
|
<property name="war-lib.dir" location="${war-webinf.dir}/lib" />
|
|
|
|
<property name="test-classes.dir" location="${build.dir}/testclasses" />
|
|
|
|
<property name="servletjars.dir" location="${build.dir}/servletjars" />
|
|
|
|
|
2010-02-21 18:45:18 +00:00
|
|
|
|
|
|
|
<!-- Is there a "src" directory in the product? -->
|
|
|
|
<property name="product.source.dir" location="./src" />
|
|
|
|
<available property="product.sources.exist" file="${product.source.dir}" />
|
|
|
|
|
|
|
|
<!-- Is there a "test" directory in the product? -->
|
|
|
|
<property name="product.test.dir" location="./test" />
|
|
|
|
<available property="product.tests.exist" file="${product.test.dir}" />
|
|
|
|
|
|
|
|
<!-- Is there a "themes" directory in the product? -->
|
|
|
|
<property name="product.themes.dir" location="./themes" />
|
|
|
|
<available property="product.themes.exist" file="${product.themes.dir}" />
|
|
|
|
|
2010-02-21 20:47:07 +00:00
|
|
|
<!-- Is there a modifications directory in the product? -->
|
|
|
|
<property name="product.modifications.dir" location="./modifications" />
|
|
|
|
<available property="product.modifications.exist" file="${product.modifications.dir}" />
|
|
|
|
|
2010-08-03 18:53:55 +00:00
|
|
|
<!-- - - - - - - - - - - - - - - - - -
|
|
|
|
paths: for compiling and running
|
|
|
|
- - - - - - - - - - - - - - - - - -->
|
|
|
|
<path id="compile.classpath">
|
|
|
|
<fileset dir="${war-lib.dir}">
|
|
|
|
<include name="**/*.jar" />
|
|
|
|
</fileset>
|
|
|
|
<fileset dir="${servletjars.dir}">
|
|
|
|
<include name="**/*.jar" />
|
2010-02-21 20:47:07 +00:00
|
|
|
</fileset>
|
2010-08-03 18:53:55 +00:00
|
|
|
</path>
|
2010-02-22 13:32:29 +00:00
|
|
|
|
2010-08-03 18:53:55 +00:00
|
|
|
<path id="test.compile.classpath">
|
2010-11-11 19:11:42 +00:00
|
|
|
<pathelement location="${product.test.dir}"/>
|
2010-08-03 18:53:55 +00:00
|
|
|
<pathelement location="${war-classes.dir}" />
|
2010-02-21 18:45:18 +00:00
|
|
|
<path refid="compile.classpath" />
|
|
|
|
</path>
|
|
|
|
|
2010-08-03 18:53:55 +00:00
|
|
|
<path id="test.run.classpath">
|
|
|
|
<pathelement location="${test-classes.dir}" />
|
2010-02-21 18:45:18 +00:00
|
|
|
<path refid="test.compile.classpath" />
|
|
|
|
</path>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- =================================
|
|
|
|
target: describe
|
|
|
|
================================= -->
|
2010-02-22 13:32:29 +00:00
|
|
|
<target name="describe" description="--> Describe the targets (this is the default).">
|
2010-08-03 18:53:55 +00:00
|
|
|
<innercall target="describe" />
|
2010-02-21 18:45:18 +00:00
|
|
|
</target>
|
|
|
|
|
|
|
|
<!-- =================================
|
|
|
|
target: all
|
|
|
|
================================= -->
|
2010-02-22 13:32:29 +00:00
|
|
|
<target name="all" depends="clean, deploy" description="--> Run 'clean', then 'deploy'" />
|
2010-02-21 18:45:18 +00:00
|
|
|
|
|
|
|
<!-- =================================
|
|
|
|
target: clean
|
|
|
|
================================= -->
|
2010-08-03 18:53:55 +00:00
|
|
|
<target name="clean" description="--> Delete all artifacts.">
|
|
|
|
<innercall target="clean" />
|
2010-02-21 18:45:18 +00:00
|
|
|
</target>
|
|
|
|
|
2010-08-03 18:53:55 +00:00
|
|
|
<!-- - - - - - - - - - - - - - - - - -
|
|
|
|
target: productPrepare
|
|
|
|
- - - - - - - - - - - - - - - - - -->
|
|
|
|
<target name="productPrepare">
|
|
|
|
<antcall target="prepareThemes" />
|
|
|
|
<antcall target="prepareModifications" />
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<!-- - - - - - - - - - - - - - - - - -
|
|
|
|
target: prepareThemes
|
|
|
|
- - - - - - - - - - - - - - - - - -->
|
|
|
|
<target name="prepareThemes" if="product.themes.exist">
|
2010-02-22 16:45:54 +00:00
|
|
|
<copy todir="${build.dir}/war/themes" overwrite="true">
|
2010-02-21 18:45:18 +00:00
|
|
|
<fileset dir="${product.themes.dir}" />
|
|
|
|
</copy>
|
2010-08-03 18:53:55 +00:00
|
|
|
</target>
|
2010-02-21 18:45:18 +00:00
|
|
|
|
2010-08-03 18:53:55 +00:00
|
|
|
<!-- - - - - - - - - - - - - - - - - -
|
|
|
|
target: prepareModifications
|
|
|
|
- - - - - - - - - - - - - - - - - -->
|
|
|
|
<target name="prepareModifications" if="product.modifications.exist">
|
2010-02-22 16:45:54 +00:00
|
|
|
<copy todir="${build.dir}/war" overwrite="true">
|
2010-02-21 20:47:07 +00:00
|
|
|
<fileset dir="${product.modifications.dir}" />
|
2010-02-21 18:45:18 +00:00
|
|
|
</copy>
|
2010-08-03 18:53:55 +00:00
|
|
|
</target>
|
|
|
|
|
2010-02-21 18:45:18 +00:00
|
|
|
|
2010-08-03 18:53:55 +00:00
|
|
|
<!-- =================================
|
|
|
|
target: compile
|
|
|
|
================================= -->
|
|
|
|
<target name="compile" description="--> Compile Java sources.">
|
|
|
|
<innercall target="compile" />
|
|
|
|
<antcall target="productCompile" />
|
|
|
|
</target>
|
2010-02-21 18:45:18 +00:00
|
|
|
|
2010-08-03 18:53:55 +00:00
|
|
|
<!-- - - - - - - - - - - - - - - - - -
|
|
|
|
target: productCompile
|
|
|
|
- - - - - - - - - - - - - - - - - -->
|
|
|
|
<target name="productCompile" depends="productPrepare" if="product.sources.exist">
|
2010-10-21 14:42:55 +00:00
|
|
|
<property name="product.classes.dir" value="${build.dir}/${ant.project.name}/classes" />
|
|
|
|
<mkdir dir="${product.classes.dir}" />
|
2010-02-21 18:45:18 +00:00
|
|
|
<javac srcdir="${product.source.dir}"
|
2010-10-21 14:42:55 +00:00
|
|
|
destdir="${product.classes.dir}"
|
2010-02-21 18:45:18 +00:00
|
|
|
debug="true"
|
|
|
|
deprecation="true"
|
2010-12-15 17:07:49 +00:00
|
|
|
encoding="UTF8"
|
2010-02-21 18:45:18 +00:00
|
|
|
optimize="true"
|
2010-08-03 18:53:55 +00:00
|
|
|
source="1.6">
|
2010-10-21 14:42:55 +00:00
|
|
|
<classpath>
|
|
|
|
<path refid="compile.classpath" />
|
|
|
|
<pathelement location="${build.dir}/war/WEB-INF/classes"/>
|
|
|
|
</classpath>
|
2010-02-21 18:45:18 +00:00
|
|
|
</javac>
|
2010-10-21 14:42:55 +00:00
|
|
|
<copy todir="${build.dir}/war/WEB-INF/classes" overwrite="true">
|
|
|
|
<fileset dir="${product.classes.dir}" />
|
|
|
|
</copy>
|
2010-02-21 18:45:18 +00:00
|
|
|
</target>
|
|
|
|
|
2010-08-03 18:53:55 +00:00
|
|
|
<!-- =================================
|
|
|
|
target: test
|
|
|
|
================================= -->
|
2010-10-18 20:25:17 +00:00
|
|
|
<target name="test" description="--> Run JUnit tests">
|
2010-08-03 18:53:55 +00:00
|
|
|
<innercall target="test" />
|
|
|
|
<antcall target="productTest" />
|
|
|
|
</target>
|
|
|
|
|
2010-02-21 18:45:18 +00:00
|
|
|
<!-- - - - - - - - - - - - - - - - - -
|
|
|
|
target: productTest
|
|
|
|
- - - - - - - - - - - - - - - - - -->
|
2010-08-03 18:53:55 +00:00
|
|
|
<target name="productTest" depends="productCompile" if="product.tests.exist" unless="skiptests">
|
2010-02-21 18:45:18 +00:00
|
|
|
<javac srcdir="${product.test.dir}"
|
2010-11-11 19:11:42 +00:00
|
|
|
destdir="${test-classes.dir}"
|
2010-02-21 18:45:18 +00:00
|
|
|
debug="true"
|
|
|
|
deprecation="true"
|
2010-12-15 17:07:49 +00:00
|
|
|
encoding="UTF8"
|
2010-02-21 18:45:18 +00:00
|
|
|
optimize="false"
|
2010-08-03 18:53:55 +00:00
|
|
|
source="1.6">
|
|
|
|
<classpath refid="test.compile.classpath" />
|
2010-02-21 18:45:18 +00:00
|
|
|
</javac>
|
|
|
|
|
|
|
|
<java classname="edu.cornell.mannlib.vitro.testing.VitroTestRunner"
|
|
|
|
fork="yes"
|
|
|
|
failonerror="true">
|
2010-08-03 18:53:55 +00:00
|
|
|
<classpath refid="test.run.classpath" />
|
2010-02-21 18:45:18 +00:00
|
|
|
<arg file="${product.test.dir}" />
|
|
|
|
<arg value="${testlevel}" />
|
|
|
|
</java>
|
|
|
|
</target>
|
2010-10-22 15:13:06 +00:00
|
|
|
<!-- =================================
|
|
|
|
target: revisionInfo
|
|
|
|
================================= -->
|
|
|
|
<target name="revisionInfo" description="--> Store revision info in build">
|
|
|
|
<innercall target="revisionInfo" />
|
|
|
|
<antcall target="productRevisionInfo" />
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<!-- - - - - - - - - - - - - - - - - -
|
|
|
|
target: productRevisionInfo
|
|
|
|
- - - - - - - - - - - - - - - - - -->
|
2010-11-09 18:13:44 +00:00
|
|
|
<target name="productRevisionInfo" depends="productTest" unless="skipinfo">
|
2010-10-22 15:13:06 +00:00
|
|
|
<property name="revisionInfo.product.dir" location="${ant.file}/.." />
|
2010-10-25 21:29:25 +00:00
|
|
|
<property name="revisionInfo.build.file" location="${war-resources.dir}/revisionInfo.txt" />
|
2010-10-22 15:13:06 +00:00
|
|
|
|
|
|
|
<java classname="edu.cornell.mannlib.vitro.utilities.revisioninfo.RevisionInfoBuilder"
|
|
|
|
fork="no"
|
|
|
|
failonerror="true"
|
|
|
|
logerror="true"
|
|
|
|
outputproperty="revisionInfo.outputLine">
|
|
|
|
<classpath refid="test.run.classpath" />
|
|
|
|
<arg value="${ant.project.name}" />
|
|
|
|
<arg file="${revisionInfo.product.dir}" />
|
|
|
|
</java>
|
|
|
|
<echo file="${revisionInfo.build.file}" append="true">${revisionInfo.outputLine}
|
|
|
|
</echo>
|
|
|
|
</target>
|
2010-02-21 18:45:18 +00:00
|
|
|
|
2010-08-03 18:53:55 +00:00
|
|
|
<!-- =================================
|
|
|
|
target: deploy
|
|
|
|
================================= -->
|
|
|
|
<target name="deploy" description="--> Build the app and install in Tomcat">
|
|
|
|
<!-- the inner "deploy" would just do a sync that will be done by productDeploy -->
|
2010-10-22 15:13:06 +00:00
|
|
|
<innercall target="revisionInfo" />
|
2010-08-03 18:53:55 +00:00
|
|
|
<antcall target="productDeploy" />
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<!-- - - - - - - - - - - - - - - - - -
|
|
|
|
target: productDeploy
|
|
|
|
- - - - - - - - - - - - - - - - - -->
|
2010-10-22 15:13:06 +00:00
|
|
|
<target name="productDeploy" depends="productRevisionInfo">
|
2010-08-03 18:53:55 +00:00
|
|
|
<property name="webapp.deploy.home" value="${tomcat.home}/webapps/${webapp.name}" />
|
|
|
|
|
|
|
|
<mkdir dir="${webapp.deploy.home}" />
|
|
|
|
|
|
|
|
<sync todir="${webapp.deploy.home}" includeemptydirs="true">
|
|
|
|
<fileset dir="${build.dir}/war" />
|
|
|
|
</sync>
|
|
|
|
</target>
|
|
|
|
|
2010-04-15 20:20:14 +00:00
|
|
|
<!-- =================================
|
|
|
|
target: licenser
|
|
|
|
|
|
|
|
In regular use, checks that all appropriate source files have license tags.
|
|
|
|
At release time, applies license text to source files.
|
2010-04-16 13:59:17 +00:00
|
|
|
|
|
|
|
NOTE: don't override licenser.properties.file from the command line.
|
|
|
|
Instead, override licenser.core.properties.file and licenser.product.properties.file
|
2010-04-15 20:20:14 +00:00
|
|
|
================================= -->
|
|
|
|
<target name="licenser" description="--> Check source files for licensing tags">
|
|
|
|
<!-- Once for the product... -->
|
2010-08-03 18:53:55 +00:00
|
|
|
<innercall target="licenser">
|
|
|
|
<property name="licenser.properties.file" value="${licenser.product.properties.file}" />
|
|
|
|
<property name="licenser.label" value="${ant.project.name}" />
|
|
|
|
</innercall>
|
2010-04-15 20:20:14 +00:00
|
|
|
|
|
|
|
<!-- ...and once for the core. -->
|
|
|
|
<condition property="licenser.properties.file" value="${licenser.core.properties.file}">
|
2010-04-16 13:59:17 +00:00
|
|
|
<isset property="licenser.core.properties.file" />
|
2010-04-15 20:20:14 +00:00
|
|
|
</condition>
|
2010-08-03 18:53:55 +00:00
|
|
|
<innercall target="licenser">
|
|
|
|
<propertyset>
|
|
|
|
<propertyref name="licenser.properties.file" />
|
|
|
|
</propertyset>
|
|
|
|
</innercall>
|
2010-04-15 20:20:14 +00:00
|
|
|
</target>
|
2010-08-03 18:53:55 +00:00
|
|
|
|
|
|
|
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
MACROS
|
|
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
|
|
|
|
|
|
|
<!--
|
|
|
|
Call a target in the inner script.
|
|
|
|
-->
|
|
|
|
<macrodef name="innercall">
|
|
|
|
<attribute name="target" />
|
|
|
|
<element name="additionalProperties" implicit="yes" optional="true" />
|
|
|
|
<sequential>
|
|
|
|
<ant dir="${inner.basedir}" inheritall="false">
|
|
|
|
<!-- pass the properties that are needed. -->
|
|
|
|
<propertyset>
|
|
|
|
<propertyref name="build.dir" />
|
|
|
|
<propertyref name="skip.core.themes" />
|
|
|
|
<propertyref name="deploy.properties.file" />
|
|
|
|
</propertyset>
|
|
|
|
<additionalProperties />
|
|
|
|
<target name="@{target}" />
|
|
|
|
</ant>
|
|
|
|
</sequential>
|
|
|
|
</macrodef>
|
2010-02-21 18:45:18 +00:00
|
|
|
</project>
|