1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
<project name="jOpenDocument" default="dist" basedir=".">
<loadproperties srcfile="src/product.properties">
<filterchain>
<prefixlines prefix="product." />
</filterchain>
</loadproperties>
<property name="version" value="${product.VERSION}" />
<property name="src.dir" location="src" />
<property name="dist" value="dist" />
<property name="dist.dir" location="${dist}" />
<property name="dist.java5.jar" location="${dist.dir}/${ant.project.name}-${version}-jdk5.jar" />
<property name="dist.java6.jar" location="${dist.dir}/${ant.project.name}-${version}.jar" />
<target name="init">
<!-- Create the build directory structure used by compile -->
</target>
<target name="dist.init" depends="init">
<delete dir="${dist.dir}" />
<mkdir dir="${dist.dir}" />
<condition property="isJava5">
<matches pattern="1.5.*" string="${java.version}" />
</condition>
</target>
<!-- necessary for Common/build-app.xml -->
<target name="jar" depends="dist" />
<target name="dist" depends="dist.init,distJava5,distJava6">
<!-- clean up -->
<delete dir="build" />
<zip destfile="${dist.dir}/${ant.project.name}-src-${version}.zip">
<zipfileset dir="src" prefix="src" />
<fileset dir="." includes="template/**" />
<fileset dir="." includes="build.xml,LICENSE.txt,NEWS,README,lib/*.jar" />
</zip>
<delete file="template/Thumbs.db" />
<zip destfile="${dist.dir}/${ant.project.name}-template-${version}.zip">
<fileset dir="template" />
</zip>
</target>
<target name="distJava6" depends="dist.init" unless="isJava5">
<echo>Building JDK6 version</echo>
<delete dir="build" />
<mkdir dir="build" />
<javac srcdir="src/" destdir="build">
<compilerarg value="-Xlint:deprecation" />
<compilerarg value="-Xlint:unchecked" />
<classpath>
<fileset dir="lib" includes="**/*.jar" />
<fileset dir="/usr/share/java" includes="itext.jar" />
<fileset dir="/usr/share/java" includes="junit4.jar" />
</classpath>
</javac>
<antcall target="-mkjar">
<param name="jar" value="${dist.java6.jar}" />
</antcall>
</target>
<target name="distJava5" depends="distJava5.ok, distJava5.nok" />
<target name="distJava5.nok" unless="jre5.dir">
<echo message="Not building for java 5 since jre5.dir is not defined" level="warning" />
</target>
<target name="distJava5.ok" depends="dist.init" if="jre5.dir">
<!-- check that rt.jar exists otherwise javac silently compile with the java6 rt.jar -->
<available property="jre5.validDir" file="${jre5.dir}/lib/rt.jar" />
<fail unless="jre5.validDir">
Unable to build since ${jre5.dir}/lib/rt.jar doesn't exist.
</fail>
<echo>Building JDK5 version with ${jre5.dir}</echo>
<fail if="isJava5">
have to compile with javac 6, as the 5 has a generic bug preventing it from compiling ExnTransformer
</fail>
<delete dir="build" />
<mkdir dir="build" />
<javac target="1.5" source="1.5" sourcepath="" srcdir="src/" destdir="build" bootclasspath="${jre5.dir}/lib/rt.jar">
<exclude name="org/jopendocument/dom/template/JavaScriptFileTemplate.java" />
<exclude name="org/jopendocument/dom/template/engine/ScriptEngineDataModel.java" />
<exclude name="**/Test.java" />
<classpath>
<fileset dir="lib" includes="**/*.jar" />
<fileset dir="/usr/share/java" includes="itext.jar" />
<fileset dir="/usr/share/java" includes="junit4.jar" />
</classpath>
</javac>
<antcall target="-mkjar">
<param name="jar" value="${dist.java5.jar}" />
</antcall>
</target>
<target name="-mkjar">
<!-- mimic eclipse -->
<copy todir="build">
<fileset dir="src" excludes="**/*.java" />
</copy>
<!-- on jar ensemble tous les jars dependant -->
<jar destfile="${jar}" basedir="build" duplicate="preserve" filesetmanifest="mergewithoutmain">
<metainf file="LICENSE.txt" />
<zipgroupfileset dir="lib" includes="*.jar" />
</jar>
</target>
<target name="clean">
<delete dir="build"/>
<delete dir="dist"/>
</target>
</project>
|