blob: 57bca08de06193fd94f9eb8a904e3211729f9d48 [file]
<?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="NIO Build" default="build" basedir=".">
<description>Build for NIO component</description>
<!-- import common properties -->
<property name="hy.hdk" location="${basedir}/../../deploy" />
<import file="${hy.hdk}/build/ant/properties.xml" />
<!-- set global properties for this build. -->
<xmlproperty file="make/hyproperties.xml" semanticAttributes="true" />
<property name="hy.nio.src.test.java.platform"
value="${hy.nio.src.test.java}/../${hy.os.family}" />
<property name="nio.exclude.file" location="${hy.hdk}/build/nio.exclude" />
<fileset id="classes" dir="${hy.build}">
<or>
<present targetdir="${hy.nio.src.main.java}" />
<present targetdir="${hy.nio.src.main.java}">
<mapper type="regexp"
from="^(.*?)(\$$[^/\\\.]*)?\.class$$"
to="\1.java"/>
</present>
<present targetdir="${hy.nio.src.main.java.platform}" />
<present targetdir="${hy.nio.src.main.java.platform}">
<mapper type="regexp"
from="^(.*?)(\$$[^/\\\.]*)?\.class$$"
to="\1.java"/>
</present>
</or>
</fileset>
<target name="build" depends="compile-java, copy-resources, build-jar" />
<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, compile-tests, prepare-exclude, run-tests" />
<!-- Build natives.-->
<target name="build-native">
<make dir="${hy.nio.src.main.native}/nio/${hy.os.family}" />
<!-- Copy the built shared libs over to the jre/bin dir -->
<copy todir="${hy.jdk}/jre/bin" overwrite="yes">
<fileset dir="${hy.nio.src.main.native}/nio">
<include name="*${shlib.suffix}*"/>
<include name="*${progdb.suffix}*" if="is.windows" />
<exclude name="*${manifest.suffix}"/>
</fileset>
</copy>
</target>
<target name="clean">
<delete file="${hy.jdk}/jre/lib/boot/nio.jar" />
<delete file="${hy.jdk}/jre/lib/boot/nio-src.jar" />
<delete includeemptydirs="true" failonerror="false">
<fileset refid="classes" />
<fileset dir="${hy.nio.bin.test}" />
</delete>
</target>
<!-- Clean natives. -->
<target name="clean-native">
<make dir="${hy.nio.src.main.native}/nio/${hy.os.family}"
target="clean" />
</target>
<target name="compile-java">
<echo message="Compiling NIO classes" />
<mkdir dir="${hy.build}" />
<javac sourcepath=""
srcdir="${hy.nio.src.main.java}"
destdir="${hy.build}"
compiler="${hy.javac.compiler}"
memoryMaximumSize="${hy.javac.maxmem}"
source="${hy.javac.source}"
target="${hy.javac.target}"
debug="${hy.javac.debug}">
<compilerarg line="${build.compilerarg}" />
<bootclasspath>
<fileset dir="${hy.jdk}/jre/lib/boot">
<include name="**/*.jar" />
</fileset>
</bootclasspath>
</javac>
</target>
<target name="copy-resources">
<mkdir dir="${hy.build}" />
<copy todir="${hy.build}" includeemptydirs="false">
<fileset dir="${hy.nio.src.main.java}">
<exclude name="**/*.java" />
</fileset>
</copy>
</target>
<target name="build-jar" depends="svn-info">
<jar destfile="${hy.jdk}/jre/lib/boot/nio.jar"
manifest="${hy.nio}/META-INF/MANIFEST.MF">
<fileset refid="classes" />
<manifest>
<attribute name="Implementation-Version" value="${svn.info}"/>
</manifest>
<metainf refid="hy.required.metainf-files"/>
</jar>
<jar destfile="${hy.jdk}/jre/lib/boot/nio-src.jar">
<fileset dir="${hy.nio.src.main.java}" />
<manifest>
<attribute name="Implementation-Version" value="${svn.info}"/>
</manifest>
<metainf refid="hy.required.metainf-files"/>
</jar>
</target>
<target name="compile-tests" depends="copy-test-resources">
<echo message="Compiling NIO tests" />
<mkdir dir="${hy.nio.bin.test}" />
<javac destdir="${hy.nio.bin.test}"
sourcepath=""
compiler="${hy.javac.compiler}"
memoryMaximumSize="${hy.javac.maxmem}"
source="${hy.javac.source}"
target="${hy.javac.target}"
debug="${hy.javac.debug}">
<compilerarg line="${build.compilerarg}" />
<src>
<pathelement location="${hy.nio.src.test.java}"/>
<pathelement
location="${hy.nio.src.test.java.platform}"/>
</src>
<bootclasspath>
<fileset dir="${hy.jdk}/jre/lib/boot">
<include name="**/*.jar" />
</fileset>
</bootclasspath>
<classpath location="${hy.hdk}/build/test/support.jar" />
</javac>
</target>
<target name="prepare-exclude">
<prepare-exclude-list moduleName="nio" dir="./make"
result="${nio.exclude.file}"/>
</target>
<target name="run-tests">
<mkdir dir="${hy.tests.reports}" />
<property name="test.jre.home" value="${hy.jdk}/jre" />
<junit fork="yes"
forkmode="${hy.test.forkmode}"
timeout="${hy.test.timeout}"
printsummary="withOutAndErr"
errorproperty="test.errors"
failureproperty="test.failures"
showoutput="on"
dir="${basedir}"
jvm="${test.jre.home}/bin/java">
<jvmarg line="${hy.test.vmargs}" />
<classpath>
<pathelement path="${hy.nio.bin.test}" />
<pathelement path="${hy.hdk}/build/test/support.jar" />
</classpath>
<formatter type="xml" />
<batchtest todir="${hy.tests.reports}" haltonfailure="no" >
<fileset dir="${hy.nio.src.test.java}">
<!-- if ${test.case} -->
<include name="${converted.tc}" if="test.case" />
<!-- unless ${test.case} -->
<include name="**/*Test.java" unless="test.case" />
<excludesfile name="${nio.exclude.file}" unless="test.case" />
</fileset>
<fileset dir="${hy.nio.src.test.java.platform}">
<!-- if ${test.case} -->
<include name="${converted.tc}" if="test.case" />
<!-- unless ${test.case} -->
<include name="**/*Test.java" unless="test.case" />
<excludesfile name="${nio.exclude.file}" unless="test.case" />
</fileset>
</batchtest>
</junit>
<antcall target="touch-failures-file" />
<antcall target="touch-errors-file" />
</target>
<target name="touch-failures-file" if="test.failures">
<echo file="${hy.tests.reports}/test.failures" append="true">nio${line.separator}</echo>
</target>
<target name="touch-errors-file" if="test.errors">
<echo file="${hy.tests.reports}/test.errors" append="true">nio${line.separator}</echo>
</target>
<target name="copy-test-resources">
<mkdir dir="${hy.nio.bin.test}" />
<copy todir="${hy.nio.bin.test}" includeemptydirs="false">
<fileset dir="${hy.nio.src.test.resources}">
<exclude name="**/*.java" />
</fileset>
</copy>
</target>
</project>