blob: 99375ff13f3236c3d9756cca8522046773ce257c [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="ARCHIVE Build" default="build" basedir=".">
<description>Build for ARCHIVE component</description>
<property name="hy.component" value="classlib" />
<property name="hy.module" value="archive" />
<property name="hy.target" location="${basedir}/../../target" />
<import file="${hy.target}/hdk/build/ant/properties.xml" />
<import file="${hy.hdk}/build/ant/depends.xml" />
<property file="../../make/depends.properties" />
<property file="make/depends.properties" />
<property name="zlib.dist"
location="${hy.target}/depends/native/zlib_dist"/>
<target name="build" depends="check-depends,-build-no-check"/>
<target name="-build-no-check" depends="-build-jar,-test-jar" />
<target name="clean" depends="-clean-java,-clean-native,-clean-test" />
<target name="check-depends"
depends="-check-depends,-overlay-oss,
-copy-zipsup-include,-copy-zlib-include" />
<target name="-check-depends" unless="hy.skip.zlib">
<check-one-file src="${zlib.url}" dest="${zlib.tar}" />
</target>
<target name="fetch-depends" unless="hy.skip.zlib">
<mkdir dir="${zlib.dir}" />
<download-one-file src="${zlib.url}" dest="${zlib.tar}"
md5="${zlib.md5}" />
</target>
<target name="-copy-zlib-include" unless="hy.skip.zlib">
<!-- TOFIX: should add property for: unless="skip.native.build" -->
<copy todir="${hy.hdk}/include" preservelastmodified="true">
<fileset dir="${zlib.dist}">
<include name="zlib.h" />
<include name="zconf.h" />
</fileset>
</copy>
</target>
<target name="-copy-zipsup-include" unless="skip.native.build"
if="hy.skip.zip.api">
<copy todir="${hy.hdk}/include" preservelastmodified="true">
<fileset dir="src/main/native/include/shared">
<include name="zipsup.h" />
</fileset>
</copy>
</target>
<target name="-overlay-oss"
depends="-extract-props,-unzip-oss,-ascii2ebcdic-conversion"
unless="hy.skip.zlib" />
<target name="-extract-props" unless="hy.skip.zlib">
<uptodate property="zlib.extracted"
srcfile="${zlib.tar}"
targetfile="${zlib.dist}/README" />
<condition property="zlib.uptodate" value="true">
<or>
<isset property="hy.skip.zlib" />
<isset property="zlib.extracted" />
</or>
</condition>
</target>
<target name="-unzip-oss" unless="zlib.uptodate">
<mkdir dir="${zlib.dist}" />
<untar src="${zlib.tar}" dest="${zlib.dist}"
compression="gzip">
<mapper type="flatten"/>
</untar>
<chmod dir="${zlib.dist}" perm="ugo+r" />
<touch file="${zlib.dist}/README" />
</target>
<target name="-ascii2ebcdic-conversion" if="is.zos" unless="zlib.uptodate">
<move todir="${zlib.dist}_ascii">
<fileset dir="${zlib.dist}">
<include name="**/*" />
<exclude name="**/*.o" />
</fileset>
</move>
<copy todir="${zlib.dist}" outputencoding="IBM-1047" >
<fileset dir="${zlib.dist}_ascii">
<include name="**/*" />
<exclude name="**/*.o" />
</fileset>
</copy>
<fixcrlf srcdir="${zlib.dist}"
includes="**/*" excludes="**/*.o" eol="unix" />
<delete dir="${zlib.dist}_ascii" />
</target>
<!-- Build native code -->
<target name="-build-native" unless="skip.native.build"
depends="-build-native-zip,-build-native-zlib,-build-native-archive" />
<target name="-build-native-zip" unless="skip.native.build"
if="hy.skip.zip.api">
<make dir="src/main/native/zip/${hy.os.family}" />
</target>
<target name="-build-native-zlib" unless="hy.skip.zlib">
<!-- TOFIX: should add property for: unless="skip.native.build" -->
<make dir="src/main/native/zlib/${hy.os.family}" />
</target>
<target name="-build-native-archive" unless="skip.native.build">
<make dir="src/main/native/archive/${hy.os.family}" />
</target>
<target name="-clean-native" unless="skip.native.build"
depends="-clean-native-zip,-clean-native-zlib,-clean-native-includes,-clean-overlay-oss">
<make dir="src/main/native/archive/${hy.os.family}" target="clean" />
</target>
<target name="-clean-native-zip" unless="skip.native.build"
if="hy.skip.zip.api">
<make dir="src/main/native/zip/${hy.os.family}" target="clean" />
</target>
<target name="-clean-native-zlib" unless="hy.skip.zlib">
<!-- TOFIX: should add property for: unless="skip.native.build" -->
<make dir="src/main/native/zlib/${hy.os.family}" target="clean" />
</target>
<target name="-clean-native-includes" unless="skip.native.build">
<delete failonerror="false">
<fileset dir="${hy.hdk}/include">
<include name="zipsup.h" />
</fileset>
</delete>
</target>
<target name="-clean-overlay-oss" unless="hy.skip.zlib" >
<delete dir="${zlib.dist}" quiet="true" />
</target>
<target name="test" depends="-test-module">
<fail message="Some tests failed">
<condition>
<or>
<isset property="test.failures" />
<isset property="test.errors" />
</or>
</condition>
</fail>
</target>
<!-- internal target for local and global test run sequence -->
<target name="-test-module" depends="build,-run-tests" />
<target name="-clean-java" unless="skip.java.build"
depends="-class-patternset">
<delete file="${hy.jdk}/jre/lib/boot/${hy.module}.jar" />
<delete file="${hy.jdk}/jre/lib/boot/${hy.module}-src.jar" />
<delete failonerror="false">
<fileset refid="classes" />
</delete>
<delete-patternset module="${hy.module}" />
</target>
<target name="-clean-test" unless="skip.test.build">
<delete dir="${tests.hdk.dir}" failonerror="false" />
<delete failonerror="false" dir="${hy.build.mod}/test"/>
</target>
<target name="-compile-java" unless="skip.java.build">
<compile-classes description="${hy.module} classes">
<javac-elements>
<src path="src/main/java" />
</javac-elements>
</compile-classes>
</target>
<target name="findbugs" depends="-build-jar">
<run-findBugs
jarFile="${hy.jdk}/jre/lib/boot/${hy.module}.jar"
excludeFilter="make/findbugs-exclude-filter.xml"
outputFile="${findBugs.report}/${hy.module}.xml"/>
</target>
<target name="-build-jar" unless="skip.java.build"
depends="-svn-info,-compile-java,-class-patternset">
<hy.jar.bin destfile="${hy.jdk}/jre/lib/boot/${hy.module}.jar"
manifest="META-INF/MANIFEST.MF">
<fileset refid="classes" />
<fileset refid="resources" />
</hy.jar.bin>
<hy.jar.src destfile="${hy.jdk}/jre/lib/boot/${hy.module}-src.jar">
<fileset dir="src/main/java" />
</hy.jar.src>
</target>
<target name="-test-jar" unless="skip.test.build"
depends="-svn-info,-compile-tests">
<mkdir dir="${tests.hdk.dir}" />
<copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
<hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
<fileset dir="${hy.build.mod}/test/api" />
</hy.jar.bin>
<hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_internal_tests.jar">
<fileset dir="${hy.build.mod}/test/internal" />
</hy.jar.bin>
<mkdir dir="${tests.excludes.hdk.dir}"/>
<copy todir="${tests.excludes.hdk.dir}">
<fileset dir="make" includes="exclude*"/>
<filterchain>
<tokenfilter>
<replaceregex pattern="\.java" replace="\.class" flags="g"/>
</tokenfilter>
</filterchain>
</copy>
</target>
<target name="-compile-tests" unless="skip.test.build">
<compile-tests description="${hy.module} internal tests"
destdir="${hy.build.mod}/test/internal">
<javac-elements>
<src>
<pathelement location="src/test/java-internal" />
</src>
</javac-elements>
</compile-tests>
<compile-tests description="${hy.module} api tests">
<javac-elements>
<src>
<pathelement location="src/test/java" />
</src>
</javac-elements>
</compile-tests>
</target>
<target name="-run-tests" depends="-test-jar">
<ant dir="${tests.hdk.dir}" target="test-module" />
</target>
<target name="-class-patternset" unless="skip.java.build">
<make-patternset module="${hy.module}" />
</target>
</project>