xref: /aoo42x/main/solenv/ant/aoo-ant.xml (revision 31eff9ff)
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"/>
43*31eff9ffSDamjan 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}"
115*31eff9ffSDamjan Jovanovic               source="${java.baseline.version}"
116*31eff9ffSDamjan 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
124cede1e5bSDamjan Jovanovic    <target name="test-check">
125cede1e5bSDamjan Jovanovic        <local name="tests.present"/>
126cede1e5bSDamjan Jovanovic        <available type="dir" file="${test.src.dir}" property="tests.present"/>
127cede1e5bSDamjan Jovanovic        <echo message="No tests" unless:set="tests.present"/>
128cede1e5bSDamjan Jovanovic
129cede1e5bSDamjan Jovanovic        <local name="only.junit.absent"/>
130cede1e5bSDamjan Jovanovic        <condition property="only.junit.absent">
131cede1e5bSDamjan Jovanovic            <and>
132cede1e5bSDamjan Jovanovic                <isset property="tests.present"/>
133cede1e5bSDamjan Jovanovic                <not><isset property="OOO_JUNIT_JAR"/></not>
134cede1e5bSDamjan Jovanovic            </and>
135cede1e5bSDamjan Jovanovic        </condition>
136cede1e5bSDamjan Jovanovic        <echo message="No junit, skipping tests" if:set="only.junit.absent"/>
137cede1e5bSDamjan Jovanovic
138cede1e5bSDamjan Jovanovic        <condition property="test.skip">
139cede1e5bSDamjan Jovanovic            <or>
140cede1e5bSDamjan Jovanovic                <not><isset property="test.present"/></not>
141cede1e5bSDamjan Jovanovic                <not><isset property="OOO_JUNIT_JAR"/></not>
142cede1e5bSDamjan Jovanovic            </or>
143cede1e5bSDamjan Jovanovic        </condition>
144cede1e5bSDamjan Jovanovic    </target>
14541f03cd9SDamjan Jovanovic
146cede1e5bSDamjan Jovanovic    <target name="test-compile" depends="compile,idl,test-check">
147cede1e5bSDamjan Jovanovic        <mkdir dir="${test.build.dir}" unless:set="test.skip"/>
14841f03cd9SDamjan Jovanovic        <javac srcdir="${test.src.dir}"
14941f03cd9SDamjan Jovanovic               destdir="${test.build.dir}"
150*31eff9ffSDamjan Jovanovic               source="${java.baseline.version}"
151*31eff9ffSDamjan Jovanovic               target="${java.baseline.version}"
15241f03cd9SDamjan Jovanovic               debug="${test.debug}"
15341f03cd9SDamjan Jovanovic               debuglevel="lines,vars,source"
15441f03cd9SDamjan Jovanovic               deprecation="${test.deprecation}"
15541f03cd9SDamjan Jovanovic               classpathref="internal.test.classpath"
15641f03cd9SDamjan Jovanovic               includeantruntime="false"
157cede1e5bSDamjan Jovanovic               unless:set="test.skip"/>
15841f03cd9SDamjan Jovanovic    </target>
15941f03cd9SDamjan Jovanovic
16041f03cd9SDamjan Jovanovic    <!-- fork="true" is sadly necessary on Ubuntu due to multiple versions of junit confusing Ant,
16141f03cd9SDamjan Jovanovic         see https://github.com/real-logic/simple-binary-encoding/issues/96 -->
162f9bad0d2SDamjan Jovanovic    <target name="test" depends="test-compile" unless="${test.skip}">
16341f03cd9SDamjan Jovanovic        <mkdir dir="${test.reports.dir}"/>
16441f03cd9SDamjan Jovanovic        <junit printsummary="yes" haltonfailure="yes" showoutput="true" filtertrace="false" fork="true">
16541f03cd9SDamjan Jovanovic            <classpath refid="internal.test.classpath"/>
16641f03cd9SDamjan Jovanovic            <formatter type="plain"/>
16741f03cd9SDamjan Jovanovic            <batchtest todir="${test.reports.dir}">
16841f03cd9SDamjan Jovanovic                <fileset dir="${test.src.dir}">
16941f03cd9SDamjan Jovanovic                    <include name="**/*_Test.java"/>
17041f03cd9SDamjan Jovanovic                </fileset>
17141f03cd9SDamjan Jovanovic            </batchtest>
17241f03cd9SDamjan Jovanovic        </junit>
17341f03cd9SDamjan Jovanovic    </target>
17441f03cd9SDamjan Jovanovic
17541f03cd9SDamjan Jovanovic    <target name="jar" depends="compile" if="${jar.enabled}">
17641f03cd9SDamjan Jovanovic        <jar destfile="${jar.dir}/${jar.name}.jar"
17741f03cd9SDamjan Jovanovic             basedir="${main.build.dir}"
17841f03cd9SDamjan Jovanovic             manifest="${jar.manifest}">
17941f03cd9SDamjan Jovanovic            <manifest>
18041f03cd9SDamjan Jovanovic                <attribute name="Class-Path" value="${jar.classpath}" unless:blank="${jar.classpath}"/>
18141f03cd9SDamjan Jovanovic                <attribute name="Solar-Version" value="${RSCREVISION}"/>
18241f03cd9SDamjan Jovanovic            </manifest>
18341f03cd9SDamjan Jovanovic            <include name="**/*.class"/>
18441f03cd9SDamjan Jovanovic            <include name="**/*.properties"/>
18541f03cd9SDamjan Jovanovic            <include name="**/*.css"/>
18641f03cd9SDamjan Jovanovic            <include name="**/*.dtd"/>
18741f03cd9SDamjan Jovanovic            <include name="**/*.form"/>
18841f03cd9SDamjan Jovanovic            <include name="**/*.gif "/>
18941f03cd9SDamjan Jovanovic            <include name="**/*.htm"/>
19041f03cd9SDamjan Jovanovic            <include name="**/*.html"/>
19141f03cd9SDamjan Jovanovic            <include name="**/*.js"/>
19241f03cd9SDamjan Jovanovic            <include name="**/*.mod"/>
19341f03cd9SDamjan Jovanovic            <include name="**/*.sql"/>
19441f03cd9SDamjan Jovanovic            <include name="**/*.xml"/>
19541f03cd9SDamjan Jovanovic            <include name="**/*.xsl"/>
19641f03cd9SDamjan Jovanovic            <include name="**/*.map"/>
19741f03cd9SDamjan Jovanovic        </jar>
19841f03cd9SDamjan Jovanovic    </target>
19941f03cd9SDamjan Jovanovic
20041f03cd9SDamjan Jovanovic    <target name="clean" depends="prepare">
20141f03cd9SDamjan Jovanovic        <delete dir="${build.base.dir}"/>
20241f03cd9SDamjan Jovanovic        <delete file="${jar.dir}/${jar.name}.jar"/>
20341f03cd9SDamjan Jovanovic    </target>
20441f03cd9SDamjan Jovanovic
20541f03cd9SDamjan Jovanovic    <target name="main" depends="test,jar"/>
20641f03cd9SDamjan Jovanovic
20741f03cd9SDamjan Jovanovic</project>
20841f03cd9SDamjan Jovanovic
209