xref: /trunk/main/solenv/ant/aoo-ant.xml (revision a622bb93)
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}"/>
3841f03cd9SDamjan Jovanovic    <property name="main.src.dir" location="src/main/java"/>
3941f03cd9SDamjan Jovanovic    <property name="main.build.dir" location="${build.base.dir}/main"/>
4041f03cd9SDamjan Jovanovic    <property name="test.src.dir" location="src/test/java"/>
4141f03cd9SDamjan Jovanovic    <property name="test.build.dir" location="${build.base.dir}/test"/>
4241f03cd9SDamjan Jovanovic    <property name="test.reports.dir" location="${build.base.dir}/test-reports"/>
4331eff9ffSDamjan Jovanovic    <property name="java.baseline.version" value="1.7"/>
4441f03cd9SDamjan Jovanovic    <property name="jar.dir" location="${WORKDIR}/Ant"/>
4541f03cd9SDamjan Jovanovic
4641f03cd9SDamjan Jovanovic    <property name="main.debug" value="true"/>
4741f03cd9SDamjan Jovanovic    <property name="main.deprecation" value="false"/>
4841f03cd9SDamjan Jovanovic    <property name="test.debug" value="true"/>
4941f03cd9SDamjan Jovanovic    <property name="test.deprecation" value="false"/>
5041f03cd9SDamjan Jovanovic
5141f03cd9SDamjan Jovanovic    <import file="${aoo-ant.basedir}/externals.xml"/>
5241f03cd9SDamjan Jovanovic    <import file="${aoo-ant.basedir}/idl.xml"/>
5341f03cd9SDamjan Jovanovic
5441f03cd9SDamjan Jovanovic    <target name="init-project"/>
5541f03cd9SDamjan Jovanovic
5641f03cd9SDamjan Jovanovic    <target name="prepare" depends="init-project">
5741f03cd9SDamjan Jovanovic        <property name="jar.enabled" value="true"/>
5841f03cd9SDamjan Jovanovic        <property name="jar.name" value="${ant.project.name}"/>
5941f03cd9SDamjan Jovanovic        <property name="jar.classpath" value=""/>
6041f03cd9SDamjan Jovanovic        <property name="jar.manifest" value ="${aoo-ant.basedir}/manifest.empty"/>
6141f03cd9SDamjan Jovanovic
6241f03cd9SDamjan Jovanovic        <local name="has.main.classpath"/>
6341f03cd9SDamjan Jovanovic        <condition property="has.main.classpath">
6441f03cd9SDamjan Jovanovic            <isreference refid="main.classpath"/>
6541f03cd9SDamjan Jovanovic        </condition>
6641f03cd9SDamjan Jovanovic        <path id="main.classpath" unless:set="has.main.classpath"/>
6741f03cd9SDamjan Jovanovic
6841f03cd9SDamjan Jovanovic        <local name="has.test.classpath"/>
6941f03cd9SDamjan Jovanovic        <condition property="has.test.classpath">
7041f03cd9SDamjan Jovanovic            <isreference refid="test.classpath"/>
7141f03cd9SDamjan Jovanovic        </condition>
7241f03cd9SDamjan Jovanovic        <path id="internal.test.classpath">
7341f03cd9SDamjan Jovanovic            <pathelement location="${main.build.dir}"/>
7441f03cd9SDamjan Jovanovic            <pathelement location="${test.build.dir}"/>
7541f03cd9SDamjan Jovanovic            <path refid="main.classpath"/>
7641f03cd9SDamjan Jovanovic            <path refid="test.classpath" if:set="has.test.classpath"/>
7741f03cd9SDamjan Jovanovic            <pathelement location="${idl.classes.build.dir}"/>
7841f03cd9SDamjan Jovanovic            <pathelement location="${OOO_JUNIT_JAR}"/>
7941f03cd9SDamjan Jovanovic        </path>
8041f03cd9SDamjan Jovanovic
8141f03cd9SDamjan Jovanovic        <local name="has.idl.files"/>
8241f03cd9SDamjan Jovanovic        <condition property="has.idl.files">
8341f03cd9SDamjan Jovanovic            <isreference refid="idl.files"/>
8441f03cd9SDamjan Jovanovic        </condition>
85bee6bcb9SDamjan Jovanovic        <filelist id="idl.files" unless:set="has.idl.files"/>
8641f03cd9SDamjan Jovanovic    </target>
8741f03cd9SDamjan Jovanovic
8841f03cd9SDamjan Jovanovic    <target name="res" depends="prepare">
8941f03cd9SDamjan Jovanovic        <mkdir dir="${main.build.dir}"/>
9041f03cd9SDamjan Jovanovic        <copy todir="${main.build.dir}">
9141f03cd9SDamjan Jovanovic             <fileset dir="${main.src.dir}">
9241f03cd9SDamjan Jovanovic                 <include name="**/*.properties"/>
9341f03cd9SDamjan Jovanovic                 <include name="**/*.css"/>
9441f03cd9SDamjan Jovanovic                 <include name="**/*.dtd"/>
9541f03cd9SDamjan Jovanovic                 <include name="**/*.form"/>
9641f03cd9SDamjan Jovanovic                 <include name="**/*.gif "/>
9741f03cd9SDamjan Jovanovic                 <include name="**/*.htm"/>
9841f03cd9SDamjan Jovanovic                 <include name="**/*.html"/>
9941f03cd9SDamjan Jovanovic                 <include name="**/*.js"/>
10041f03cd9SDamjan Jovanovic                 <include name="**/*.mod"/>
10141f03cd9SDamjan Jovanovic                 <include name="**/*.sql"/>
10241f03cd9SDamjan Jovanovic                 <include name="**/*.xml"/>
10341f03cd9SDamjan Jovanovic                 <include name="**/*.xsl"/>
10441f03cd9SDamjan Jovanovic                 <include name="**/*.map"/>
10541f03cd9SDamjan Jovanovic             </fileset>
10641f03cd9SDamjan Jovanovic        </copy>
10741f03cd9SDamjan Jovanovic    </target>
10841f03cd9SDamjan Jovanovic
109bee6bcb9SDamjan Jovanovic    <extension-point name="pre-compile" depends="prepare,res"/>
110bee6bcb9SDamjan Jovanovic
111bee6bcb9SDamjan Jovanovic    <target name="compile" depends="pre-compile">
11241f03cd9SDamjan Jovanovic        <mkdir dir="${main.build.dir}"/>
11341f03cd9SDamjan Jovanovic        <javac srcdir="${main.src.dir}"
11441f03cd9SDamjan Jovanovic               destdir="${main.build.dir}"
11531eff9ffSDamjan Jovanovic               source="${java.baseline.version}"
11631eff9ffSDamjan Jovanovic               target="${java.baseline.version}"
11741f03cd9SDamjan Jovanovic               debug="${main.debug}"
11841f03cd9SDamjan Jovanovic               debuglevel="lines,vars,source"
11941f03cd9SDamjan Jovanovic               deprecation="${main.deprecation}"
12041f03cd9SDamjan Jovanovic               classpathref="main.classpath"
12141f03cd9SDamjan Jovanovic               includeantruntime="false"/>
12241f03cd9SDamjan Jovanovic    </target>
12341f03cd9SDamjan Jovanovic
124*a622bb93SDamjan Jovanovic    <macrodef name="check-test">
125*a622bb93SDamjan Jovanovic        <sequential>
126*a622bb93SDamjan Jovanovic            <local name="tests.present"/>
127*a622bb93SDamjan Jovanovic            <available type="dir" file="${test.src.dir}" property="tests.present"/>
128*a622bb93SDamjan Jovanovic            <echo message="No tests" unless:set="tests.present"/>
129*a622bb93SDamjan Jovanovic
130*a622bb93SDamjan Jovanovic            <local name="only.junit.absent"/>
131*a622bb93SDamjan Jovanovic            <condition property="only.junit.absent">
132*a622bb93SDamjan Jovanovic                <and>
133*a622bb93SDamjan Jovanovic                    <isset property="tests.present"/>
134*a622bb93SDamjan Jovanovic                    <not><isset property="OOO_JUNIT_JAR"/></not>
135*a622bb93SDamjan Jovanovic                </and>
136*a622bb93SDamjan Jovanovic            </condition>
137*a622bb93SDamjan Jovanovic            <echo message="No junit, skipping tests" if:set="only.junit.absent"/>
138*a622bb93SDamjan Jovanovic
139*a622bb93SDamjan Jovanovic            <condition property="test.skip">
140*a622bb93SDamjan Jovanovic                <or>
141*a622bb93SDamjan Jovanovic                    <not><isset property="test.present"/></not>
142*a622bb93SDamjan Jovanovic                    <not><isset property="OOO_JUNIT_JAR"/></not>
143*a622bb93SDamjan Jovanovic                </or>
144*a622bb93SDamjan Jovanovic            </condition>
145*a622bb93SDamjan Jovanovic        </sequential>
146*a622bb93SDamjan Jovanovic    </macrodef>
147*a622bb93SDamjan Jovanovic
148*a622bb93SDamjan Jovanovic    <target name="test-compile" depends="compile,idl">
149*a622bb93SDamjan Jovanovic        <check-test/>
150cede1e5bSDamjan Jovanovic        <mkdir dir="${test.build.dir}" unless:set="test.skip"/>
15141f03cd9SDamjan Jovanovic        <javac srcdir="${test.src.dir}"
15241f03cd9SDamjan Jovanovic               destdir="${test.build.dir}"
15331eff9ffSDamjan Jovanovic               source="${java.baseline.version}"
15431eff9ffSDamjan Jovanovic               target="${java.baseline.version}"
15541f03cd9SDamjan Jovanovic               debug="${test.debug}"
15641f03cd9SDamjan Jovanovic               debuglevel="lines,vars,source"
15741f03cd9SDamjan Jovanovic               deprecation="${test.deprecation}"
15841f03cd9SDamjan Jovanovic               classpathref="internal.test.classpath"
15941f03cd9SDamjan Jovanovic               includeantruntime="false"
160cede1e5bSDamjan Jovanovic               unless:set="test.skip"/>
16141f03cd9SDamjan Jovanovic    </target>
16241f03cd9SDamjan Jovanovic
16341f03cd9SDamjan Jovanovic    <!-- fork="true" is sadly necessary on Ubuntu due to multiple versions of junit confusing Ant,
16441f03cd9SDamjan Jovanovic         see https://github.com/real-logic/simple-binary-encoding/issues/96 -->
165f9bad0d2SDamjan Jovanovic    <target name="test" depends="test-compile" unless="${test.skip}">
16641f03cd9SDamjan Jovanovic        <mkdir dir="${test.reports.dir}"/>
16741f03cd9SDamjan Jovanovic        <junit printsummary="yes" haltonfailure="yes" showoutput="true" filtertrace="false" fork="true">
16841f03cd9SDamjan Jovanovic            <classpath refid="internal.test.classpath"/>
16941f03cd9SDamjan Jovanovic            <formatter type="plain"/>
17041f03cd9SDamjan Jovanovic            <batchtest todir="${test.reports.dir}">
17141f03cd9SDamjan Jovanovic                <fileset dir="${test.src.dir}">
17241f03cd9SDamjan Jovanovic                    <include name="**/*_Test.java"/>
17341f03cd9SDamjan Jovanovic                </fileset>
17441f03cd9SDamjan Jovanovic            </batchtest>
17541f03cd9SDamjan Jovanovic        </junit>
17641f03cd9SDamjan Jovanovic    </target>
17741f03cd9SDamjan Jovanovic
17841f03cd9SDamjan Jovanovic    <target name="jar" depends="compile" if="${jar.enabled}">
17941f03cd9SDamjan Jovanovic        <jar destfile="${jar.dir}/${jar.name}.jar"
18041f03cd9SDamjan Jovanovic             basedir="${main.build.dir}"
18141f03cd9SDamjan Jovanovic             manifest="${jar.manifest}">
18241f03cd9SDamjan Jovanovic            <manifest>
18341f03cd9SDamjan Jovanovic                <attribute name="Class-Path" value="${jar.classpath}" unless:blank="${jar.classpath}"/>
18441f03cd9SDamjan Jovanovic                <attribute name="Solar-Version" value="${RSCREVISION}"/>
18541f03cd9SDamjan Jovanovic            </manifest>
18641f03cd9SDamjan Jovanovic            <include name="**/*.class"/>
18741f03cd9SDamjan Jovanovic            <include name="**/*.properties"/>
18841f03cd9SDamjan Jovanovic            <include name="**/*.css"/>
18941f03cd9SDamjan Jovanovic            <include name="**/*.dtd"/>
19041f03cd9SDamjan Jovanovic            <include name="**/*.form"/>
19141f03cd9SDamjan Jovanovic            <include name="**/*.gif "/>
19241f03cd9SDamjan Jovanovic            <include name="**/*.htm"/>
19341f03cd9SDamjan Jovanovic            <include name="**/*.html"/>
19441f03cd9SDamjan Jovanovic            <include name="**/*.js"/>
19541f03cd9SDamjan Jovanovic            <include name="**/*.mod"/>
19641f03cd9SDamjan Jovanovic            <include name="**/*.sql"/>
19741f03cd9SDamjan Jovanovic            <include name="**/*.xml"/>
19841f03cd9SDamjan Jovanovic            <include name="**/*.xsl"/>
19941f03cd9SDamjan Jovanovic            <include name="**/*.map"/>
20041f03cd9SDamjan Jovanovic        </jar>
20141f03cd9SDamjan Jovanovic    </target>
20241f03cd9SDamjan Jovanovic
2038cb913c4SDamjan Jovanovic    <extension-point name="pre-clean" depends="prepare"/>
2048cb913c4SDamjan Jovanovic
2058cb913c4SDamjan Jovanovic    <target name="clean" depends="pre-clean">
20641f03cd9SDamjan Jovanovic        <delete dir="${build.base.dir}"/>
20741f03cd9SDamjan Jovanovic        <delete file="${jar.dir}/${jar.name}.jar"/>
20841f03cd9SDamjan Jovanovic    </target>
20941f03cd9SDamjan Jovanovic
21041f03cd9SDamjan Jovanovic    <target name="main" depends="test,jar"/>
21141f03cd9SDamjan Jovanovic
21241f03cd9SDamjan Jovanovic</project>
21341f03cd9SDamjan Jovanovic
214