Files
DSpace/dspace/build.xml
Robert Tansley aa3d4ab719 Updated source code license.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@535 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2002-11-01 17:59:17 +00:00

346 lines
13 KiB
XML

<?xml version="1.0"?>
<!--
- Copyright (c) 2002, Hewlett-Packard Company and Massachusetts
- Institute of Technology. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Hewlett-Packard Company nor the name of the
- Massachusetts Institute of Technology nor the names of their
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
- TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
- USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- DAMAGE.
-->
<!--
- DSpace build file
-
- Version: $Revision$
- Date: $Date$
-->
<project name="DSpace" default="compile" basedir=".">
<!-- ============================================================= -->
<!-- Description -->
<!-- ============================================================= -->
<description>
===================== DSpace platform build file =====================
Common usage:
Fresh install, including database setup and registry loading:
% ant ; ant fresh_install
Upgrade existing installation, leaving code, data and configuration
% ant ; ant -Dconfig=/installdir/config/dspace.cfg update
The following target require that the system is installed:
load_registries
======================================================================
</description>
<!-- ============================================================= -->
<!-- Will be using various environment variables -->
<!-- ============================================================= -->
<property environment="env"/>
<!-- ============================================================= -->
<!-- Build parameters that are likely to need tweaking -->
<!-- ============================================================= -->
<!-- Default configuration to use. This may be overridden. -->
<property name="config" value="${basedir}/config/dspace.cfg" />
<!-- Give user a chance to override without editing this file
(and without typing -D each time s/he compiles it) -->
<property file="${user.home}/.dspace.properties" />
<!-- Load the configuration -->
<property file="${config}" />
<!-- ============================================================= -->
<!-- The DSpace class path for building -->
<!-- ============================================================= -->
<!-- We will include the environment CLASSPATH -->
<path id="build.class.path">
<pathelement path="${env.CLASSPATH}"/>
<pathelement path="${basedir}/build/classes"/>
<fileset dir="${basedir}/lib">
<include name="**/*.jar"/>
</fileset>
</path>
<!-- ============================================================= -->
<!-- Compile the source code -->
<!-- ============================================================= -->
<target name="compile"
description="Compile the source code">
<mkdir dir="${basedir}/build/classes"/>
<javac srcdir="${basedir}/src"
destdir="${basedir}/build/classes"
debug="on">
<include name="**/*.java"/>
<classpath refid="build.class.path"/>
</javac>
</target>
<!-- ============================================================= -->
<!-- Update the code, without clobbering existing data -->
<!-- ============================================================= -->
<target name="update"
description="Update installed code (install without clobbering data)">
<mkdir dir="${dspace.dir}/config" />
<mkdir dir="${assetstore.dir}" />
<mkdir dir="${handle.dir}" />
<mkdir dir="${history.dir}" />
<mkdir dir="${search.dir}" />
<mkdir dir="${log.dir}" />
<mkdir dir="${dspace.dir}/bin"/>
<mkdir dir="${dspace.dir}/lib"/>
<mkdir dir="${dspace.dir}/jsp/local"/>
<mkdir dir="${dspace.dir}/jsp/WEB-INF"/>
<mkdir dir="${dspace.dir}/oai/WEB-INF"/>
<!-- Delete symlinks, otherwise ln -s commands below would create
extra symlinks, e.g. "WEB-INF/lib/lib". Plus, we need to use
shell "rm" command, since ANT's delete task doesn't
understand symlinks. -->
<exec executable="rm">
<arg value="-f" />
<arg value="${dspace.dir}/jsp/WEB-INF/classes" />
<arg value="${dspace.dir}/jsp/WEB-INF/lib" />
<arg value="${dspace.dir}/oai/WEB-INF/classes" />
<arg value="${dspace.dir}/oai/WEB-INF/lib" />
</exec>
<!-- Symlink the Web UI and OAI webapps "classes" and "lib" directory
- to dspace.dir/config and dspace.dir/lib respectively -->
<exec executable="ln">
<arg value="-s" />
<arg value="${dspace.dir}/config" />
<arg value="${dspace.dir}/jsp/WEB-INF/classes" />
</exec>
<exec executable="ln">
<arg value="-s" />
<arg value="${dspace.dir}/lib" />
<arg value="${dspace.dir}/jsp/WEB-INF/lib" />
</exec>
<exec executable="ln">
<arg value="-s" />
<arg value="${dspace.dir}/config" />
<arg value="${dspace.dir}/oai/WEB-INF/classes" />
</exec>
<exec executable="ln">
<arg value="-s" />
<arg value="${dspace.dir}/lib" />
<arg value="${dspace.dir}/oai/WEB-INF/lib" />
</exec>
<copy todir="${dspace.dir}/bin">
<fileset dir="bin"/>
</copy>
<exec executable="chmod">
<arg value="-R" />
<arg value="u+x" />
<arg value="${dspace.dir}/bin" />
</exec>
<copy todir="${dspace.dir}/lib">
<fileset dir="lib"/>
</copy>
<copy todir="${dspace.dir}/jsp">
<fileset dir="jsp"/>
</copy>
<jar jarfile="${dspace.dir}/lib/dspace.jar"
basedir="${basedir}/build/classes" />
</target>
<!-- ============================================================= -->
<!-- Do a fresh install of the code and configuration files -->
<!-- ============================================================= -->
<!-- Installs code, then config, and symlinks WEB-INF/classes to config.
The "log4j.build.properties" file is copied to ${dspace.dir}/config
so there's a simple log4j.properties file present for the initial
run of "install-configs". -->
<target name="install_code"
depends="update"
description="Do a fresh install of the system, not touching database">
<copy todir="${dspace.dir}/config">
<fileset dir="${basedir}/config"/>
</copy>
<copy file="${basedir}/etc/log4j.build.properties"
tofile="${dspace.dir}/config/log4j.properties"/>
</target>
<!-- ============================================================= -->
<!-- Create the database tables -->
<!-- ============================================================= -->
<!-- We execute InitializeDatabase, passing in the simple log4j properties
- file in etc/ and the DSpace configuration file using system
- properties -->
<target name="setup_database"
description="Create database tables">
<java classname="org.dspace.storage.rdbms.InitializeDatabase"
classpathref="build.class.path"
fork="yes"
failonerror="yes">
<sysproperty key="log4j.configuration" value="file:${basedir}/etc/log4j.build.properties"/>
<sysproperty key="dspace.configuration" value="${config}"/>
<arg value="${basedir}/etc/database_schema.sql"/>
</java>
</target>
<!-- ============================================================= -->
<!-- Remove the database tables -->
<!-- ============================================================= -->
<!-- We execute InitializeDatabase, passing in the simple log4j properties
- file in etc/ and the DSpace configuration file using system
- properties -->
<target name="clean_database"
description="Removes DSpace database tables, destroying data">
<java classname="org.dspace.storage.rdbms.InitializeDatabase"
classpathref="build.class.path"
fork="yes"
failonerror="yes">
<sysproperty key="log4j.configuration" value="file:${basedir}/etc/log4j.build.properties"/>
<sysproperty key="dspace.configuration" value="${config}"/>
<arg value="${basedir}/etc/clean-database.sql"/>
</java>
</target>
<!-- ============================================================= -->
<!-- Load the initial contents of the registries into the database -->
<!-- ============================================================= -->
<!-- Loads bitstream format and Dublin Core type registries -->
<target name="load_registries"
description="Load initial contents of registries">
<java classname="org.dspace.administer.RegistryLoader"
classpathref="build.class.path"
fork="yes"
failonerror="yes">
<sysproperty key="log4j.configuration" value="file:${basedir}/etc/log4j.build.properties"/>
<sysproperty key="dspace.configuration" value="${config}"/>
<arg value="-bitstream"/>
<arg value="${dspace.dir}/config/registries/bitstream-formats.xml"/>
</java>
<java classname="org.dspace.administer.RegistryLoader"
classpathref="build.class.path"
fork="yes"
failonerror="yes">
<sysproperty key="log4j.configuration" value="file:${basedir}/etc/log4j.build.properties"/>
<sysproperty key="dspace.configuration" value="${config}"/>
<arg value="-dc"/>
<arg value="${dspace.dir}/config/registries/dublin-core-types.xml"/>
</java>
</target>
<!-- ============================================================= -->
<!-- Do a fresh system install -->
<!-- ============================================================= -->
<target name="fresh_install"
depends="install_code,setup_database,load_registries"
description="Do a fresh install of the system, overwriting any data">
</target>
<!-- ============================================================= -->
<!-- Clean source code -->
<!-- ============================================================= -->
<target name="clean"
description="Remove compiled files - does not affect installation">
<delete dir="${basedir}/build" />
</target>
<!-- ============================================================= -->
<!-- Create public API javadoc -->
<!-- ============================================================= -->
<target name="public_api"
description="Create the DSpace public API documentation with javadoc">
<mkdir dir="${basedir}/build/public-api" />
<javadoc sourcepath="${basedir}/src"
destdir="${basedir}/build/public-api"
author="true"
version="true"
access="public"
doctitle="DSpace Public API"
windowtitle="DSpace Public API"
bottom="Copyright &#169; 2002 MIT and Hewlett-Packard. All Rights Reserved."
overview="${basedir}/src/overview.html"
classpathref="build.class.path">
<package name="org.dspace.administer"/>
<package name="org.dspace.authorize"/>
<package name="org.dspace.browse"/>
<package name="org.dspace.content"/>
<package name="org.dspace.core"/>
<package name="org.dspace.eperson"/>
<package name="org.dspace.handle"/>
<package name="org.dspace.history"/>
<package name="org.dspace.search"/>
<package name="org.dspace.storage.bitstore"/>
<package name="org.dspace.storage.rdbms"/>
<package name="org.dspace.workflow"/>
</javadoc>
</target>
<!-- ============================================================= -->
<!-- Check the source code follows conventions -->
<!-- ============================================================= -->
<!-- checkstyle-all-2.2.jar (or later) must be on CLASSPATH -->
<target name="checkstyle"
description="Check source code follows conventions (need checkstyle 2.2+)">
<taskdef resource="checkstyletask.properties"/>
<checkstyle lcurlyType="nl"
lcurlyMethod="nl"
lcurlyOther="nl"
rcurly="alone">
<fileset dir="${basedir}/src" includes="**/*.java"/>
</checkstyle>
</target>
</project>