xref: /aoo42x/main/solenv/ant/aoo-ant.xml (revision 41f03cd9)
1*41f03cd9SDamjan Jovanovic<?xml version="1.0" encoding="UTF-8"?>
2*41f03cd9SDamjan Jovanovic<!--***********************************************************
3*41f03cd9SDamjan Jovanovic *
4*41f03cd9SDamjan Jovanovic * Licensed to the Apache Software Foundation (ASF) under one
5*41f03cd9SDamjan Jovanovic * or more contributor license agreements.  See the NOTICE file
6*41f03cd9SDamjan Jovanovic * distributed with this work for additional information
7*41f03cd9SDamjan Jovanovic * regarding copyright ownership.  The ASF licenses this file
8*41f03cd9SDamjan Jovanovic * to you under the Apache License, Version 2.0 (the
9*41f03cd9SDamjan Jovanovic * "License"); you may not use this file except in compliance
10*41f03cd9SDamjan Jovanovic * with the License.  You may obtain a copy of the License at
11*41f03cd9SDamjan Jovanovic *
12*41f03cd9SDamjan Jovanovic *   http://www.apache.org/licenses/LICENSE-2.0
13*41f03cd9SDamjan Jovanovic *
14*41f03cd9SDamjan Jovanovic * Unless required by applicable law or agreed to in writing,
15*41f03cd9SDamjan Jovanovic * software distributed under the License is distributed on an
16*41f03cd9SDamjan Jovanovic * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17*41f03cd9SDamjan Jovanovic * KIND, either express or implied.  See the License for the
18*41f03cd9SDamjan Jovanovic * specific language governing permissions and limitations
19*41f03cd9SDamjan Jovanovic * under the License.
20*41f03cd9SDamjan Jovanovic *
21*41f03cd9SDamjan Jovanovic ***********************************************************-->
22*41f03cd9SDamjan Jovanovic
23*41f03cd9SDamjan Jovanovic
24*41f03cd9SDamjan Jovanovic<project name="aoo-ant" default="main" xmlns:if="ant:if" xmlns:unless="ant:unless">
25*41f03cd9SDamjan Jovanovic
26*41f03cd9SDamjan Jovanovic    <!-- ================================================================= -->
27*41f03cd9SDamjan Jovanovic    <!-- settings                                                          -->
28*41f03cd9SDamjan Jovanovic    <!-- ================================================================= -->
29*41f03cd9SDamjan Jovanovic
30*41f03cd9SDamjan Jovanovic    <dirname property="aoo-ant.basedir" file="${ant.file.aoo-ant}"/>
31*41f03cd9SDamjan Jovanovic
32*41f03cd9SDamjan Jovanovic    <!-- global properties -->
33*41f03cd9SDamjan Jovanovic    <property file="${aoo-ant.basedir}/../../ant.properties"/>
34*41f03cd9SDamjan Jovanovic    <!-- RSCREVISION: -->
35*41f03cd9SDamjan Jovanovic    <property file="${aoo-ant.basedir}/../inc/minor.mk"/>
36*41f03cd9SDamjan Jovanovic
37*41f03cd9SDamjan Jovanovic    <property name="build.base.dir" location="${WORKDIR}/Ant/${ant.project.name}"/>
38*41f03cd9SDamjan Jovanovic    <property name="main.src.dir" location="src/main/java"/>
39*41f03cd9SDamjan Jovanovic    <property name="main.build.dir" location="${build.base.dir}/main"/>
40*41f03cd9SDamjan Jovanovic    <property name="test.src.dir" location="src/test/java"/>
41*41f03cd9SDamjan Jovanovic    <property name="test.build.dir" location="${build.base.dir}/test"/>
42*41f03cd9SDamjan Jovanovic    <property name="test.reports.dir" location="${build.base.dir}/test-reports"/>
43*41f03cd9SDamjan Jovanovic    <property name="jar.dir" location="${WORKDIR}/Ant"/>
44*41f03cd9SDamjan Jovanovic
45*41f03cd9SDamjan Jovanovic    <property name="main.debug" value="true"/>
46*41f03cd9SDamjan Jovanovic    <property name="main.deprecation" value="false"/>
47*41f03cd9SDamjan Jovanovic    <property name="test.debug" value="true"/>
48*41f03cd9SDamjan Jovanovic    <property name="test.deprecation" value="false"/>
49*41f03cd9SDamjan Jovanovic
50*41f03cd9SDamjan Jovanovic    <import file="${aoo-ant.basedir}/externals.xml"/>
51*41f03cd9SDamjan Jovanovic    <import file="${aoo-ant.basedir}/idl.xml"/>
52*41f03cd9SDamjan Jovanovic
53*41f03cd9SDamjan Jovanovic    <target name="init-project"/>
54*41f03cd9SDamjan Jovanovic
55*41f03cd9SDamjan Jovanovic    <target name="prepare" depends="init-project">
56*41f03cd9SDamjan Jovanovic        <property name="jar.enabled" value="true"/>
57*41f03cd9SDamjan Jovanovic        <property name="jar.name" value="${ant.project.name}"/>
58*41f03cd9SDamjan Jovanovic        <property name="jar.classpath" value=""/>
59*41f03cd9SDamjan Jovanovic        <property name="jar.manifest" value ="${aoo-ant.basedir}/manifest.empty"/>
60*41f03cd9SDamjan Jovanovic
61*41f03cd9SDamjan Jovanovic        <local name="has.main.classpath"/>
62*41f03cd9SDamjan Jovanovic        <condition property="has.main.classpath">
63*41f03cd9SDamjan Jovanovic            <isreference refid="main.classpath"/>
64*41f03cd9SDamjan Jovanovic        </condition>
65*41f03cd9SDamjan Jovanovic        <path id="main.classpath" unless:set="has.main.classpath"/>
66*41f03cd9SDamjan Jovanovic
67*41f03cd9SDamjan Jovanovic        <local name="has.test.classpath"/>
68*41f03cd9SDamjan Jovanovic        <condition property="has.test.classpath">
69*41f03cd9SDamjan Jovanovic            <isreference refid="test.classpath"/>
70*41f03cd9SDamjan Jovanovic        </condition>
71*41f03cd9SDamjan Jovanovic        <path id="internal.test.classpath">
72*41f03cd9SDamjan Jovanovic            <pathelement location="${main.build.dir}"/>
73*41f03cd9SDamjan Jovanovic            <pathelement location="${test.build.dir}"/>
74*41f03cd9SDamjan Jovanovic            <path refid="main.classpath"/>
75*41f03cd9SDamjan Jovanovic            <path refid="test.classpath" if:set="has.test.classpath"/>
76*41f03cd9SDamjan Jovanovic            <pathelement location="${idl.classes.build.dir}"/>
77*41f03cd9SDamjan Jovanovic            <pathelement location="${OOO_JUNIT_JAR}"/>
78*41f03cd9SDamjan Jovanovic        </path>
79*41f03cd9SDamjan Jovanovic
80*41f03cd9SDamjan Jovanovic        <local name="has.idl.files"/>
81*41f03cd9SDamjan Jovanovic        <condition property="has.idl.files">
82*41f03cd9SDamjan Jovanovic            <isreference refid="idl.files"/>
83*41f03cd9SDamjan Jovanovic        </condition>
84*41f03cd9SDamjan Jovanovic        <filelist id="idl.files" unless:set="has.idl.files">
85*41f03cd9SDamjan Jovanovic            <filelist refid="idl.files"/>
86*41f03cd9SDamjan Jovanovic        </filelist>
87*41f03cd9SDamjan Jovanovic    </target>
88*41f03cd9SDamjan Jovanovic
89*41f03cd9SDamjan Jovanovic    <target name="res" depends="prepare">
90*41f03cd9SDamjan Jovanovic        <mkdir dir="${main.build.dir}"/>
91*41f03cd9SDamjan Jovanovic        <copy todir="${main.build.dir}">
92*41f03cd9SDamjan Jovanovic             <fileset dir="${main.src.dir}">
93*41f03cd9SDamjan Jovanovic                 <include name="**/*.properties"/>
94*41f03cd9SDamjan Jovanovic                 <include name="**/*.css"/>
95*41f03cd9SDamjan Jovanovic                 <include name="**/*.dtd"/>
96*41f03cd9SDamjan Jovanovic                 <include name="**/*.form"/>
97*41f03cd9SDamjan Jovanovic                 <include name="**/*.gif "/>
98*41f03cd9SDamjan Jovanovic                 <include name="**/*.htm"/>
99*41f03cd9SDamjan Jovanovic                 <include name="**/*.html"/>
100*41f03cd9SDamjan Jovanovic                 <include name="**/*.js"/>
101*41f03cd9SDamjan Jovanovic                 <include name="**/*.mod"/>
102*41f03cd9SDamjan Jovanovic                 <include name="**/*.sql"/>
103*41f03cd9SDamjan Jovanovic                 <include name="**/*.xml"/>
104*41f03cd9SDamjan Jovanovic                 <include name="**/*.xsl"/>
105*41f03cd9SDamjan Jovanovic                 <include name="**/*.map"/>
106*41f03cd9SDamjan Jovanovic             </fileset>
107*41f03cd9SDamjan Jovanovic        </copy>
108*41f03cd9SDamjan Jovanovic    </target>
109*41f03cd9SDamjan Jovanovic
110*41f03cd9SDamjan Jovanovic    <target name="compile" depends="prepare,res">
111*41f03cd9SDamjan Jovanovic        <mkdir dir="${main.build.dir}"/>
112*41f03cd9SDamjan Jovanovic        <javac srcdir="${main.src.dir}"
113*41f03cd9SDamjan Jovanovic               destdir="${main.build.dir}"
114*41f03cd9SDamjan Jovanovic               debug="${main.debug}"
115*41f03cd9SDamjan Jovanovic               debuglevel="lines,vars,source"
116*41f03cd9SDamjan Jovanovic               deprecation="${main.deprecation}"
117*41f03cd9SDamjan Jovanovic               classpathref="main.classpath"
118*41f03cd9SDamjan Jovanovic               includeantruntime="false"/>
119*41f03cd9SDamjan Jovanovic    </target>
120*41f03cd9SDamjan Jovanovic
121*41f03cd9SDamjan Jovanovic    <target name="test-compile" depends="compile,idl">
122*41f03cd9SDamjan Jovanovic        <property property="test.skip" value="true" if:blank="${OOO_JUNIT_JAR}"/>
123*41f03cd9SDamjan Jovanovic        <echo message="No junit, skipping tests" if:blank="${OOO_JUNIT_JAR}"/>
124*41f03cd9SDamjan Jovanovic
125*41f03cd9SDamjan Jovanovic        <mkdir dir="${test.build.dir}" unless:blank="${OOO_JUNIT_JAR}"/>
126*41f03cd9SDamjan Jovanovic        <javac srcdir="${test.src.dir}"
127*41f03cd9SDamjan Jovanovic               destdir="${test.build.dir}"
128*41f03cd9SDamjan Jovanovic               debug="${test.debug}"
129*41f03cd9SDamjan Jovanovic               debuglevel="lines,vars,source"
130*41f03cd9SDamjan Jovanovic               deprecation="${test.deprecation}"
131*41f03cd9SDamjan Jovanovic               classpathref="internal.test.classpath"
132*41f03cd9SDamjan Jovanovic               includeantruntime="false"
133*41f03cd9SDamjan Jovanovic               unless:blank="${OOO_JUNIT_JAR}"/>
134*41f03cd9SDamjan Jovanovic    </target>
135*41f03cd9SDamjan Jovanovic
136*41f03cd9SDamjan Jovanovic    <!-- fork="true" is sadly necessary on Ubuntu due to multiple versions of junit confusing Ant,
137*41f03cd9SDamjan Jovanovic         see https://github.com/real-logic/simple-binary-encoding/issues/96 -->
138*41f03cd9SDamjan Jovanovic    <target name="test" depends="test-compile" unless:set="${test.skip}">
139*41f03cd9SDamjan Jovanovic        <mkdir dir="${test.reports.dir}"/>
140*41f03cd9SDamjan Jovanovic        <junit printsummary="yes" haltonfailure="yes" showoutput="true" filtertrace="false" fork="true">
141*41f03cd9SDamjan Jovanovic            <classpath refid="internal.test.classpath"/>
142*41f03cd9SDamjan Jovanovic            <formatter type="plain"/>
143*41f03cd9SDamjan Jovanovic            <batchtest todir="${test.reports.dir}">
144*41f03cd9SDamjan Jovanovic                <fileset dir="${test.src.dir}">
145*41f03cd9SDamjan Jovanovic                    <include name="**/*_Test.java"/>
146*41f03cd9SDamjan Jovanovic                </fileset>
147*41f03cd9SDamjan Jovanovic            </batchtest>
148*41f03cd9SDamjan Jovanovic        </junit>
149*41f03cd9SDamjan Jovanovic    </target>
150*41f03cd9SDamjan Jovanovic
151*41f03cd9SDamjan Jovanovic    <target name="jar" depends="compile" if="${jar.enabled}">
152*41f03cd9SDamjan Jovanovic        <jar destfile="${jar.dir}/${jar.name}.jar"
153*41f03cd9SDamjan Jovanovic             basedir="${main.build.dir}"
154*41f03cd9SDamjan Jovanovic             manifest="${jar.manifest}">
155*41f03cd9SDamjan Jovanovic            <manifest>
156*41f03cd9SDamjan Jovanovic                <attribute name="Class-Path" value="${jar.classpath}" unless:blank="${jar.classpath}"/>
157*41f03cd9SDamjan Jovanovic                <attribute name="Solar-Version" value="${RSCREVISION}"/>
158*41f03cd9SDamjan Jovanovic            </manifest>
159*41f03cd9SDamjan Jovanovic            <include name="**/*.class"/>
160*41f03cd9SDamjan Jovanovic            <include name="**/*.properties"/>
161*41f03cd9SDamjan Jovanovic            <include name="**/*.css"/>
162*41f03cd9SDamjan Jovanovic            <include name="**/*.dtd"/>
163*41f03cd9SDamjan Jovanovic            <include name="**/*.form"/>
164*41f03cd9SDamjan Jovanovic            <include name="**/*.gif "/>
165*41f03cd9SDamjan Jovanovic            <include name="**/*.htm"/>
166*41f03cd9SDamjan Jovanovic            <include name="**/*.html"/>
167*41f03cd9SDamjan Jovanovic            <include name="**/*.js"/>
168*41f03cd9SDamjan Jovanovic            <include name="**/*.mod"/>
169*41f03cd9SDamjan Jovanovic            <include name="**/*.sql"/>
170*41f03cd9SDamjan Jovanovic            <include name="**/*.xml"/>
171*41f03cd9SDamjan Jovanovic            <include name="**/*.xsl"/>
172*41f03cd9SDamjan Jovanovic            <include name="**/*.map"/>
173*41f03cd9SDamjan Jovanovic        </jar>
174*41f03cd9SDamjan Jovanovic    </target>
175*41f03cd9SDamjan Jovanovic
176*41f03cd9SDamjan Jovanovic    <target name="clean" depends="prepare">
177*41f03cd9SDamjan Jovanovic        <delete dir="${build.base.dir}"/>
178*41f03cd9SDamjan Jovanovic        <delete file="${jar.dir}/${jar.name}.jar"/>
179*41f03cd9SDamjan Jovanovic    </target>
180*41f03cd9SDamjan Jovanovic
181*41f03cd9SDamjan Jovanovic    <target name="main" depends="test,jar"/>
182*41f03cd9SDamjan Jovanovic
183*41f03cd9SDamjan Jovanovic</project>
184*41f03cd9SDamjan Jovanovic
185