xref: /aoo42x/main/solenv/ant/aoo-ant.xml (revision f9bad0d2)
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>
8441f03cd9SDamjan Jovanovic        <filelist id="idl.files" unless:set="has.idl.files">
8541f03cd9SDamjan Jovanovic            <filelist refid="idl.files"/>
8641f03cd9SDamjan Jovanovic        </filelist>
8741f03cd9SDamjan Jovanovic    </target>
8841f03cd9SDamjan Jovanovic
8941f03cd9SDamjan Jovanovic    <target name="res" depends="prepare">
9041f03cd9SDamjan Jovanovic        <mkdir dir="${main.build.dir}"/>
9141f03cd9SDamjan Jovanovic        <copy todir="${main.build.dir}">
9241f03cd9SDamjan Jovanovic             <fileset dir="${main.src.dir}">
9341f03cd9SDamjan Jovanovic                 <include name="**/*.properties"/>
9441f03cd9SDamjan Jovanovic                 <include name="**/*.css"/>
9541f03cd9SDamjan Jovanovic                 <include name="**/*.dtd"/>
9641f03cd9SDamjan Jovanovic                 <include name="**/*.form"/>
9741f03cd9SDamjan Jovanovic                 <include name="**/*.gif "/>
9841f03cd9SDamjan Jovanovic                 <include name="**/*.htm"/>
9941f03cd9SDamjan Jovanovic                 <include name="**/*.html"/>
10041f03cd9SDamjan Jovanovic                 <include name="**/*.js"/>
10141f03cd9SDamjan Jovanovic                 <include name="**/*.mod"/>
10241f03cd9SDamjan Jovanovic                 <include name="**/*.sql"/>
10341f03cd9SDamjan Jovanovic                 <include name="**/*.xml"/>
10441f03cd9SDamjan Jovanovic                 <include name="**/*.xsl"/>
10541f03cd9SDamjan Jovanovic                 <include name="**/*.map"/>
10641f03cd9SDamjan Jovanovic             </fileset>
10741f03cd9SDamjan Jovanovic        </copy>
10841f03cd9SDamjan Jovanovic    </target>
10941f03cd9SDamjan Jovanovic
11041f03cd9SDamjan Jovanovic    <target name="compile" depends="prepare,res">
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
12141f03cd9SDamjan Jovanovic    <target name="test-compile" depends="compile,idl">
122*f9bad0d2SDamjan Jovanovic        <property name="test.skip" value="true" unless:set="OOO_JUNIT_JAR"/>
123*f9bad0d2SDamjan Jovanovic        <echo message="No junit, skipping tests" unless:set="OOO_JUNIT_JAR"/>
12441f03cd9SDamjan Jovanovic
125*f9bad0d2SDamjan Jovanovic        <mkdir dir="${test.build.dir}" if:set="OOO_JUNIT_JAR"/>
12641f03cd9SDamjan Jovanovic        <javac srcdir="${test.src.dir}"
12741f03cd9SDamjan Jovanovic               destdir="${test.build.dir}"
12841f03cd9SDamjan Jovanovic               debug="${test.debug}"
12941f03cd9SDamjan Jovanovic               debuglevel="lines,vars,source"
13041f03cd9SDamjan Jovanovic               deprecation="${test.deprecation}"
13141f03cd9SDamjan Jovanovic               classpathref="internal.test.classpath"
13241f03cd9SDamjan Jovanovic               includeantruntime="false"
133*f9bad0d2SDamjan Jovanovic               if:set="OOO_JUNIT_JAR"/>
13441f03cd9SDamjan Jovanovic    </target>
13541f03cd9SDamjan Jovanovic
13641f03cd9SDamjan Jovanovic    <!-- fork="true" is sadly necessary on Ubuntu due to multiple versions of junit confusing Ant,
13741f03cd9SDamjan Jovanovic         see https://github.com/real-logic/simple-binary-encoding/issues/96 -->
138*f9bad0d2SDamjan Jovanovic    <target name="test" depends="test-compile" unless="${test.skip}">
13941f03cd9SDamjan Jovanovic        <mkdir dir="${test.reports.dir}"/>
14041f03cd9SDamjan Jovanovic        <junit printsummary="yes" haltonfailure="yes" showoutput="true" filtertrace="false" fork="true">
14141f03cd9SDamjan Jovanovic            <classpath refid="internal.test.classpath"/>
14241f03cd9SDamjan Jovanovic            <formatter type="plain"/>
14341f03cd9SDamjan Jovanovic            <batchtest todir="${test.reports.dir}">
14441f03cd9SDamjan Jovanovic                <fileset dir="${test.src.dir}">
14541f03cd9SDamjan Jovanovic                    <include name="**/*_Test.java"/>
14641f03cd9SDamjan Jovanovic                </fileset>
14741f03cd9SDamjan Jovanovic            </batchtest>
14841f03cd9SDamjan Jovanovic        </junit>
14941f03cd9SDamjan Jovanovic    </target>
15041f03cd9SDamjan Jovanovic
15141f03cd9SDamjan Jovanovic    <target name="jar" depends="compile" if="${jar.enabled}">
15241f03cd9SDamjan Jovanovic        <jar destfile="${jar.dir}/${jar.name}.jar"
15341f03cd9SDamjan Jovanovic             basedir="${main.build.dir}"
15441f03cd9SDamjan Jovanovic             manifest="${jar.manifest}">
15541f03cd9SDamjan Jovanovic            <manifest>
15641f03cd9SDamjan Jovanovic                <attribute name="Class-Path" value="${jar.classpath}" unless:blank="${jar.classpath}"/>
15741f03cd9SDamjan Jovanovic                <attribute name="Solar-Version" value="${RSCREVISION}"/>
15841f03cd9SDamjan Jovanovic            </manifest>
15941f03cd9SDamjan Jovanovic            <include name="**/*.class"/>
16041f03cd9SDamjan Jovanovic            <include name="**/*.properties"/>
16141f03cd9SDamjan Jovanovic            <include name="**/*.css"/>
16241f03cd9SDamjan Jovanovic            <include name="**/*.dtd"/>
16341f03cd9SDamjan Jovanovic            <include name="**/*.form"/>
16441f03cd9SDamjan Jovanovic            <include name="**/*.gif "/>
16541f03cd9SDamjan Jovanovic            <include name="**/*.htm"/>
16641f03cd9SDamjan Jovanovic            <include name="**/*.html"/>
16741f03cd9SDamjan Jovanovic            <include name="**/*.js"/>
16841f03cd9SDamjan Jovanovic            <include name="**/*.mod"/>
16941f03cd9SDamjan Jovanovic            <include name="**/*.sql"/>
17041f03cd9SDamjan Jovanovic            <include name="**/*.xml"/>
17141f03cd9SDamjan Jovanovic            <include name="**/*.xsl"/>
17241f03cd9SDamjan Jovanovic            <include name="**/*.map"/>
17341f03cd9SDamjan Jovanovic        </jar>
17441f03cd9SDamjan Jovanovic    </target>
17541f03cd9SDamjan Jovanovic
17641f03cd9SDamjan Jovanovic    <target name="clean" depends="prepare">
17741f03cd9SDamjan Jovanovic        <delete dir="${build.base.dir}"/>
17841f03cd9SDamjan Jovanovic        <delete file="${jar.dir}/${jar.name}.jar"/>
17941f03cd9SDamjan Jovanovic    </target>
18041f03cd9SDamjan Jovanovic
18141f03cd9SDamjan Jovanovic    <target name="main" depends="test,jar"/>
18241f03cd9SDamjan Jovanovic
18341f03cd9SDamjan Jovanovic</project>
18441f03cd9SDamjan Jovanovic
185