vitro/webapp/product-build.xml

187 lines
6.6 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="UTF-8"?>
<!-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<!-- ======================================================================
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>
<!-- - - - - - - - - - - - - - - - - -
properties
File paths are based on this file's parent directory, so we can find
the files even when this script is included into an individual
Product build script.
- - - - - - - - - - - - - - - - - -->
<dirname property="vivoProduct.basedir" file="${ant.file.vivoProduct}" />
<import file="${vivoProduct.basedir}/build.xml" />
<!-- 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}" />
<path id="product.compile.classpath">
<pathelement location="${classes.dir}" />
<path refid="compile.classpath" />
</path>
<path id="product.test.compile.classpath">
<path refid="test.compile.classpath" />
</path>
<path id="product.test.run.classpath">
<path refid="test.run.classpath" />
</path>
<!-- =================================
target: describe
================================= -->
<target name="describe" description="--> The default target.">
<echo>
all - Runs "clean", then "deploy".
clean - Delete all artifacts so the next build will be from scratch.
compile - Compile the Java source files.
test - Compile and run the JUnit tests.
war - Assemble everything into a deployable WAR file.
deploy - Deploy the application directly into the Tomcat webapps directory.
</echo>
</target>
<!-- =================================
target: all
================================= -->
<target name="all" depends="clean, deploy" description="Run 'clean', then 'deploy'" />
<!-- =================================
target: clean
================================= -->
<target name="clean" depends="vitroCore.clean" description="--> Delete all artifacts.">
</target>
<!-- =================================
target: compile
================================= -->
<target name="compile"
depends="vitroCore.compile, productCompile"
description="--> Compile Java sources.">
</target>
<!-- =================================
target: test
================================= -->
<target name="test" depends="vitroCore.test, productTest" description="-->Run JUnit tests">
</target>
<!-- =================================
target: deploy
================================= -->
<target name="deploy" depends="productCopy, vitroCore.deploy" description="description">
</target>
<!-- - - - - - - - - - - - - - - - - -
target: productCopy
- - - - - - - - - - - - - - - - - -->
<target name="productCopy" depends="copyEtc, test">
<copy todir="${build.dir}/war/themes">
<fileset dir="${product.themes.dir}" />
</copy>
<!-- TODO: Merge these into the productMods -->
<copy todir="${build.dir}/war/WEB-INF/ontologies/user">
<fileset dir="./ontology" />
</copy>
<copy todir="${build.dir}/war/WEB-INF/submodels">
<fileset dir="./model/submodels" />
</copy>
<copy todir="${build.dir}/war/WEB-INF/init-data">
<fileset dir="./model/init-data" />
</copy>
<!-- TODO: Merge these into the productMods -->
<!-- TODO: Have the Jena code read the userId directly from the deploy.properties -->
<copy file="config/vitroUsers.owl.template"
tofile="${build.dir}/war/WEB-INF/ontologies/auth/vitroUsers.owl"
filtering="true">
<filterchain>
<expandproperties />
</filterchain>
</copy>
<!-- TODO: Have the Jena code read the userId directly from the deploy.properties -->
<copy todir="${build.dir}/war">
<fileset dir="./modifications" />
</copy>
</target>
<!-- - - - - - - - - - - - - - - - - -
target: productCompile
- - - - - - - - - - - - - - - - - -->
<target name="productCompile" depends="vitroCore.compile" if="product.sources.exist">
<!-- deletes all files that depend on changed .java files -->
<depend srcdir="${product.source.dir}"
destdir="${classes.dir}"
closure="false"
cache="${build.dir}/.depcache">
<classpath refid="product.compile.classpath" />
</depend>
<javac srcdir="${product.source.dir}"
destdir="${classes.dir}"
debug="true"
deprecation="true"
optimize="true"
source="1.5">
<classpath refid="product.compile.classpath" />
</javac>
</target>
<!-- - - - - - - - - - - - - - - - - -
target: productTest
- - - - - - - - - - - - - - - - - -->
<target name="productTest" depends="vitroCore.test" if="product.tests.exist">
<javac srcdir="${product.test.dir}"
destdir="${test.classes.dir}"
debug="true"
deprecation="true"
optimize="false"
source="1.5">
<classpath refid="product.test.compile.classpath" />
</javac>
<java classname="edu.cornell.mannlib.vitro.testing.VitroTestRunner"
fork="yes"
failonerror="true">
<classpath refid="product.test.run.classpath" />
<arg file="${product.test.dir}" />
<arg value="${testlevel}" />
</java>
</target>
</project>