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