wolfcrypt-jni/build.xml

132 lines
4.8 KiB
XML

<?xml version="1.0"?>
<project name="wolfcrypt-jni" default="build" basedir=".">
<description>
wolfCrypt JNI is a Java wrapper for the wolfCrypt lightweight crypto library.
This build file requires JUnit for running provided JUnit tests. JUnit can
be downloaded from: http:/www.junit.org/
When running JUnit tests, this package will look for JUnit at:
$JUNIT_HOME/junit.jar
</description>
<!-- set properties for this build -->
<property name="src.dir" value="src/java/" />
<property name="jni.dir" value="jni/include/" />
<property name="lib.dir" value="lib/" />
<property name="build.dir" value="build" />
<property name="doc.dir" value="docs" />
<property name="test.dir" value="src/test/" />
<property name="test.build.dir" value="build/test" />
<property name="reports.dir" value="build/reports" />
<property name="junit4" value="junit-4.11.jar" />
<property environment="env" />
<!-- classpath to compiled wolfcrypt-jni.jar, for running tests -->
<path id="classpath">
<fileset dir="${lib.dir}" includes="*.jar">
<include name="wolfcrypt-jni.jar" />
</fileset>
<fileset dir="${env.JUNIT_HOME}">
<include name="${junit4}" />
<include name="ant-junit4.jar" />
</fileset>
</path>
<target name="clean">
<delete dir="${test.build.dir}" />
<delete dir="${build.dir}" />
<delete dir="${examples.build.dir}" />
<delete dir="${reports.dir}" />
<delete>
<fileset dir="${lib.dir}" includes="wolfcrypt-jni.jar" />
</delete>
</target>
<target name="default-javac-flags" description="Set the javac flags that will produce a debug jar
with no compiler optimisation and all debug symbols">
<property name="java.debug" value="true" />
<property name="java.debuglevel" value="source,lines,vars" />
<property name="java.deprecation" value="true" />
<property name="java.optimize" value="false" />
<property name="java.source" value="1.7" />
<property name="java.target" value="1.7" />
</target>
<target name="init" depends="clean, default-javac-flags">
<mkdir dir="${build.dir}" />
<mkdir dir="${lib.dir}" />
<mkdir dir="${test.build.dir}" />
<mkdir dir="${reports.dir}" />
</target>
<target name="compile" depends="init">
<javac srcdir="${src.dir}" destdir="${build.dir}" debug="${java.debug}" debuglevel="${java.debuglevel}" deprecation="${java.deprecation}" optimize="${java.optimize}" source="${java.source}" target="${java.target}" classpathref="classpath" includeantruntime="false">
<compilerarg value="-Xlint:-options" />
</javac>
</target>
<target name="jar" depends="compile">
<jar jarfile="${lib.dir}/wolfcrypt-jni.jar" basedir="${build.dir}">
</jar>
</target>
<target name="javah" depends="jar">
<javah destdir="${jni.dir}" force="yes" classpathref="classpath">
<class name="com.wolfssl.wolfcrypt.WolfCrypt" />
<class name="com.wolfssl.wolfcrypt.Fips" />
<class name="com.wolfssl.wolfcrypt.NativeStruct" />
<class name="com.wolfssl.wolfcrypt.Aes" />
<class name="com.wolfssl.wolfcrypt.Des3" />
<class name="com.wolfssl.wolfcrypt.Md5" />
<class name="com.wolfssl.wolfcrypt.Sha" />
<class name="com.wolfssl.wolfcrypt.Sha256" />
<class name="com.wolfssl.wolfcrypt.Sha384" />
<class name="com.wolfssl.wolfcrypt.Sha512" />
<class name="com.wolfssl.wolfcrypt.Hmac" />
<class name="com.wolfssl.wolfcrypt.Rng" />
<class name="com.wolfssl.wolfcrypt.Rsa" />
<class name="com.wolfssl.wolfcrypt.Dh" />
<class name="com.wolfssl.wolfcrypt.Asn" />
</javah>
</target>
<target name="javadoc" description="generate documentation" depends="jar">
<javadoc sourcepath="${src.dir}" destdir="${doc.dir}" />
</target>
<target name="build-test" depends="jar">
<javac srcdir="${test.dir}" destdir="${test.build.dir}" debug="${java.debug}" debuglevel="${java.debuglevel}" deprecation="${java.depreciation}" optimize="${java.optimize}" source="${java.source}" target="${java.target}" classpathref="classpath" includeantruntime="false">
<compilerarg value="-Xlint:-options" />
</javac>
</target>
<target name="test" depends="build-test">
<junit printsummary="yes" showoutput="yes" haltonfailure="yes">
<classpath>
<pathelement location="${build.dir}" />
<pathelement location="${test.build.dir}" />
<pathelement location="${java.class.path}" />
</classpath>
<formatter type="plain" />
<formatter type="xml" />
<sysproperty key="sun.boot.library.path" value="$JAVA_HOME/bin:${lib.dir}" />
<env key="LD_LIBRARY_PATH" path="$LD_LIBRARY_PATH:{lib.dir}:/usr/local/lib" />
<env key="CLASSPATH" path="$LD_LIBRARY_PATH:${env.JUNIT_HOME}/${junit4}" />
<batchtest fork="yes" todir="${reports.dir}">
<fileset dir="${test.dir}">
<include name="**/*TestSuite.java" />
</fileset>
</batchtest>
</junit>
</target>
<target name="build" depends="jar, javah, javadoc" />
</project>