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