xref: /trunk/main/solenv/ant/aoo-ant.xml (revision d6a83b31)
141f03cd9SDamjan Jovanovic<?xml version="1.0" encoding="UTF-8"?>
241f03cd9SDamjan Jovanovic<!--***********************************************************
341f03cd9SDamjan Jovanovic *
441f03cd9SDamjan Jovanovic * Licensed to the Apache Software Foundation (ASF) under one
541f03cd9SDamjan Jovanovic * or more contributor license agreements.  See the NOTICE file
641f03cd9SDamjan Jovanovic * distributed with this work for additional information
741f03cd9SDamjan Jovanovic * regarding copyright ownership.  The ASF licenses this file
841f03cd9SDamjan Jovanovic * to you under the Apache License, Version 2.0 (the
941f03cd9SDamjan Jovanovic * "License"); you may not use this file except in compliance
1041f03cd9SDamjan Jovanovic * with the License.  You may obtain a copy of the License at
1141f03cd9SDamjan Jovanovic *
1241f03cd9SDamjan Jovanovic *   http://www.apache.org/licenses/LICENSE-2.0
1341f03cd9SDamjan Jovanovic *
1441f03cd9SDamjan Jovanovic * Unless required by applicable law or agreed to in writing,
1541f03cd9SDamjan Jovanovic * software distributed under the License is distributed on an
1641f03cd9SDamjan Jovanovic * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1741f03cd9SDamjan Jovanovic * KIND, either express or implied.  See the License for the
1841f03cd9SDamjan Jovanovic * specific language governing permissions and limitations
1941f03cd9SDamjan Jovanovic * under the License.
2041f03cd9SDamjan Jovanovic *
2141f03cd9SDamjan Jovanovic ***********************************************************-->
2241f03cd9SDamjan Jovanovic
2341f03cd9SDamjan Jovanovic
2441f03cd9SDamjan Jovanovic<project name="aoo-ant" default="main" xmlns:if="ant:if" xmlns:unless="ant:unless">
2541f03cd9SDamjan Jovanovic
2641f03cd9SDamjan Jovanovic    <!-- ================================================================= -->
2741f03cd9SDamjan Jovanovic    <!-- settings                                                          -->
2841f03cd9SDamjan Jovanovic    <!-- ================================================================= -->
2941f03cd9SDamjan Jovanovic
3041f03cd9SDamjan Jovanovic    <dirname property="aoo-ant.basedir" file="${ant.file.aoo-ant}"/>
3141f03cd9SDamjan Jovanovic
3241f03cd9SDamjan Jovanovic    <!-- global properties -->
3341f03cd9SDamjan Jovanovic    <property file="${aoo-ant.basedir}/../../ant.properties"/>
3441f03cd9SDamjan Jovanovic    <!-- RSCREVISION: -->
3541f03cd9SDamjan Jovanovic    <property file="${aoo-ant.basedir}/../inc/minor.mk"/>
3641f03cd9SDamjan Jovanovic
3741f03cd9SDamjan Jovanovic    <property name="build.base.dir" location="${WORKDIR}/Ant/${ant.project.name}"/>
384aa87146SDamjan Jovanovic
3941f03cd9SDamjan Jovanovic    <property name="main.src.dir" location="src/main/java"/>
409fd473e1SDamjan Jovanovic    <property name="res.src.dir" location="src/main/resources"/>
414aa87146SDamjan Jovanovic    <property name="idl.src.dir" location="src/main/idl"/>
4241f03cd9SDamjan Jovanovic    <property name="test.src.dir" location="src/test/java"/>
439fd473e1SDamjan Jovanovic    <property name="test-res.src.dir" location="src/test/resources"/>
444aa87146SDamjan Jovanovic    <property name="test-idl.src.dir" location="src/test/idl"/>
454aa87146SDamjan Jovanovic
464aa87146SDamjan Jovanovic    <property name="main.build.dir" location="${build.base.dir}/main"/>
474aa87146SDamjan Jovanovic    <property name="idl.build.dir" location="${build.base.dir}/idl"/>
484aa87146SDamjan Jovanovic    <property name="idl.build.classes.dir" location="${build.base.dir}/idl/classes"/>
4941f03cd9SDamjan Jovanovic    <property name="test.build.dir" location="${build.base.dir}/test"/>
504aa87146SDamjan Jovanovic    <property name="test-idl.build.dir" location="${build.base.dir}/test-idl"/>
514aa87146SDamjan Jovanovic    <property name="test-idl.classes.build.dir" location="${build.base.dir}/test-idl/classes"/>
5241f03cd9SDamjan Jovanovic    <property name="test.reports.dir" location="${build.base.dir}/test-reports"/>
534aa87146SDamjan Jovanovic
5431eff9ffSDamjan Jovanovic    <property name="java.baseline.version" value="1.7"/>
5541f03cd9SDamjan Jovanovic    <property name="jar.dir" location="${WORKDIR}/Ant"/>
5641f03cd9SDamjan Jovanovic
5741f03cd9SDamjan Jovanovic    <property name="main.debug" value="true"/>
5841f03cd9SDamjan Jovanovic    <property name="main.deprecation" value="false"/>
5941f03cd9SDamjan Jovanovic    <property name="test.debug" value="true"/>
6041f03cd9SDamjan Jovanovic    <property name="test.deprecation" value="false"/>
6141f03cd9SDamjan Jovanovic
6241f03cd9SDamjan Jovanovic    <import file="${aoo-ant.basedir}/externals.xml"/>
6341f03cd9SDamjan Jovanovic    <import file="${aoo-ant.basedir}/idl.xml"/>
6441f03cd9SDamjan Jovanovic
6541f03cd9SDamjan Jovanovic    <target name="init-project"/>
6641f03cd9SDamjan Jovanovic
6741f03cd9SDamjan Jovanovic    <target name="prepare" depends="init-project">
6841f03cd9SDamjan Jovanovic        <property name="jar.enabled" value="true"/>
6941f03cd9SDamjan Jovanovic        <property name="jar.name" value="${ant.project.name}"/>
7041f03cd9SDamjan Jovanovic        <property name="jar.classpath" value=""/>
7141f03cd9SDamjan Jovanovic        <property name="jar.manifest" value ="${aoo-ant.basedir}/manifest.empty"/>
7241f03cd9SDamjan Jovanovic
7341f03cd9SDamjan Jovanovic        <local name="has.main.classpath"/>
7441f03cd9SDamjan Jovanovic        <condition property="has.main.classpath">
7541f03cd9SDamjan Jovanovic            <isreference refid="main.classpath"/>
7641f03cd9SDamjan Jovanovic        </condition>
774aa87146SDamjan Jovanovic        <path id="internal.main.classpath">
784aa87146SDamjan Jovanovic            <path refid="main.classpath" if:set="has.main.classpath"/>
794aa87146SDamjan Jovanovic            <pathelement location="${idl.classes.build.dir}"/>
804aa87146SDamjan Jovanovic        </path>
8141f03cd9SDamjan Jovanovic
8241f03cd9SDamjan Jovanovic        <local name="has.test.classpath"/>
8341f03cd9SDamjan Jovanovic        <condition property="has.test.classpath">
8441f03cd9SDamjan Jovanovic            <isreference refid="test.classpath"/>
8541f03cd9SDamjan Jovanovic        </condition>
8641f03cd9SDamjan Jovanovic        <path id="internal.test.classpath">
8741f03cd9SDamjan Jovanovic            <pathelement location="${main.build.dir}"/>
884aa87146SDamjan Jovanovic            <pathelement location="${idl.classes.build.dir}"/>
8941f03cd9SDamjan Jovanovic            <pathelement location="${test.build.dir}"/>
904aa87146SDamjan Jovanovic            <pathelement location="${test-idl.classes.build.dir}"/>
9141f03cd9SDamjan Jovanovic            <path refid="main.classpath"/>
9241f03cd9SDamjan Jovanovic            <path refid="test.classpath" if:set="has.test.classpath"/>
9341f03cd9SDamjan Jovanovic            <pathelement location="${OOO_JUNIT_JAR}"/>
9411e97782SDamjan Jovanovic            <pathelement location="${HAMCREST_CORE_JAR}" if:set="HAMCREST_CORE_JAR"/>
9541f03cd9SDamjan Jovanovic        </path>
9641f03cd9SDamjan Jovanovic    </target>
9741f03cd9SDamjan Jovanovic
989fd473e1SDamjan Jovanovic    <target name="dependencies" depends="prepare">
999fd473e1SDamjan Jovanovic        <local name="has.main.classpath"/>
1009fd473e1SDamjan Jovanovic        <condition property="has.main.classpath">
1019fd473e1SDamjan Jovanovic            <isreference refid="main.classpath"/>
1029fd473e1SDamjan Jovanovic        </condition>
1039fd473e1SDamjan Jovanovic
1049fd473e1SDamjan Jovanovic        <pathconvert refid="main.classpath" setonempty="true" pathsep=" " property="deps" if:set="has.main.classpath"/>
105*d6a83b31SDamjan Jovanovic        <property name="deps" value=""/>
1069fd473e1SDamjan Jovanovic        <echo message="${deps}" file="${dependencies.outfile}"/>
1079fd473e1SDamjan Jovanovic    </target>
1089fd473e1SDamjan Jovanovic
10941f03cd9SDamjan Jovanovic    <target name="res" depends="prepare">
11041f03cd9SDamjan Jovanovic        <mkdir dir="${main.build.dir}"/>
1119fd473e1SDamjan Jovanovic        <copy todir="${main.build.dir}" failonerror="false" quiet="true">
1129fd473e1SDamjan Jovanovic             <fileset dir="${res.src.dir}">
1139fd473e1SDamjan Jovanovic                 <include name="**/*"/>
11441f03cd9SDamjan Jovanovic             </fileset>
11541f03cd9SDamjan Jovanovic        </copy>
11641f03cd9SDamjan Jovanovic    </target>
11741f03cd9SDamjan Jovanovic
118bee6bcb9SDamjan Jovanovic    <extension-point name="pre-compile" depends="prepare,res"/>
119bee6bcb9SDamjan Jovanovic
1204aa87146SDamjan Jovanovic    <target name="idl" depends="pre-compile">
1214aa87146SDamjan Jovanovic        <fileset id="idl.files" dir="${idl.src.dir}" includes="**/*.idl" erroronmissingdir="false"/>
1224aa87146SDamjan Jovanovic        <idl-javamaker
1234aa87146SDamjan Jovanovic            idlFiles="idl.files"
1244aa87146SDamjan Jovanovic            idlBuildDir="${idl.build.dir}"/>
1254aa87146SDamjan Jovanovic    </target>
1264aa87146SDamjan Jovanovic
1274aa87146SDamjan Jovanovic    <target name="compile" depends="idl">
12841f03cd9SDamjan Jovanovic        <mkdir dir="${main.build.dir}"/>
12941f03cd9SDamjan Jovanovic        <javac srcdir="${main.src.dir}"
13041f03cd9SDamjan Jovanovic               destdir="${main.build.dir}"
13131eff9ffSDamjan Jovanovic               source="${java.baseline.version}"
13231eff9ffSDamjan Jovanovic               target="${java.baseline.version}"
13341f03cd9SDamjan Jovanovic               debug="${main.debug}"
13441f03cd9SDamjan Jovanovic               debuglevel="lines,vars,source"
13541f03cd9SDamjan Jovanovic               deprecation="${main.deprecation}"
1364aa87146SDamjan Jovanovic               classpathref="internal.main.classpath"
13741f03cd9SDamjan Jovanovic               includeantruntime="false"/>
13841f03cd9SDamjan Jovanovic    </target>
13941f03cd9SDamjan Jovanovic
140a622bb93SDamjan Jovanovic    <macrodef name="check-test">
141a622bb93SDamjan Jovanovic        <sequential>
142a622bb93SDamjan Jovanovic            <local name="tests.present"/>
143a622bb93SDamjan Jovanovic            <available type="dir" file="${test.src.dir}" property="tests.present"/>
144a622bb93SDamjan Jovanovic            <echo message="No tests" unless:set="tests.present"/>
145a622bb93SDamjan Jovanovic
146a622bb93SDamjan Jovanovic            <local name="only.junit.absent"/>
147a622bb93SDamjan Jovanovic            <condition property="only.junit.absent">
148a622bb93SDamjan Jovanovic                <and>
149a622bb93SDamjan Jovanovic                    <isset property="tests.present"/>
150a622bb93SDamjan Jovanovic                    <not><isset property="OOO_JUNIT_JAR"/></not>
151a622bb93SDamjan Jovanovic                </and>
152a622bb93SDamjan Jovanovic            </condition>
153a622bb93SDamjan Jovanovic            <echo message="No junit, skipping tests" if:set="only.junit.absent"/>
154a622bb93SDamjan Jovanovic
155a622bb93SDamjan Jovanovic            <condition property="test.skip">
156a622bb93SDamjan Jovanovic                <or>
157ad792c60SDamjan Jovanovic                    <not><isset property="tests.present"/></not>
158a622bb93SDamjan Jovanovic                    <not><isset property="OOO_JUNIT_JAR"/></not>
159a622bb93SDamjan Jovanovic                </or>
160a622bb93SDamjan Jovanovic            </condition>
161a622bb93SDamjan Jovanovic        </sequential>
162a622bb93SDamjan Jovanovic    </macrodef>
163a622bb93SDamjan Jovanovic
1649fd473e1SDamjan Jovanovic    <target name="test-res" depends="pre-compile">
1659fd473e1SDamjan Jovanovic        <mkdir dir="${test.build.dir}" unless:set="test.skip"/>
1669fd473e1SDamjan Jovanovic        <copy todir="${test.build.dir}" failonerror="false" quiet="true" unless:set="test.skip">
1679fd473e1SDamjan Jovanovic             <fileset dir="${test-res.src.dir}">
1689fd473e1SDamjan Jovanovic                 <include name="**/*"/>
1699fd473e1SDamjan Jovanovic             </fileset>
1709fd473e1SDamjan Jovanovic        </copy>
1719fd473e1SDamjan Jovanovic    </target>
1729fd473e1SDamjan Jovanovic
1739fd473e1SDamjan Jovanovic    <target name="test-idl" depends="test-res">
1744aa87146SDamjan Jovanovic        <fileset id="test-idl.files" dir="${test-idl.src.dir}" includes="**/*.idl" erroronmissingdir="false"/>
1754aa87146SDamjan Jovanovic        <idl-javamaker
1764aa87146SDamjan Jovanovic            idlFiles="test-idl.files"
1774aa87146SDamjan Jovanovic            idlBuildDir="${test-idl.build.dir}"/>
1784aa87146SDamjan Jovanovic    </target>
1794aa87146SDamjan Jovanovic
1804aa87146SDamjan Jovanovic    <target name="test-compile" depends="compile,test-idl">
181a622bb93SDamjan Jovanovic        <check-test/>
182cede1e5bSDamjan Jovanovic        <mkdir dir="${test.build.dir}" unless:set="test.skip"/>
18341f03cd9SDamjan Jovanovic        <javac srcdir="${test.src.dir}"
18441f03cd9SDamjan Jovanovic               destdir="${test.build.dir}"
18531eff9ffSDamjan Jovanovic               source="${java.baseline.version}"
18631eff9ffSDamjan Jovanovic               target="${java.baseline.version}"
18741f03cd9SDamjan Jovanovic               debug="${test.debug}"
18841f03cd9SDamjan Jovanovic               debuglevel="lines,vars,source"
18941f03cd9SDamjan Jovanovic               deprecation="${test.deprecation}"
19041f03cd9SDamjan Jovanovic               classpathref="internal.test.classpath"
19141f03cd9SDamjan Jovanovic               includeantruntime="false"
192cede1e5bSDamjan Jovanovic               unless:set="test.skip"/>
19341f03cd9SDamjan Jovanovic    </target>
19441f03cd9SDamjan Jovanovic
19541f03cd9SDamjan Jovanovic    <!-- fork="true" is sadly necessary on Ubuntu due to multiple versions of junit confusing Ant,
19641f03cd9SDamjan Jovanovic         see https://github.com/real-logic/simple-binary-encoding/issues/96 -->
197f9bad0d2SDamjan Jovanovic    <target name="test" depends="test-compile" unless="${test.skip}">
19841f03cd9SDamjan Jovanovic        <mkdir dir="${test.reports.dir}"/>
19941f03cd9SDamjan Jovanovic        <junit printsummary="yes" haltonfailure="yes" showoutput="true" filtertrace="false" fork="true">
20041f03cd9SDamjan Jovanovic            <classpath refid="internal.test.classpath"/>
20141f03cd9SDamjan Jovanovic            <formatter type="plain"/>
20241f03cd9SDamjan Jovanovic            <batchtest todir="${test.reports.dir}">
20341f03cd9SDamjan Jovanovic                <fileset dir="${test.src.dir}">
20441f03cd9SDamjan Jovanovic                    <include name="**/*_Test.java"/>
20541f03cd9SDamjan Jovanovic                </fileset>
20641f03cd9SDamjan Jovanovic            </batchtest>
20741f03cd9SDamjan Jovanovic        </junit>
20841f03cd9SDamjan Jovanovic    </target>
20941f03cd9SDamjan Jovanovic
21041f03cd9SDamjan Jovanovic    <target name="jar" depends="compile" if="${jar.enabled}">
21141f03cd9SDamjan Jovanovic        <jar destfile="${jar.dir}/${jar.name}.jar"
2124aa87146SDamjan Jovanovic             manifest="${jar.manifest}"
2134aa87146SDamjan Jovanovic             duplicate="fail">
21441f03cd9SDamjan Jovanovic            <manifest>
21541f03cd9SDamjan Jovanovic                <attribute name="Class-Path" value="${jar.classpath}" unless:blank="${jar.classpath}"/>
21641f03cd9SDamjan Jovanovic                <attribute name="Solar-Version" value="${RSCREVISION}"/>
21741f03cd9SDamjan Jovanovic            </manifest>
2184aa87146SDamjan Jovanovic            <fileset dir="${main.build.dir}"/>
2194aa87146SDamjan Jovanovic<!-- Breaks trunk/test/smoketestdoc by packaging different classes with the same name: -->
2204aa87146SDamjan Jovanovic<!--            <fileset dir="${idl.build.classes.dir}" erroronmissingdir="false"/> -->
22141f03cd9SDamjan Jovanovic            <include name="**/*.class"/>
22241f03cd9SDamjan Jovanovic            <include name="**/*.properties"/>
22341f03cd9SDamjan Jovanovic            <include name="**/*.css"/>
22441f03cd9SDamjan Jovanovic            <include name="**/*.dtd"/>
22541f03cd9SDamjan Jovanovic            <include name="**/*.form"/>
22641f03cd9SDamjan Jovanovic            <include name="**/*.gif "/>
22741f03cd9SDamjan Jovanovic            <include name="**/*.htm"/>
22841f03cd9SDamjan Jovanovic            <include name="**/*.html"/>
22941f03cd9SDamjan Jovanovic            <include name="**/*.js"/>
23041f03cd9SDamjan Jovanovic            <include name="**/*.mod"/>
23141f03cd9SDamjan Jovanovic            <include name="**/*.sql"/>
23241f03cd9SDamjan Jovanovic            <include name="**/*.xml"/>
23341f03cd9SDamjan Jovanovic            <include name="**/*.xsl"/>
23441f03cd9SDamjan Jovanovic            <include name="**/*.map"/>
23541f03cd9SDamjan Jovanovic        </jar>
23641f03cd9SDamjan Jovanovic    </target>
23741f03cd9SDamjan Jovanovic
2388cb913c4SDamjan Jovanovic    <extension-point name="pre-clean" depends="prepare"/>
2398cb913c4SDamjan Jovanovic
2408cb913c4SDamjan Jovanovic    <target name="clean" depends="pre-clean">
24141f03cd9SDamjan Jovanovic        <delete dir="${build.base.dir}"/>
24241f03cd9SDamjan Jovanovic        <delete file="${jar.dir}/${jar.name}.jar"/>
24341f03cd9SDamjan Jovanovic    </target>
24441f03cd9SDamjan Jovanovic
24541f03cd9SDamjan Jovanovic    <target name="main" depends="test,jar"/>
24641f03cd9SDamjan Jovanovic
24741f03cd9SDamjan Jovanovic</project>
24841f03cd9SDamjan Jovanovic
249