build.xml revision 9ee3db4398eae64b3ed232c731e241f302d086b4
0d03aadb6c364ae976af4c904aa3625d2512d101sf<?xml version="1.0" encoding="UTF-8"?>
0d03aadb6c364ae976af4c904aa3625d2512d101sf<!--
0d03aadb6c364ae976af4c904aa3625d2512d101sf
0d03aadb6c364ae976af4c904aa3625d2512d101sfCDDL HEADER START
0d03aadb6c364ae976af4c904aa3625d2512d101sf
0d03aadb6c364ae976af4c904aa3625d2512d101sfThe contents of this file are subject to the terms of the
0d03aadb6c364ae976af4c904aa3625d2512d101sfCommon Development and Distribution License (the "License").
0d03aadb6c364ae976af4c904aa3625d2512d101sfYou may not use this file except in compliance with the License.
0d03aadb6c364ae976af4c904aa3625d2512d101sf
0d03aadb6c364ae976af4c904aa3625d2512d101sfSee LICENSE.txt included in this distribution for the specific
0d03aadb6c364ae976af4c904aa3625d2512d101sflanguage governing permissions and limitations under the License.
0d03aadb6c364ae976af4c904aa3625d2512d101sf
0d03aadb6c364ae976af4c904aa3625d2512d101sfWhen distributing Covered Code, include this CDDL HEADER in each
0d03aadb6c364ae976af4c904aa3625d2512d101sffile and include the License file at LICENSE.txt.
0d03aadb6c364ae976af4c904aa3625d2512d101sfIf applicable, add the following below this CDDL HEADER, with the
0d03aadb6c364ae976af4c904aa3625d2512d101sffields enclosed by brackets "[]" replaced with your own identifying
0d03aadb6c364ae976af4c904aa3625d2512d101sfinformation: Portions Copyright [yyyy] [name of copyright owner]
0d03aadb6c364ae976af4c904aa3625d2512d101sf
0d03aadb6c364ae976af4c904aa3625d2512d101sfCDDL HEADER END
0d03aadb6c364ae976af4c904aa3625d2512d101sf
0d03aadb6c364ae976af4c904aa3625d2512d101sfCopyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
0d03aadb6c364ae976af4c904aa3625d2512d101sf
0d03aadb6c364ae976af4c904aa3625d2512d101sf-->
0d03aadb6c364ae976af4c904aa3625d2512d101sf<project name="OpenGrok" default="jar" basedir=".">
0d03aadb6c364ae976af4c904aa3625d2512d101sf <description>Builds, tests, and runs the project opengrok.</description>
0d03aadb6c364ae976af4c904aa3625d2512d101sf
0d03aadb6c364ae976af4c904aa3625d2512d101sf <property name="distname" value="opengrok"/>
0d03aadb6c364ae976af4c904aa3625d2512d101sf
0d03aadb6c364ae976af4c904aa3625d2512d101sf <property name="build.classes.dir" value="target/classes"/>
0d03aadb6c364ae976af4c904aa3625d2512d101sf
0d03aadb6c364ae976af4c904aa3625d2512d101sf <property name="test.repositories" value="/testdata/repositories"/>
0d03aadb6c364ae976af4c904aa3625d2512d101sf <property name="test.sources" value="/testdata/sources"/>
a9c55d72c6e70efe57a729b2d10628eeca5c7178minfrin <property name="test.cvs" value="${test.repositories}/cvs_test"/>
0d03aadb6c364ae976af4c904aa3625d2512d101sf <property name="test.cvs.repo" value="${test.cvs}/cvsrepo"/>
0d03aadb6c364ae976af4c904aa3625d2512d101sf <property name="test.cvs.root" value="${test.cvs}/cvsroot"/>
0d03aadb6c364ae976af4c904aa3625d2512d101sf <property name="test.hg" value="${test.repositories}/mercurial"/>
0d03aadb6c364ae976af4c904aa3625d2512d101sf <property name="test.git" value="${test.repositories}/git"/>
0d03aadb6c364ae976af4c904aa3625d2512d101sf <property name="test.svn" value="${test.repositories}/svn"/>
0d03aadb6c364ae976af4c904aa3625d2512d101sf <property name="test.razor" value="${test.repositories}/razor"/>
0d03aadb6c364ae976af4c904aa3625d2512d101sf <property name="test.razor.repo" value="/ext/SampleRazorRepository/"/>
0d03aadb6c364ae976af4c904aa3625d2512d101sf <property name="build.test.reposroots" value="target/reposroot"/>
0d03aadb6c364ae976af4c904aa3625d2512d101sf <property name="build.test.classes.dir" value="target/test-classes"/>
0d03aadb6c364ae976af4c904aa3625d2512d101sf
0d03aadb6c364ae976af4c904aa3625d2512d101sf
0d03aadb6c364ae976af4c904aa3625d2512d101sf <path id="lib.search.path">
0d03aadb6c364ae976af4c904aa3625d2512d101sf <pathelement path="${user.home}/.ant/lib"/>
0d03aadb6c364ae976af4c904aa3625d2512d101sf <pathelement path="${java.class.path}"/>
0d03aadb6c364ae976af4c904aa3625d2512d101sf <pathelement path="lib"/>
0d03aadb6c364ae976af4c904aa3625d2512d101sf <pathelement path="/lib"/>
0d03aadb6c364ae976af4c904aa3625d2512d101sf </path>
0d03aadb6c364ae976af4c904aa3625d2512d101sf
0d03aadb6c364ae976af4c904aa3625d2512d101sf <property name="git" value="git"/>
0d03aadb6c364ae976af4c904aa3625d2512d101sf
<!-- Get the id of the changeset we're building from using a
Mercurial command.
-->
<target name="-get-changeset-from-command"
depends="-check-is-git-repo" if="build.from.repo">
<exec executable="${git}"
failifexecutionfails="no"
outputproperty="changeset">
<arg value="rev-parse"/>
<arg value="HEAD"/>
</exec>
</target>
<!-- Check if we build from a checked out copy of the repository,
so that we have history information from git available.
-->
<target name="-check-is-git-repo">
<available property="build.from.repo" file=".git" filepath=".." type="dir"/>
</target>
<!-- Get the id of the changeset we're building from by reading
.git_archival.txt file created by git archive. This will only
be used when we're not building from a checked out copy of
the repository, for example the source distribution.
-->
<target name="-get-changeset-from-file"
depends="-check-is-git-repo" unless="build.from.repo">
<tempfile property="git.archival.temp" deleteonexit="true"/>
<copy file="/.git_archival.txt" tofile="${git.archival.temp}"/>
<replaceregexp file="${g.archival.temp}" flags="s"
match=".*node: ([0-9a-f]{12}).*"
replace="\1"/>
<loadfile srcFile="${git.archival.temp}" property="changeset"/>
</target>
<target name="-update-build-info"
depends="-get-changeset-from-command,-get-changeset-from-file">
<mkdir dir="${build.classes.dir}/org/opensolaris/opengrok"/>
<propertyfile
file="${build.classes.dir}/org/opensolaris/opengrok/info.properties">
<entry key="version" value="${version}"/>
<entry key="changeset" value="${changeset}"/>
</propertyfile>
</target>
<target name="-post-compile-test">
<antcall target="-create-svn-repository"/>
<antcall target="-create-razor-repository"/>
<!-- Change root in CVS test repository -->
<!-- Strange indentation in line two levels below to get newline correctly -->
<concat destfile="${test.cvs.repo}/CVS/Root" append="no" force="yes" eol="unix">${basedir}/${test.cvs.root}/
</concat>
<!-- Generate ZIP files used for unit testing mercurial/.hg and mercurial/.hgignore are renamed -->
<copy todir="${test.hg}/.hg">
<fileset dir="${test.hg}/hg"/>
</copy>
<copy file="${test.hg}/hgignore" tofile="${test.hg}/.hgignore"/>
<!-- same for git -->
<copy todir="${test.git}/.git">
<fileset dir="${test.git}/git"/>
</copy>
<zip destfile="${build.test.classes.dir}/org/opensolaris/opengrok/index/source.zip"
basedir="${test.sources}"
update="false"
defaultexcludes="no"/>
<zip destfile="${build.test.classes.dir}/org/opensolaris/opengrok/history/repositories.zip"
basedir="${test.repositories}"
excludes="mercurial/hg/**, mercurial/hgignore, git/git"
update="false"
defaultexcludes="no"/>
<antcall target="-delete-generated-repository-files"/>
</target>
<target name="-create-svn-repository">
<delete dir="${test.svn}"/>
<delete dir="${build.test.reposroots}/svn"/>
<mkdir dir="${build.test.reposroots}"/>
<exec executable="svnadmin" failifexecutionfails="true">
<arg value="create"/>
<arg value="${build.test.reposroots}/svn"/>
</exec>
<!-- need absolute path for svn url -->
<pathconvert property="test.svn.url">
<map from="" to="file://"/>
<path location="${build.test.reposroots}/svn"/>
</pathconvert>
<exec executable="svn" failifexecutionfails="false">
<arg value="import"/>
<arg value="${test.sources}"/>
<arg value="${test.svn.url}"/>
<arg value="-m"/>
<arg value="Initial import"/>
</exec>
<exec executable="svn" failifexecutionfails="false">
<arg value="checkout"/>
<arg value="${test.svn.url}"/>
<arg value="${test.svn}"/>
</exec>
</target>
<target name="-create-razor-repository">
<delete dir="${test.razor}"/>
<copy todir="${test.razor}/Razor-Simple">
<fileset dir="${test.razor.repo}/UserSandbox"/>
</copy>
<copy todir="${test.razor}/Razor-Simple/SimpleCProgram/.razor">
<fileset dir="${test.razor.repo}/Repository/OpenGrokSample/RAZOR_UNIVERSE/DOMAIN_01/Simple"/>
</copy>
<!--
The support for binaries in Razor repositories is not fully
functional, so the next copy target is commented out for now.
-->
<!--copy todir="${test.razor}/Razor-Simple/SimpleCProgram-BinaryRelease/.razor">
<fileset dir="ext/SampleRazorRepository/Repository/OpenGrokSample/RAZOR_UNIVERSE/DOMAIN_01/Simple"/>
</copy-->
</target>
<!-- clean up generated test repositories -->
<target name="-delete-generated-repository-files">
<delete dir="${test.hg}/.hg"/>
<delete file="${test.hg}/.hgignore"/>
<delete dir="${test.git}/.git"/>
<delete dir="${test.svn}"/>
<delete dir="${test.razor}"/>
<delete file="${test.cvs.repo}/CVS/Root"/>
</target>
</project>