Reintroduce functionality available via "install_code" target

git-svn-id: http://scm.dspace.org/svn/repo/trunk@1987 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Mark Diggory
2007-05-31 15:57:56 +00:00
parent 2f07826c94
commit f69689a454

View File

@@ -43,11 +43,11 @@
<project name="DSpace" default="help"> <project name="DSpace" default="help">
<!-- ============================================================= --> <!-- ============================================================= -->
<!-- Description --> <!-- Description -->
<!-- ============================================================= --> <!-- ============================================================= -->
<description> <description>
====================== DSpace platform build file ====================== ====================== DSpace platform build file ======================
Common usage: Common usage:
@@ -61,93 +61,154 @@ Common usage:
======================================================================== ========================================================================
</description> </description>
<!-- ============================================================= --> <!-- ============================================================= -->
<!-- Will be using various environment variables --> <!-- Will be using various environment variables -->
<!-- ============================================================= --> <!-- ============================================================= -->
<property environment="env"/> <property environment="env" />
<!-- ============================================================= --> <!-- ============================================================= -->
<!-- Build parameters that are likely to need tweaking --> <!-- Build parameters that are likely to need tweaking -->
<!-- ============================================================= --> <!-- ============================================================= -->
<!-- Default configuration to use. This may be overridden. -->
<property name="config" value="config/dspace.cfg" />
<!-- Give user a chance to override without editing this file <!-- Default configuration to use. This may be overridden. -->
<property name="config" value="config/dspace.cfg" />
<!-- Give user a chance to override without editing this file
(and without typing -D each time s/he compiles it) --> (and without typing -D each time s/he compiles it) -->
<property file="${user.home}/.dspace.properties" /> <property file="${user.home}/.dspace.properties" />
<!-- First, set the dspace.dir property so it can be <!-- First, set the dspace.dir property so it can be
interpolated when loading the config file. interpolated when loading the config file.
This crudely mimics the way ConfigurationManager interpolates properties. This crudely mimics the way ConfigurationManager interpolates properties.
Note that it ONLY works for directories that interpolate ${dspace.dir} Note that it ONLY works for directories that interpolate ${dspace.dir}
but that _should_ cover all cases used in this build configuration. but that _should_ cover all cases used in this build configuration.
--> -->
<loadproperties srcFile="${config}"> <loadproperties srcFile="${config}">
<filterchain> <filterchain>
<linecontainsregexp> <linecontainsregexp>
<regexp pattern="^\s*dspace\.dir\s+"/> <regexp pattern="^\s*dspace\.dir\s+" />
</linecontainsregexp> </linecontainsregexp>
</filterchain> </filterchain>
</loadproperties> </loadproperties>
<!-- Load the configuration --> <!-- Load the configuration -->
<property file="${config}" /> <property file="${config}" />
<!-- ============================================================= --> <!-- ============================================================= -->
<!-- The DSpace class path for executing installation targets --> <!-- The DSpace class path for executing installation targets -->
<!-- ============================================================= --> <!-- ============================================================= -->
<!-- We will include the environment CLASSPATH --> <!-- We will include the environment CLASSPATH -->
<path id="class.path"> <path id="class.path">
<pathelement path="${env.CLASSPATH}"/> <pathelement path="${env.CLASSPATH}" />
<fileset dir="lib"> <fileset dir="lib">
<include name="**/*.jar"/> <include name="**/*.jar" />
</fileset> </fileset>
</path> </path>
<!-- ============================================================= -->
<!-- Print some useful help text -->
<!-- ============================================================= -->
<target name="help">
<echo message=""/>
<echo message="DSpace configuration file"/>
<echo message="-----------------------------------"/>
<echo message=""/>
<echo message="Available targets are:"/>
<echo message=""/>
<echo message="update --> Update installed code without touching your config or data"/>
<echo message=""/>
<echo message="init_configs --> Write the configuration files to ${dspace.dir}/config"/>
<echo message=""/>
<echo message="fresh_install --> Perform a fresh installation of the software, including the databases &amp; config"/>
<echo message="setup_database --> Create database tables"/>
<echo message="load_registries --> Load metadata &amp; file format registries into the database"/>
<echo message=""/>
<echo message="clean_database --> Remove DSpace database tables, destroying data"/>
</target>
<!-- ============================================================= -->
<!-- Update an installation (except database) -->
<!-- ============================================================= -->
<target name="update" <!-- ============================================================= -->
description="Update installed code (without clobbering data/config)"> <!-- Print some useful help text -->
<!-- ============================================================= -->
<copy todir="${dspace.dir}/config" preservelastmodified="true"> <target name="help">
<fileset dir="config/language-packs"/>
</copy> <echo message="" />
<echo message="DSpace configuration file" />
<echo> <echo message="-----------------------------------" />
<echo message="" />
<echo message="Available targets are:" />
<echo message="" />
<echo message="update --> Update installed code without touching your config or data" />
<echo message="" />
<echo message="init_configs --> Write the configuration files to ${dspace.dir}/config" />
<echo message="install_code --> Install compiled code into ${dspace.dir}" />
<echo message="" />
<echo message="fresh_install --> Perform a fresh installation of the software, including the databases &amp; config" />
<echo message="setup_database --> Create database tables" />
<echo message="load_registries --> Load metadata &amp; file format registries into the database" />
<echo message="" />
<echo message="clean_database --> Remove DSpace database tables, destroying data" />
</target>
<!-- ============================================================= -->
<!-- Update an installation (except database) -->
<!-- ============================================================= -->
<target name="update" description="Update installed code (without clobbering data/config)">
<tstamp>
<format property="build.date" pattern="yyyyMMdd-HHmmss" />
</tstamp>
<copy todir="${dspace.dir}/bin" preservelastmodified="true">
<fileset dir="bin" />
</copy>
<chmod dir="${dspace.dir}/bin" perm="u+x" includes="**/*" />
<mkdir dir="${dspace.dir}/lib.bak-${build.date}"/>
<move todir="${dspace.dir}/lib.bak-${build.date}">
<fileset dir="${dspace.dir}/lib">
<include name="**/*"/>
</fileset>
</move>
<copy todir="${dspace.dir}/lib" preservelastmodified="true">
<fileset dir="lib" />
</copy>
<echo>
==================================================================== ====================================================================
Copied language packs into ${dspace.dir}/config ${dspace.dir}/lib was backed up to
${dspace.dir}/lib.bak-${build.date}
Please review this directory and delete it if its no longer needed.
====================================================================
</echo>
<mkdir dir="${dspace.dir}/webapps.bak-${build.date}"/>
<move todir="${dspace.dir}/webapps.bak-${build.date}">
<fileset dir="${dspace.dir}/webapps">
<include name="**/*.war"/>
</fileset>
</move>
<copy todir="${dspace.dir}/webapps" preservelastmodified="true">
<fileset dir="webapps" />
</copy>
<echo>
====================================================================
${dspace.dir}/webapps was backed up to
${dspace.dir}/webapps.bak-${build.date}
Please review this directory and delete it if its no longer needed.
====================================================================
</echo>
<copy todir="${dspace.dir}/config" preservelastmodified="true">
<fileset dir="config/language-packs" />
</copy>
<echo>
====================================================================
Copied language packs into ${dspace.dir}/config
==================================================================== ====================================================================
Updated Web application (.war) files are in the 'build' directory. </echo>
<echo>
====================================================================
Updated Web application (.war) files are in the '${dspace.dir}/webapps'
directory.
* Stop your Web servlet container (Tomcat, Jetty, Resin etc.) * Stop your Web servlet container (Tomcat, Jetty, Resin etc.)
@@ -162,150 +223,172 @@ Copied language packs into ${dspace.dir}/config
* Start up your Web servlet container again. * Start up your Web servlet container again.
==================================================================== ====================================================================
</echo> </echo>
</target>
</target>
<!-- ============================================================= -->
<!-- Fresh install of config files --> <!-- ============================================================= -->
<!-- ============================================================= --> <!-- Install DSpace and Dependencies -->
<!-- ============================================================= -->
<!-- Writes the configuration files to ${dspace.dir}/config. It does *not*
<target name="init_installation">
<mkdir dir="${dspace.dir}/bin" />
<mkdir dir="${dspace.dir}/config" />
<mkdir dir="${dspace.dir}/lib" />
<mkdir dir="${dspace.dir}/webapps" />
<mkdir dir="${assetstore.dir}" />
<mkdir dir="${handle.dir}" />
<mkdir dir="${history.dir}" />
<mkdir dir="${search.dir}" />
<mkdir dir="${log.dir}" />
<mkdir dir="${upload.temp.dir}" />
<mkdir dir="${report.dir}" />
</target>
<!-- ============================================================= -->
<!-- Fresh install of config files -->
<!-- ============================================================= -->
<!-- Writes the configuration files to ${dspace.dir}/config. It does *not*
run the install-configs script. The "log4j.build.properties" file is run the install-configs script. The "log4j.build.properties" file is
copied to ${dspace.dir}/config so there's a simple log4j.properties copied to ${dspace.dir}/config so there's a simple log4j.properties
file present for the initial run of "install-configs". --> file present for the initial run of "install-configs". -->
<target name="init_configs"> <target name="init_configs" depends="init_installation">
<copy todir="${dspace.dir}/config" preservelastmodified="true"> <copy todir="${dspace.dir}/config" preservelastmodified="true">
<fileset dir="config"> <fileset dir="config">
<exclude name="language-packs/**"/> <exclude name="language-packs/**" />
</fileset> </fileset>
</copy> </copy>
<copy todir="${dspace.dir}/config" preservelastmodified="true"> <copy todir="${dspace.dir}/config" preservelastmodified="true">
<fileset dir="config/language-packs"/> <fileset dir="config/language-packs" />
</copy> </copy>
<copy file="etc/log4j.build.properties" <copy file="etc/log4j.build.properties" tofile="${dspace.dir}/config/log4j.properties" preservelastmodified="true" />
tofile="${dspace.dir}/config/log4j.properties"
preservelastmodified="true"/> <copy file="${config}" tofile="${dspace.dir}/config/dspace.cfg" preservelastmodified="true" />
<copy file="${config}" </target>
tofile="${dspace.dir}/config/dspace.cfg"
preservelastmodified="true" />
</target>
<!-- ============================================================= --> <!-- ============================================================= -->
<!-- Create the database tables --> <!-- Create the database tables -->
<!-- ============================================================= --> <!-- ============================================================= -->
<!-- We execute InitializeDatabase, passing in the simple log4j properties <!-- We execute InitializeDatabase, passing in the simple log4j properties
- file in etc/ and the DSpace configuration file using system - file in etc/ and the DSpace configuration file using system
- properties --> - properties -->
<target name="setup_database" <target name="setup_database" description="Create database tables">
description="Create database tables">
<java classname="org.dspace.storage.rdbms.InitializeDatabase"
classpathref="class.path"
fork="yes"
failonerror="yes">
<sysproperty key="log4j.configuration" value="file:etc/log4j.build.properties"/>
<sysproperty key="dspace.configuration" value="${config}"/>
<arg value="etc/database_schema.sql"/>
</java>
</target>
<java classname="org.dspace.storage.rdbms.InitializeDatabase" classpathref="class.path" fork="yes" failonerror="yes">
<!-- ============================================================= --> <sysproperty key="log4j.configuration" value="file:etc/log4j.build.properties" />
<!-- Remove the database tables --> <sysproperty key="dspace.configuration" value="${config}" />
<!-- ============================================================= --> <arg value="etc/database_schema.sql" />
</java>
<!-- We execute InitializeDatabase, passing in the simple log4j properties </target>
<!-- ============================================================= -->
<!-- Remove the database tables -->
<!-- ============================================================= -->
<!-- We execute InitializeDatabase, passing in the simple log4j properties
- file in etc/ and the DSpace configuration file using system - file in etc/ and the DSpace configuration file using system
- properties --> - properties -->
<target name="clean_database" <target name="clean_database" description="Removes DSpace database tables, destroying data">
description="Removes DSpace database tables, destroying data">
<java classname="org.dspace.storage.rdbms.InitializeDatabase" classpathref="class.path" fork="yes" failonerror="yes">
<java classname="org.dspace.storage.rdbms.InitializeDatabase" <sysproperty key="log4j.configuration" value="file:etc/log4j.build.properties" />
classpathref="class.path" <sysproperty key="dspace.configuration" value="${config}" />
fork="yes" <arg value="etc/clean-database.sql" />
failonerror="yes"> </java>
<sysproperty key="log4j.configuration" value="file:etc/log4j.build.properties"/>
<sysproperty key="dspace.configuration" value="${config}"/> </target>
<arg value="etc/clean-database.sql"/>
</java>
</target>
<!-- ============================================================= --> <!-- ============================================================= -->
<!-- Load the initial contents of the registries into the database --> <!-- Load the initial contents of the registries into the database -->
<!-- ============================================================= --> <!-- ============================================================= -->
<!-- Loads bitstream format and Dublin Core type registries --> <!-- Loads bitstream format and Dublin Core type registries -->
<target name="load_registries" <target name="load_registries" description="Load initial contents of registries">
description="Load initial contents of registries">
<java classname="org.dspace.administer.RegistryLoader" classpathref="class.path" fork="yes" failonerror="yes">
<java classname="org.dspace.administer.RegistryLoader" <sysproperty key="log4j.configuration" value="file:etc/log4j.build.properties" />
classpathref="class.path" <sysproperty key="dspace.configuration" value="${config}" />
fork="yes" <arg value="-bitstream" />
failonerror="yes"> <arg value="${dspace.dir}/config/registries/bitstream-formats.xml" />
<sysproperty key="log4j.configuration" value="file:etc/log4j.build.properties"/> </java>
<sysproperty key="dspace.configuration" value="${config}"/>
<arg value="-bitstream"/> <java classname="org.dspace.administer.RegistryLoader" classpathref="class.path" fork="yes" failonerror="yes">
<arg value="${dspace.dir}/config/registries/bitstream-formats.xml"/> <sysproperty key="log4j.configuration" value="file:etc/log4j.build.properties" />
</java> <sysproperty key="dspace.configuration" value="${config}" />
<arg value="-dc" />
<java classname="org.dspace.administer.RegistryLoader" <arg value="${dspace.dir}/config/registries/dublin-core-types.xml" />
classpathref="class.path" </java>
fork="yes"
failonerror="yes"> </target>
<sysproperty key="log4j.configuration" value="file: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 --> <!-- Do a fresh system install -->
<!-- ============================================================= --> <!-- ============================================================= -->
<target name="fresh_install" <target name="fresh_install" depends="init_installation,init_configs,setup_database,load_registries" description="Do a fresh install of the system, overwriting any data">
depends="init_configs,setup_database,load_registries"
description="Do a fresh install of the system, overwriting any data"> <delete dir="${dspace.dir}/bin" includes="**/*" />
<java classname="org.dspace.core.ConfigurationManager" <copy todir="${dspace.dir}/bin" preservelastmodified="true">
classpathref="class.path" <fileset dir="bin" />
fork="yes" </copy>
failonerror="yes">
<sysproperty key="log4j.configuration" value="file:etc/log4j.build.properties"/> <chmod dir="${dspace.dir}/bin" perm="u+x" includes="**/*" />
<sysproperty key="dspace.configuration" value="${config}"/>
<arg value="-installTemplates"/> <delete dir="${dspace.dir}/lib" includes="**/*" />
</java>
<copy todir="${dspace.dir}/lib" preservelastmodified="true">
<java classname="org.dspace.browse.InitializeBrowse" <fileset dir="lib" />
classpathref="class.path" </copy>
fork="yes"
failonerror="yes"> <delete dir="${dspace.dir}/webapps" includes="**/*" />
<sysproperty key="log4j.configuration" value="file:etc/log4j.build.properties"/>
<sysproperty key="dspace.configuration" value="${config}"/> <copy todir="${dspace.dir}/webapps" preservelastmodified="true">
</java> <fileset dir="webapps" />
</copy>
<java classname="org.dspace.search.DSIndexer"
classpathref="class.path" <java classname="org.dspace.core.ConfigurationManager" classpathref="class.path" fork="yes" failonerror="yes">
fork="yes" <sysproperty key="log4j.configuration" value="file:etc/log4j.build.properties" />
failonerror="yes"> <sysproperty key="dspace.configuration" value="${config}" />
<sysproperty key="log4j.configuration" value="file:etc/log4j.build.properties"/> <arg value="-installTemplates" />
<sysproperty key="dspace.configuration" value="${config}"/> </java>
</java>
<java classname="org.dspace.browse.InitializeBrowse" classpathref="class.path" fork="yes" failonerror="yes">
<echo> <sysproperty key="log4j.configuration" value="file:etc/log4j.build.properties" />
<sysproperty key="dspace.configuration" value="${config}" />
</java>
<java classname="org.dspace.search.DSIndexer" classpathref="class.path" fork="yes" failonerror="yes">
<sysproperty key="log4j.configuration" value="file:etc/log4j.build.properties" />
<sysproperty key="dspace.configuration" value="${config}" />
</java>
<echo>
==================================================================== ====================================================================
The DSpace code has been installed, and the database initialized. The DSpace code has been installed, and the database initialized.
@@ -329,7 +412,8 @@ Copied language packs into ${dspace.dir}/config
${dspace.url}/dspace-admin ${dspace.url}/dspace-admin
==================================================================== ====================================================================
</echo> </echo>
</target>
</target>
</project> </project>