blob: 3de77c5391e5fce680e15fc2b601965750724ba1 [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="CRYPTO Build" default="build" basedir=".">
<description>Build for CRYPTO 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" />
<fileset id="classes" dir="${hy.build}">
<or>
<present targetdir="${hy.crypto.src.main.java}" />
<present targetdir="${hy.crypto.src.main.java}">
<mapper type="regexp"
from="^(.*?)(\$$[^/\\\.]*)?\.class$$"
to="\1.java"/>
</present>
</or>
</fileset>
<property file="../../make/depends.properties" />
<property name="crypto.exclude.file" location="${hy.hdk}/build/crypto.exclude" />
<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" />
<target name="clean">
<delete file="${hy.jdk}/jre/lib/boot/${hy.crypto.packaging.jarname}.jar" />
<delete file="${hy.jdk}/jre/lib/boot/${hy.crypto.packaging.jarname}-src.jar" />
<delete failonerror="false">
<fileset refid="classes" />
<fileset dir="${hy.crypto.bin.test}" />
</delete>
</target>
<target name="compile-java">
<echo message="Compiling CRYPTO classes" />
<mkdir dir="${hy.build}" />
<javac sourcepath=""
srcdir="${hy.crypto.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.crypto.src.main.java}">
<exclude name="**/*.java" />
</fileset>
</copy>
</target>
<target name="build-jar" depends="svn-info">
<jar destfile="${hy.jdk}/jre/lib/boot/${hy.crypto.packaging.jarname}.jar"
manifest="${hy.crypto}/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/${hy.crypto.packaging.jarname}-src.jar">
<fileset dir="${hy.crypto.src.main.java}" />
<manifest>
<attribute name="Implementation-Version" value="${svn.info}"/>
</manifest>
<metainf refid="hy.required.metainf-files"/>
</jar>
</target>
<target name="compile-tests">
<compile-tests description="test support files" destdir="../../build/tests">
<javac-elements>
<src>
<pathelement location="${hy.crypto.src.test}/support/common/java"/>
<!-- FIXME: CRYPTO tests should not reach into security module code -->
<pathelement location="${hy.crypto}/../security/src/test/support/common/java"/>
</src>
<include name="**/*.java" />
</javac-elements>
</compile-tests>
<compile-tests description="api tests" destdir="${hy.crypto.bin.test}/api">
<javac-elements>
<src path="${hy.crypto.src.test}/api/java"/>
<include name="**/*Test.java" />
</javac-elements>
</compile-tests>
<compile-tests description="api injected tests" destdir="${hy.crypto.bin.test}/api.injected">
<javac-elements>
<src path="${hy.crypto.src.test}/api/java.injected"/>
<include name="**/*Test.java" />
</javac-elements>
</compile-tests>
<compile-tests description="impl injected tests" destdir="${hy.crypto.bin.test}/impl.injected">
<javac-elements>
<src path="${hy.crypto.src.test}/impl/java.injected"/>
<include name="**/*Test.java" />
</javac-elements>
</compile-tests>
<compile-tests description="impl tests" destdir="${hy.crypto.bin.test}/impl">
<javac-elements>
<src path="${hy.crypto.src.test}/impl/java"/>
<include name="**/*Test.java" />
</javac-elements>
</compile-tests>
</target>
<target name="prepare-exclude">
<prepare-exclude-list moduleName="crypto" dir="./make"
result="${crypto.exclude.file}"/>
</target>
<target name="run-tests" depends="run-tests-api, run-tests-impl" />
<target name="run-tests-api">
<run-tests description="api tests">
<junit-elements>
<classpath>
<pathelement path="${hy.crypto.bin.test}/api"/>
<pathelement path="${hy.hdk}/build/test/support.jar" />
<pathelement path="../../build/tests" />
</classpath>
<batchtest todir="${hy.tests.reports}" haltonfailure="no" >
<fileset dir="${hy.crypto.src.test}/api/java">
<!-- if ${test.case} -->
<include name="${converted.tc}" if="test.case" />
<!-- unless ${test.case} -->
<include name="**/*Test.java" unless="test.case" />
<excludesfile name="${crypto.exclude.file}" unless="test.case" />
</fileset>
</batchtest>
</junit-elements>
</run-tests>
<run-tests description="api.injected tests">
<junit-elements>
<!-- to pick up junit.jar -->
<jvmarg value="-Xbootclasspath/a:${hy.crypto.bin.test}/api.injected${path.separator}../../${junit.jar}${path.separator}../../build/tests${path.separator}${hy.hdk}/build/test/support.jar"/>
<batchtest todir="${hy.tests.reports}" haltonfailure="no" >
<fileset dir="${hy.crypto.src.test}/api/java.injected">
<!-- if ${test.case} -->
<include name="${converted.tc}" if="test.case" />
<!-- unless ${test.case} -->
<include name="**/*Test.java" unless="test.case" />
<excludesfile name="${crypto.exclude.file}" unless="test.case" />
</fileset>
</batchtest>
</junit-elements>
</run-tests>
<antcall target="touch-failures-file" />
<antcall target="touch-errors-file" />
</target>
<target name="run-tests-impl" unless="test.noimpl">
<run-tests description="impl tests">
<junit-elements>
<classpath>
<pathelement path="${hy.crypto.bin.test}/impl"/>
<pathelement path="${hy.hdk}/build/test/support.jar" />
</classpath>
<batchtest todir="${hy.tests.reports}" haltonfailure="no" >
<fileset dir="${hy.crypto.src.test}/impl/java">
<!-- if ${test.case} -->
<include name="${converted.tc}" if="test.case" />
<!-- unless ${test.case} -->
<include name="**/*Test.java" unless="test.case" />
<excludesfile name="${crypto.exclude.file}" unless="test.case" />
</fileset>
</batchtest>
</junit-elements>
</run-tests>
<run-tests description="impl injected tests">
<junit-elements>
<!-- to pick up junit.jar -->
<jvmarg value="-Xbootclasspath/a:${hy.crypto.bin.test}/impl.injected${path.separator}../../${junit.jar}${path.separator}../../build/tests"/>
<batchtest todir="${hy.tests.reports}" haltonfailure="no" >
<fileset dir="${hy.crypto.src.test}/impl/java.injected">
<!-- if ${test.case} -->
<include name="${converted.tc}" if="test.case" />
<!-- unless ${test.case} -->
<include name="**/*Test.java" unless="test.case" />
<excludesfile name="${crypto.exclude.file}" unless="test.case" />
</fileset>
</batchtest>
</junit-elements>
</run-tests>
<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">crypto${line.separator}</echo>
</target>
<target name="touch-errors-file" if="test.errors">
<echo file="${hy.tests.reports}/test.errors"
append="true">crypto${line.separator}</echo>
</target>
<macrodef name="compile-tests">
<attribute name="description" default="" />
<attribute name="destdir" />
<element name="javac-elements" />
<sequential>
<echo message="Compiling CRYPTO @{description}" />
<mkdir dir="@{destdir}" />
<javac destdir="@{destdir}"
compiler="${hy.javac.compiler}"
memoryMaximumSize="${hy.javac.maxmem}"
source="${hy.javac.source}"
target="${hy.javac.target}"
debug="${hy.javac.debug}">
<javac-elements />
<compilerarg line="${build.compilerarg}" />
<bootclasspath>
<fileset dir="${hy.jdk}/jre/lib/boot">
<include name="**/*.jar" />
</fileset>
</bootclasspath>
<classpath location="../../build/tests" />
<classpath location="${hy.hdk}/build/test/support.jar" />
</javac>
</sequential>
</macrodef>
<macrodef name="run-tests">
<attribute name="description" default="" />
<element name="junit-elements" />
<sequential>
<echo message="Running CRYPTO @{description}" />
<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}" />
<junit-elements />
<classpath>
<pathelement path="${hy.crypto.src.test.resources}"/>
<pathelement path="../../build/tests" />
</classpath>
<formatter type="xml" />
</junit>
</sequential>
</macrodef>
</project>