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