xref: /trunk/main/solenv/ant/aoo-ant.xml (revision 4aa87146)
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}"/>
38*4aa87146SDamjan Jovanovic
3941f03cd9SDamjan Jovanovic    <property name="main.src.dir" location="src/main/java"/>
40*4aa87146SDamjan Jovanovic    <property name="idl.src.dir" location="src/main/idl"/>
4141f03cd9SDamjan Jovanovic    <property name="test.src.dir" location="src/test/java"/>
42*4aa87146SDamjan Jovanovic    <property name="test-idl.src.dir" location="src/test/idl"/>
43*4aa87146SDamjan Jovanovic
44*4aa87146SDamjan Jovanovic    <property name="main.build.dir" location="${build.base.dir}/main"/>
45*4aa87146SDamjan Jovanovic    <property name="idl.build.dir" location="${build.base.dir}/idl"/>
46*4aa87146SDamjan Jovanovic    <property name="idl.build.classes.dir" location="${build.base.dir}/idl/classes"/>
4741f03cd9SDamjan Jovanovic    <property name="test.build.dir" location="${build.base.dir}/test"/>
48*4aa87146SDamjan Jovanovic    <property name="test-idl.build.dir" location="${build.base.dir}/test-idl"/>
49*4aa87146SDamjan Jovanovic    <property name="test-idl.classes.build.dir" location="${build.base.dir}/test-idl/classes"/>
5041f03cd9SDamjan Jovanovic    <property name="test.reports.dir" location="${build.base.dir}/test-reports"/>
51*4aa87146SDamjan Jovanovic
5231eff9ffSDamjan Jovanovic    <property name="java.baseline.version" value="1.7"/>
5341f03cd9SDamjan Jovanovic    <property name="jar.dir" location="${WORKDIR}/Ant"/>
5441f03cd9SDamjan Jovanovic
5541f03cd9SDamjan Jovanovic    <property name="main.debug" value="true"/>
5641f03cd9SDamjan Jovanovic    <property name="main.deprecation" value="false"/>
5741f03cd9SDamjan Jovanovic    <property name="test.debug" value="true"/>
5841f03cd9SDamjan Jovanovic    <property name="test.deprecation" value="false"/>
5941f03cd9SDamjan Jovanovic
6041f03cd9SDamjan Jovanovic    <import file="${aoo-ant.basedir}/externals.xml"/>
6141f03cd9SDamjan Jovanovic    <import file="${aoo-ant.basedir}/idl.xml"/>
6241f03cd9SDamjan Jovanovic
6341f03cd9SDamjan Jovanovic    <target name="init-project"/>
6441f03cd9SDamjan Jovanovic
6541f03cd9SDamjan Jovanovic    <target name="prepare" depends="init-project">
6641f03cd9SDamjan Jovanovic        <property name="jar.enabled" value="true"/>
6741f03cd9SDamjan Jovanovic        <property name="jar.name" value="${ant.project.name}"/>
6841f03cd9SDamjan Jovanovic        <property name="jar.classpath" value=""/>
6941f03cd9SDamjan Jovanovic        <property name="jar.manifest" value ="${aoo-ant.basedir}/manifest.empty"/>
7041f03cd9SDamjan Jovanovic
7141f03cd9SDamjan Jovanovic        <local name="has.main.classpath"/>
7241f03cd9SDamjan Jovanovic        <condition property="has.main.classpath">
7341f03cd9SDamjan Jovanovic            <isreference refid="main.classpath"/>
7441f03cd9SDamjan Jovanovic        </condition>
75*4aa87146SDamjan Jovanovic        <path id="internal.main.classpath">
76*4aa87146SDamjan Jovanovic            <path refid="main.classpath" if:set="has.main.classpath"/>
77*4aa87146SDamjan Jovanovic            <pathelement location="${idl.classes.build.dir}"/>
78*4aa87146SDamjan Jovanovic        </path>
7941f03cd9SDamjan Jovanovic
8041f03cd9SDamjan Jovanovic        <local name="has.test.classpath"/>
8141f03cd9SDamjan Jovanovic        <condition property="has.test.classpath">
8241f03cd9SDamjan Jovanovic            <isreference refid="test.classpath"/>
8341f03cd9SDamjan Jovanovic        </condition>
8441f03cd9SDamjan Jovanovic        <path id="internal.test.classpath">
8541f03cd9SDamjan Jovanovic            <pathelement location="${main.build.dir}"/>
86*4aa87146SDamjan Jovanovic            <pathelement location="${idl.classes.build.dir}"/>
8741f03cd9SDamjan Jovanovic            <pathelement location="${test.build.dir}"/>
88*4aa87146SDamjan Jovanovic            <pathelement location="${test-idl.classes.build.dir}"/>
8941f03cd9SDamjan Jovanovic            <path refid="main.classpath"/>
9041f03cd9SDamjan Jovanovic            <path refid="test.classpath" if:set="has.test.classpath"/>
9141f03cd9SDamjan Jovanovic            <pathelement location="${OOO_JUNIT_JAR}"/>
9211e97782SDamjan Jovanovic            <pathelement location="${HAMCREST_CORE_JAR}" if:set="HAMCREST_CORE_JAR"/>
9341f03cd9SDamjan Jovanovic        </path>
9441f03cd9SDamjan Jovanovic    </target>
9541f03cd9SDamjan Jovanovic
9641f03cd9SDamjan Jovanovic    <target name="res" depends="prepare">
9741f03cd9SDamjan Jovanovic        <mkdir dir="${main.build.dir}"/>
9841f03cd9SDamjan Jovanovic        <copy todir="${main.build.dir}">
9941f03cd9SDamjan Jovanovic             <fileset dir="${main.src.dir}">
10041f03cd9SDamjan Jovanovic                 <include name="**/*.properties"/>
10141f03cd9SDamjan Jovanovic                 <include name="**/*.css"/>
10241f03cd9SDamjan Jovanovic                 <include name="**/*.dtd"/>
10341f03cd9SDamjan Jovanovic                 <include name="**/*.form"/>
10441f03cd9SDamjan Jovanovic                 <include name="**/*.gif "/>
10541f03cd9SDamjan Jovanovic                 <include name="**/*.htm"/>
10641f03cd9SDamjan Jovanovic                 <include name="**/*.html"/>
10741f03cd9SDamjan Jovanovic                 <include name="**/*.js"/>
10841f03cd9SDamjan Jovanovic                 <include name="**/*.mod"/>
10941f03cd9SDamjan Jovanovic                 <include name="**/*.sql"/>
11041f03cd9SDamjan Jovanovic                 <include name="**/*.xml"/>
11141f03cd9SDamjan Jovanovic                 <include name="**/*.xsl"/>
11241f03cd9SDamjan Jovanovic                 <include name="**/*.map"/>
11341f03cd9SDamjan Jovanovic             </fileset>
11441f03cd9SDamjan Jovanovic        </copy>
11541f03cd9SDamjan Jovanovic    </target>
11641f03cd9SDamjan Jovanovic
117bee6bcb9SDamjan Jovanovic    <extension-point name="pre-compile" depends="prepare,res"/>
118bee6bcb9SDamjan Jovanovic
119*4aa87146SDamjan Jovanovic    <target name="idl" depends="pre-compile">
120*4aa87146SDamjan Jovanovic        <fileset id="idl.files" dir="${idl.src.dir}" includes="**/*.idl" erroronmissingdir="false"/>
121*4aa87146SDamjan Jovanovic        <idl-javamaker
122*4aa87146SDamjan Jovanovic            idlFiles="idl.files"
123*4aa87146SDamjan Jovanovic            idlBuildDir="${idl.build.dir}"/>
124*4aa87146SDamjan Jovanovic    </target>
125*4aa87146SDamjan Jovanovic
126*4aa87146SDamjan Jovanovic    <target name="compile" depends="idl">
12741f03cd9SDamjan Jovanovic        <mkdir dir="${main.build.dir}"/>
12841f03cd9SDamjan Jovanovic        <javac srcdir="${main.src.dir}"
12941f03cd9SDamjan Jovanovic               destdir="${main.build.dir}"
13031eff9ffSDamjan Jovanovic               source="${java.baseline.version}"
13131eff9ffSDamjan Jovanovic               target="${java.baseline.version}"
13241f03cd9SDamjan Jovanovic               debug="${main.debug}"
13341f03cd9SDamjan Jovanovic               debuglevel="lines,vars,source"
13441f03cd9SDamjan Jovanovic               deprecation="${main.deprecation}"
135*4aa87146SDamjan Jovanovic               classpathref="internal.main.classpath"
13641f03cd9SDamjan Jovanovic               includeantruntime="false"/>
13741f03cd9SDamjan Jovanovic    </target>
13841f03cd9SDamjan Jovanovic
139a622bb93SDamjan Jovanovic    <macrodef name="check-test">
140a622bb93SDamjan Jovanovic        <sequential>
141a622bb93SDamjan Jovanovic            <local name="tests.present"/>
142a622bb93SDamjan Jovanovic            <available type="dir" file="${test.src.dir}" property="tests.present"/>
143a622bb93SDamjan Jovanovic            <echo message="No tests" unless:set="tests.present"/>
144a622bb93SDamjan Jovanovic
145a622bb93SDamjan Jovanovic            <local name="only.junit.absent"/>
146a622bb93SDamjan Jovanovic            <condition property="only.junit.absent">
147a622bb93SDamjan Jovanovic                <and>
148a622bb93SDamjan Jovanovic                    <isset property="tests.present"/>
149a622bb93SDamjan Jovanovic                    <not><isset property="OOO_JUNIT_JAR"/></not>
150a622bb93SDamjan Jovanovic                </and>
151a622bb93SDamjan Jovanovic            </condition>
152a622bb93SDamjan Jovanovic            <echo message="No junit, skipping tests" if:set="only.junit.absent"/>
153a622bb93SDamjan Jovanovic
154a622bb93SDamjan Jovanovic            <condition property="test.skip">
155a622bb93SDamjan Jovanovic                <or>
156ad792c60SDamjan Jovanovic                    <not><isset property="tests.present"/></not>
157a622bb93SDamjan Jovanovic                    <not><isset property="OOO_JUNIT_JAR"/></not>
158a622bb93SDamjan Jovanovic                </or>
159a622bb93SDamjan Jovanovic            </condition>
160a622bb93SDamjan Jovanovic        </sequential>
161a622bb93SDamjan Jovanovic    </macrodef>
162a622bb93SDamjan Jovanovic
163*4aa87146SDamjan Jovanovic    <target name="test-idl" depends="pre-compile">
164*4aa87146SDamjan Jovanovic        <fileset id="test-idl.files" dir="${test-idl.src.dir}" includes="**/*.idl" erroronmissingdir="false"/>
165*4aa87146SDamjan Jovanovic        <idl-javamaker
166*4aa87146SDamjan Jovanovic            idlFiles="test-idl.files"
167*4aa87146SDamjan Jovanovic            idlBuildDir="${test-idl.build.dir}"/>
168*4aa87146SDamjan Jovanovic    </target>
169*4aa87146SDamjan Jovanovic
170*4aa87146SDamjan Jovanovic    <target name="test-compile" depends="compile,test-idl">
171a622bb93SDamjan Jovanovic        <check-test/>
172cede1e5bSDamjan Jovanovic        <mkdir dir="${test.build.dir}" unless:set="test.skip"/>
17341f03cd9SDamjan Jovanovic        <javac srcdir="${test.src.dir}"
17441f03cd9SDamjan Jovanovic               destdir="${test.build.dir}"
17531eff9ffSDamjan Jovanovic               source="${java.baseline.version}"
17631eff9ffSDamjan Jovanovic               target="${java.baseline.version}"
17741f03cd9SDamjan Jovanovic               debug="${test.debug}"
17841f03cd9SDamjan Jovanovic               debuglevel="lines,vars,source"
17941f03cd9SDamjan Jovanovic               deprecation="${test.deprecation}"
18041f03cd9SDamjan Jovanovic               classpathref="internal.test.classpath"
18141f03cd9SDamjan Jovanovic               includeantruntime="false"
182cede1e5bSDamjan Jovanovic               unless:set="test.skip"/>
18341f03cd9SDamjan Jovanovic    </target>
18441f03cd9SDamjan Jovanovic
18541f03cd9SDamjan Jovanovic    <!-- fork="true" is sadly necessary on Ubuntu due to multiple versions of junit confusing Ant,
18641f03cd9SDamjan Jovanovic         see https://github.com/real-logic/simple-binary-encoding/issues/96 -->
187f9bad0d2SDamjan Jovanovic    <target name="test" depends="test-compile" unless="${test.skip}">
18841f03cd9SDamjan Jovanovic        <mkdir dir="${test.reports.dir}"/>
18941f03cd9SDamjan Jovanovic        <junit printsummary="yes" haltonfailure="yes" showoutput="true" filtertrace="false" fork="true">
19041f03cd9SDamjan Jovanovic            <classpath refid="internal.test.classpath"/>
19141f03cd9SDamjan Jovanovic            <formatter type="plain"/>
19241f03cd9SDamjan Jovanovic            <batchtest todir="${test.reports.dir}">
19341f03cd9SDamjan Jovanovic                <fileset dir="${test.src.dir}">
19441f03cd9SDamjan Jovanovic                    <include name="**/*_Test.java"/>
19541f03cd9SDamjan Jovanovic                </fileset>
19641f03cd9SDamjan Jovanovic            </batchtest>
19741f03cd9SDamjan Jovanovic        </junit>
19841f03cd9SDamjan Jovanovic    </target>
19941f03cd9SDamjan Jovanovic
20041f03cd9SDamjan Jovanovic    <target name="jar" depends="compile" if="${jar.enabled}">
20141f03cd9SDamjan Jovanovic        <jar destfile="${jar.dir}/${jar.name}.jar"
202*4aa87146SDamjan Jovanovic             manifest="${jar.manifest}"
203*4aa87146SDamjan Jovanovic             duplicate="fail">
20441f03cd9SDamjan Jovanovic            <manifest>
20541f03cd9SDamjan Jovanovic                <attribute name="Class-Path" value="${jar.classpath}" unless:blank="${jar.classpath}"/>
20641f03cd9SDamjan Jovanovic                <attribute name="Solar-Version" value="${RSCREVISION}"/>
20741f03cd9SDamjan Jovanovic            </manifest>
208*4aa87146SDamjan Jovanovic            <fileset dir="${main.build.dir}"/>
209*4aa87146SDamjan Jovanovic<!-- Breaks trunk/test/smoketestdoc by packaging different classes with the same name: -->
210*4aa87146SDamjan Jovanovic<!--            <fileset dir="${idl.build.classes.dir}" erroronmissingdir="false"/> -->
21141f03cd9SDamjan Jovanovic            <include name="**/*.class"/>
21241f03cd9SDamjan Jovanovic            <include name="**/*.properties"/>
21341f03cd9SDamjan Jovanovic            <include name="**/*.css"/>
21441f03cd9SDamjan Jovanovic            <include name="**/*.dtd"/>
21541f03cd9SDamjan Jovanovic            <include name="**/*.form"/>
21641f03cd9SDamjan Jovanovic            <include name="**/*.gif "/>
21741f03cd9SDamjan Jovanovic            <include name="**/*.htm"/>
21841f03cd9SDamjan Jovanovic            <include name="**/*.html"/>
21941f03cd9SDamjan Jovanovic            <include name="**/*.js"/>
22041f03cd9SDamjan Jovanovic            <include name="**/*.mod"/>
22141f03cd9SDamjan Jovanovic            <include name="**/*.sql"/>
22241f03cd9SDamjan Jovanovic            <include name="**/*.xml"/>
22341f03cd9SDamjan Jovanovic            <include name="**/*.xsl"/>
22441f03cd9SDamjan Jovanovic            <include name="**/*.map"/>
22541f03cd9SDamjan Jovanovic        </jar>
22641f03cd9SDamjan Jovanovic    </target>
22741f03cd9SDamjan Jovanovic
2288cb913c4SDamjan Jovanovic    <extension-point name="pre-clean" depends="prepare"/>
2298cb913c4SDamjan Jovanovic
2308cb913c4SDamjan Jovanovic    <target name="clean" depends="pre-clean">
23141f03cd9SDamjan Jovanovic        <delete dir="${build.base.dir}"/>
23241f03cd9SDamjan Jovanovic        <delete file="${jar.dir}/${jar.name}.jar"/>
23341f03cd9SDamjan Jovanovic    </target>
23441f03cd9SDamjan Jovanovic
23541f03cd9SDamjan Jovanovic    <target name="main" depends="test,jar"/>
23641f03cd9SDamjan Jovanovic
23741f03cd9SDamjan Jovanovic</project>
23841f03cd9SDamjan Jovanovic
239