poi/tools/targets/compile.xtarget

199 lines
7.1 KiB
Plaintext
Raw Normal View History

<!-- =================================================================== -->
<!-- Prepares the build directory -->
<!-- =================================================================== -->
<target name="prepare" depends="init">
<mkdir dir="${build.dir}"/>
</target>
<!-- =================================================================== -->
<!-- Prepares the source code -->
<!-- =================================================================== -->
<target name="prepare-src" depends="prepare">
<mkdir dir="${build.src}"/>
<mkdir dir="${build.dest}"/>
<copy todir="${build.src}" filtering="on">
<fileset dir="${java.dir}"/>
</copy>
<mkdir dir="${build.scratchpad.src}"/>
<mkdir dir="${build.scratchpad.dest}"/>
<copy todir="${build.scratchpad.src}" filtering="on">
<fileset dir="${scratchpad.src}"/>
</copy>
<mkdir dir="${build.examples.src}"/>
<mkdir dir="${build.examples.dest}"/>
<copy todir="${build.examples.src}" filtering="on">
<fileset dir="${examples.src}"/>
</copy>
<mkdir dir="${build.contrib.src}"/>
<mkdir dir="${build.contrib.dest}"/>
<copy todir="${build.contrib.src}" filtering="on">
<fileset dir="${contrib.src}"/>
</copy>
</target>
<!-- =================================================================== -->
<!-- Compiles the source directory -->
<!-- =================================================================== -->
<target name="compile" depends="prepare-src"
description="Compiles the source code">
<copy todir="${build.dest}">
<fileset dir="${build.src}">
<include name="**"/>
<!--
<include name="**/Manifest.mf"/>
<include name="**/*.xsl"/>
<include name="**/*.roles"/>
<include name="**/*.xconf"/>
<include name="META-INF/**"/>
-->
</fileset>
</copy>
<echo message="Compiling with Java ${ant.java.version}, debug ${debug}, optimize ${optimize}, deprecation ${deprecation}"/>
<javac srcdir="${build.src}"
destdir="${build.dest}"
debug="${debug}"
optimize="${optimize}"
deprecation="${deprecation}"
target="${target.vm}"
nowarn="${nowarn}">
<classpath refid="classpath"/>
</javac>
<copy todir="${build.scratchpad.dest}">
<fileset dir="${build.scratchpad.src}">
<include name="**"/>
<!--
<include name="**/Manifest.mf"/>
<include name="**/*.xsl"/>
<include name="**/*.roles"/>
<include name="**/*.xconf"/>
<include name="META-INF/**"/>
-->
</fileset>
</copy>
<javac srcdir="${build.scratchpad.src}"
destdir="${build.scratchpad.dest}"
debug="${debug}"
optimize="${optimize}"
deprecation="${deprecation}"
target="${target.vm}">
<classpath refid="scratchpad.classpath"/>
</javac>
<copy todir="${build.examples.dest}">
<fileset dir="${build.examples.src}">
<include name="**"/>
<!--
<include name="**/Manifest.mf"/>
<include name="**/*.xsl"/>
<include name="**/*.roles"/>
<include name="**/*.xconf"/>
<include name="META-INF/**"/>
-->
</fileset>
</copy>
<javac srcdir="${build.examples.src}"
destdir="${build.examples.dest}"
debug="${debug}"
optimize="${optimize}"
deprecation="${deprecation}"
target="${target.vm}">
<classpath refid="examples.classpath"/>
</javac>
<copy todir="${build.contrib.dest}">
<fileset dir="${build.contrib.src}">
<include name="**"/>
<!--
<include name="**/Manifest.mf"/>
<include name="**/*.xsl"/>
<include name="**/*.roles"/>
<include name="**/*.xconf"/>
<include name="META-INF/**"/>
-->
</fileset>
</copy>
<javac srcdir="${build.contrib.src}"
destdir="${build.contrib.dest}"
debug="${debug}"
optimize="${optimize}"
deprecation="${deprecation}"
target="${target.vm}">
<classpath refid="contrib.classpath"/>
</javac>
</target>
<!-- =================================================================== -->
<!-- Creates the jar file -->
<!-- =================================================================== -->
<target name="all" depends="package" description="Default target"/>
<target name="package" depends="compile" description="Generates the jar package">
<jar jarfile="${build.dir}/${name}.jar" manifest="${build.src}/Manifest.mf">
<fileset dir="${build.dest}">
<include name="**"/>
<include name="META-INF/**"/>
</fileset>
</jar>
<jar jarfile="${build.dir}/${scratchpad.name}.jar">
<fileset dir="${build.scratchpad.dest}">
<include name="**"/>
</fileset>
</jar>
<jar jarfile="${build.dir}/${examples.name}.jar">
<fileset dir="${build.examples.dest}">
<include name="**"/>
</fileset>
</jar>
<jar jarfile="${build.dir}/${contrib.name}.jar">
<fileset dir="${build.contrib.dest}">
<include name="**"/>
</fileset>
</jar>
</target>
<!-- =================================================================== -->
<!-- Copies the tools.jar to javac.jar in web-inf/lib -->
<!-- =================================================================== -->
<target name="prepare-tools-lib" depends="package" if="tools.jar.present">
<!-- NOTE: java.home is normally set by the JVM to the /jre directory -->
<copy file="${tools.jar}" tofile="${build.war}/WEB-INF/lib/javac.jar"/>
</target>
<!-- =================================================================== -->
<!-- Clean targets -->
<!-- =================================================================== -->
<target name="clean" depends="init" description="* Cleans the build directories">
<delete dir="${build.dir}"/>
</target>
<target name="cleandocs" depends="init" description="* Cleans the build docs directories">
<delete dir="${build.docs}"/>
</target>
<target name="distclean" depends="clean" description="* Cleans everything to the original state">
<delete dir="${build.root}"/>
<delete file="${dist.target}/${Name}-${version}.tar.gz"/>
<delete file="${dist.target}/${Name}-${version}.tar"/>
<delete file="${dist.target}/${Name}-${version}.zip"/>
<delete file="${dist.target}/${Name}-${version}-src.tar.gz"/>
<delete file="${dist.target}/${Name}-${version}-src.tar"/>
<delete file="${dist.target}/${Name}-${version}-src.zip"/>
<delete file="${dist.target}/${Name}-${version}-bin.tar.gz"/>
<delete file="${dist.target}/${Name}-${version}-bin.tar"/>
<delete file="${dist.target}/${Name}-${version}-bin.zip"/>
<delete dir="${dist.root}"/>
</target>