569 lines
24 KiB
XML
569 lines
24 KiB
XML
<?xml version="1.0"?>
|
|
<project name="wolfssl" default="build" basedir="." xmlns:jacoco="antlib:org.jacoco.ant">
|
|
|
|
<description>
|
|
wolfSSL JNI is a Java wrapper for the wolfSSL lightweight SSL/TLS 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>
|
|
|
|
<!-- versioning/manifest properties -->
|
|
<property name="implementation.vendor" value="wolfSSL Inc." />
|
|
<property name="implementation.title" value="wolfSSL JNI/JSSE" />
|
|
<property name="implementation.version" value="1.18" />
|
|
|
|
<!-- set properties for this build -->
|
|
<property name="src.dir" value="src/java/"/>
|
|
<property name="src.java9.dir" value="src/java9/"/>
|
|
<property name="native.dir" value="native"/>
|
|
<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="examples.dir" value="examples/"/>
|
|
<property name="examples.build.dir" value="examples/build"/>
|
|
<property name="reports.dir" value="build/reports"/>
|
|
|
|
<!-- These paths should be relative to JUNIT_HOME -->
|
|
<property name="junit4" value="junit-4.13.2.jar" />
|
|
<property name="hamcrest-core" value="hamcrest-all-1.3.jar" />
|
|
<property name="ant-junit4" value="ant/ant-junit4.jar" />
|
|
|
|
<property environment="env"/>
|
|
|
|
<!-- check for SNIHostName class to determine if JDK version >= 1.8 -->
|
|
<available property="have-SNIHostName" classname="javax.net.ssl.SNIHostName" />
|
|
|
|
<!-- Detect Java 9+ for module-info.java compilation -->
|
|
<condition property="isJava9Plus">
|
|
<not>
|
|
<or>
|
|
<equals arg1="${ant.java.version}" arg2="1.5"/>
|
|
<equals arg1="${ant.java.version}" arg2="1.6"/>
|
|
<equals arg1="${ant.java.version}" arg2="1.7"/>
|
|
<equals arg1="${ant.java.version}" arg2="1.8"/>
|
|
</or>
|
|
</not>
|
|
</condition>
|
|
|
|
<!-- Detect if running on Windows host -->
|
|
<condition property="isWindows">
|
|
<os family="windows" />
|
|
</condition>
|
|
|
|
<!-- check if javac nativeheaderdir is available -->
|
|
<condition property="have-nativeheaderdir">
|
|
<and>
|
|
<antversion atleast="1.9.8"/>
|
|
<not>
|
|
<or>
|
|
<equals arg1="${ant.java.version}" arg2="1.5"/>
|
|
<equals arg1="${ant.java.version}" arg2="1.6"/>
|
|
<equals arg1="${ant.java.version}" arg2="1.7"/>
|
|
</or>
|
|
</not>
|
|
</and>
|
|
</condition>
|
|
|
|
<!-- Check if SpotBugs is available -->
|
|
<condition property="spotbugs.available">
|
|
<and>
|
|
<isset property="env.SPOTBUGS_HOME"/>
|
|
<available
|
|
file="${env.SPOTBUGS_HOME}/lib/spotbugs-ant.jar"/>
|
|
</and>
|
|
</condition>
|
|
|
|
<!-- SpotBugs requires Java 11+, check compatibility -->
|
|
<condition property="spotbugs.java.compatible">
|
|
<not>
|
|
<or>
|
|
<equals arg1="${ant.java.version}" arg2="1.5"/>
|
|
<equals arg1="${ant.java.version}" arg2="1.6"/>
|
|
<equals arg1="${ant.java.version}" arg2="1.7"/>
|
|
<equals arg1="${ant.java.version}" arg2="1.8"/>
|
|
<equals arg1="${ant.java.version}" arg2="9"/>
|
|
<equals arg1="${ant.java.version}" arg2="10"/>
|
|
</or>
|
|
</not>
|
|
</condition>
|
|
|
|
<!-- Check if JaCoCo is available -->
|
|
<condition property="jacoco.available">
|
|
<and>
|
|
<isset property="env.JACOCO_HOME"/>
|
|
<available file="${env.JACOCO_HOME}/jacocoant.jar"/>
|
|
</and>
|
|
</condition>
|
|
|
|
<!-- classpath to compiled wolfssl.jar, for running tests -->
|
|
<path id="classpath">
|
|
<fileset dir="${lib.dir}">
|
|
<include name="wolfssl.jar"/>
|
|
<include name="wolfssl-jsse.jar"/>
|
|
</fileset>
|
|
<fileset dir="${env.JUNIT_HOME}" erroronmissingdir="false">
|
|
<include name="${junit4}"/>
|
|
</fileset>
|
|
</path>
|
|
|
|
<target name="init" depends="clean, default-javac-flags">
|
|
<mkdir dir="${build.dir}"/>
|
|
<mkdir dir="${lib.dir}"/>
|
|
<mkdir dir="${examples.build.dir}"/>
|
|
<mkdir dir="${test.build.dir}"/>
|
|
<mkdir dir="${reports.dir}"/>
|
|
</target>
|
|
|
|
<target name="clean">
|
|
<delete dir="${test.build.dir}"/>
|
|
<delete dir="${build.dir}"/>
|
|
<delete dir="${examples.build.dir}"/>
|
|
<delete dir="${reports.dir}"/>
|
|
<delete failonerror="false">
|
|
<fileset dir="${lib.dir}" includes="wolfssl.jar" />
|
|
<fileset dir="${lib.dir}" includes="wolfssl-jsse.jar" />
|
|
</delete>
|
|
</target>
|
|
|
|
<target name="cleanjni">
|
|
<delete>
|
|
<fileset dir="${lib.dir}" includes="*.dylib" erroronmissingdir="false"/>
|
|
<fileset dir="${lib.dir}" includes="*.so" erroronmissingdir="false"/>
|
|
<fileset dir="${native.dir}" includes="*.o" erroronmissingdir="false"/>
|
|
</delete>
|
|
</target>
|
|
|
|
<target name="build" depends="init, compile-nativeheaderdir, compile-javah, compile-module-info, jar, jar-jsse, javah, javadoc"/>
|
|
<target name="build-jacoco" depends="init, compile-nativeheaderdir, compile-javah, jar, jar-jsse, javah, javadoc, examples, test-jacoco, coverage-report"/>
|
|
|
|
<target name="compile-nativeheaderdir" if="have-nativeheaderdir">
|
|
<javac destdir="${build.dir}"
|
|
nativeheaderdir="${native.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"/>
|
|
<src path="${src.dir}" />
|
|
<include name="com/wolfssl/**" />
|
|
<include name="com/wolfssl/provider/jsse/**" />
|
|
<include name="com/wolfssl/provider/jsse/adapter/**" />
|
|
<exclude name="com/wolfssl/provider/jsse/adapter/WolfSSLJDK8Helper.java" unless="have-SNIHostName" />
|
|
</javac>
|
|
<!-- Copy resources to build directory for ServiceLoader -->
|
|
<copy todir="${build.dir}" failonerror="false">
|
|
<fileset dir="src/resources" includes="**/*" />
|
|
</copy>
|
|
</target>
|
|
|
|
<target name="compile-javah" unless="have-nativeheaderdir">
|
|
<javac 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"/>
|
|
<src path="${src.dir}" />
|
|
<include name="com/wolfssl/**" />
|
|
<include name="com/wolfssl/provider/jsse/**" />
|
|
<include name="com/wolfssl/provider/jsse/adapter/**" />
|
|
<exclude name="com/wolfssl/provider/jsse/adapter/WolfSSLJDK8Helper.java" unless="have-SNIHostName" />
|
|
</javac>
|
|
<!-- Copy resources to build directory for ServiceLoader -->
|
|
<copy todir="${build.dir}" failonerror="false">
|
|
<fileset dir="src/resources" includes="**/*" />
|
|
</copy>
|
|
</target>
|
|
|
|
<!-- Compile module-info.java for Java 9+ module support.
|
|
Only runs when building with Java 9 or later. When building with
|
|
Java 8 or earlier, this target is skipped and the resulting JAR
|
|
will be a standard (non-modular) JAR file. -->
|
|
<target name="compile-module-info" if="isJava9Plus"
|
|
description="Compile module-info.java for Java 9+ (skipped on Java 8)">
|
|
<javac srcdir="${src.java9.dir}"
|
|
destdir="${build.dir}"
|
|
release="9"
|
|
modulepath="${build.dir}"
|
|
includeantruntime="false">
|
|
<include name="module-info.java"/>
|
|
</javac>
|
|
<echo message="Compiled module-info.java for Java 9+ module support"/>
|
|
</target>
|
|
|
|
<target name="javah" unless="have-nativeheaderdir">
|
|
<javah destdir="${native.dir}" force="yes" classpathref="classpath">
|
|
<class name="com.wolfssl.WolfSSL"/>
|
|
<class name="com.wolfssl.WolfSSLCertManager"/>
|
|
<class name="com.wolfssl.WolfSSLCertificate"/>
|
|
<class name="com.wolfssl.WolfSSLCRL"/>
|
|
<class name="com.wolfssl.WolfSSLContext"/>
|
|
<class name="com.wolfssl.WolfSSLSession"/>
|
|
<class name="com.wolfssl.WolfSSLX509StoreCtx"/>
|
|
<class name="com.wolfssl.WolfCryptECC"/>
|
|
<class name="com.wolfssl.WolfCryptEccKey"/>
|
|
<class name="com.wolfssl.WolfCryptRSA"/>
|
|
</javah>
|
|
</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.8"/>
|
|
<property name="java.target" value="1.8"/>
|
|
</target>
|
|
|
|
<target name="jar">
|
|
<jar jarfile="${lib.dir}/wolfssl.jar">
|
|
<manifest>
|
|
<attribute name="Implementation-Title"
|
|
value="${implementation.title}" />
|
|
<attribute name="Implementation-Version"
|
|
value="${implementation.version}" />
|
|
<attribute name="Implementation-Vendor"
|
|
value="${implementation.vendor}" />
|
|
</manifest>
|
|
<fileset dir="${build.dir}">
|
|
<include name="com/wolfssl/*.class"/>
|
|
</fileset>
|
|
</jar>
|
|
</target>
|
|
|
|
<target name="jar-jsse">
|
|
<jar jarfile="${lib.dir}/wolfssl-jsse.jar" basedir="${build.dir}">
|
|
<manifest>
|
|
<attribute name="Implementation-Title"
|
|
value="${implementation.title}" />
|
|
<attribute name="Implementation-Version"
|
|
value="${implementation.version}" />
|
|
<attribute name="Implementation-Vendor"
|
|
value="${implementation.vendor}" />
|
|
</manifest>
|
|
</jar>
|
|
</target>
|
|
|
|
<target name="javadoc" description="generate documentation">
|
|
<javadoc destdir="${doc.dir}">
|
|
<fileset dir="${src.dir}">
|
|
<include name="com/wolfssl/**"/>
|
|
<include name="com/wolfssl/provider/jsse/**"/>
|
|
<exclude name="com/wolfssl/provider/jsse/adapter/WolfSSLJDK8Helper.java" unless="have-SNIHostName" />
|
|
</fileset>
|
|
</javadoc>
|
|
</target>
|
|
|
|
<target name="examples" depends="build">
|
|
<javac srcdir="${examples.dir}"
|
|
destdir="${examples.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"/>
|
|
<exclude name="**/DualProviderFIPSTest.java"/>
|
|
</javac>
|
|
</target>
|
|
|
|
<target name="build-test" depends="build">
|
|
<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"/>
|
|
<compilerarg value="-Xlint:-path"/>
|
|
</javac>
|
|
</target>
|
|
|
|
<!-- Set property to indicate Windows platform (Win32, x86) -->
|
|
<target name="setup-win32-debug">
|
|
<property name="ant.test.platform" value="Win32"/>
|
|
<property name="lib.win.dir" value="IDE/WIN/DLL Debug/Win32/"/>
|
|
<property name="lib.wolfssl.win.dir" value="../wolfssl/DLL Debug/Win32"/>
|
|
</target>
|
|
<target name="setup-win32-release">
|
|
<property name="ant.test.platform" value="Win32"/>
|
|
<property name="lib.win.dir" value="IDE/WIN/DLL Release/Win32/"/>
|
|
<property name="lib.wolfssl.win.dir" value="../wolfssl/DLL Release/Win32"/>
|
|
</target>
|
|
|
|
<target name="setup-win64-debug">
|
|
<property name="ant.test.platform" value="x64"/>
|
|
<property name="lib.win.dir" value="IDE/WIN/DLL Debug/x64/"/>
|
|
<property name="lib.wolfssl.win.dir" value="../wolfssl/DLL Debug/x64"/>
|
|
</target>
|
|
<target name="setup-win64-release">
|
|
<property name="ant.test.platform" value="x64"/>
|
|
<property name="lib.win.dir" value="IDE/WIN/DLL Release/x64/"/>
|
|
<property name="lib.wolfssl.win.dir" value="../wolfssl/DLL Release/x64"/>
|
|
</target>
|
|
|
|
<target name="setup-win32-debug-fips">
|
|
<property name="ant.test.platform" value="Win32"/>
|
|
<property name="lib.win.dir" value="IDE/WIN/DLL Debug FIPS/Win32/"/>
|
|
<property name="lib.wolfssl.win.dir" value="../wolfssl/IDE/WIN10/DLL Debug/Win32"/>
|
|
</target>
|
|
<target name="setup-win32-release-fips">
|
|
<property name="ant.test.platform" value="Win32"/>
|
|
<property name="lib.win.dir" value="IDE/WIN/DLL Release FIPS/Win32/"/>
|
|
<property name="lib.wolfssl.win.dir" value="../wolfssl/IDE/WIN10/DLL Release/Win32"/>
|
|
</target>
|
|
<target name="setup-win64-debug-fips">
|
|
<property name="ant.test.platform" value="x64"/>
|
|
<property name="lib.win.dir" value="IDE/WIN/DLL Debug FIPS/x64/"/>
|
|
<property name="lib.wolfssl.win.dir" value="../wolfssl/IDE/WIN10/DLL Debug/x64"/>
|
|
</target>
|
|
<target name="setup-win64-release-fips">
|
|
<property name="ant.test.platform" value="x64"/>
|
|
<property name="lib.win.dir" value="IDE/WIN/DLL Release FIPS/x64/"/>
|
|
<property name="lib.wolfssl.win.dir" value="../wolfssl/IDE/WIN10/DLL Release/x64"/>
|
|
</target>
|
|
|
|
<!-- Windows ant test targets, should be used in place of 'ant test' -->
|
|
<!-- Windows 32-bit -->
|
|
<target name="test-win32-debug" depends="setup-win32-debug, test"
|
|
description="Run JUnit tests on Windows x86/32-bit DLL Debug">
|
|
</target>
|
|
<target name="test-win32-release" depends="setup-win32-release, test"
|
|
description="Run JUnit tests on Windows x86/32-bit DLL Release">
|
|
</target>
|
|
|
|
<!-- Windows x64 -->
|
|
<target name="test-win64-debug" depends="setup-win64-debug, test"
|
|
description="Run JUnit tests on Windows x64/64-bit DLL Debug">
|
|
</target>
|
|
<target name="test-win64-release" depends="setup-win64-release, test"
|
|
description="Run JUnit tests on Windows x64/64-bit DLL Release">
|
|
</target>
|
|
|
|
<!-- Windows FIPS 140-2/140-3 -->
|
|
<target name="test-win32-debug-fips" depends="setup-win32-debug-fips, test"
|
|
description="Run JUnit tests on Windows x86/32-bit DLL FIPS Debug">
|
|
</target>
|
|
<target name="test-win32-release-fips" depends="setup-win32-release-fips, test"
|
|
description="Run JUnit tests on Windows x86/32-bit DLL FIPS Release">
|
|
</target>
|
|
<target name="test-win64-debug-fips" depends="setup-win64-debug-fips, test"
|
|
description="Run JUnit tests on Windows x64/64-bit DLL FIPS Debug">
|
|
</target>
|
|
<target name="test-win64-release-fips" depends="setup-win64-release-fips, test"
|
|
description="Run JUnit tests on Windows x64/64-bit DLL FIPS Release">
|
|
</target>
|
|
|
|
<!-- Print usage if plain 'ant test' called on Windows -->
|
|
<target name="antTestWindowsCheck">
|
|
<condition property="antTestCalledIncorrect">
|
|
<and>
|
|
<equals arg1="${isWindows}" arg2="true"/>
|
|
<equals arg1="${ant.project.invoked-targets}" arg2="test"/>
|
|
</and>
|
|
</condition>
|
|
|
|
<fail message="Please see usage instructions below" if="antTestCalledIncorrect">
|
|
wolfSSL JNI and JSSE: JUnit Test Usage on Windows
|
|
---------------------------------------------------------------------------->
|
|
Run one of the following ant test targets for Windows use:
|
|
Normal wolfSSL (non-FIPS):
|
|
ant test-win32-debug | Run JUnit tests for Windows 32-bit Debug build
|
|
ant test-win32-release | Run JUnit tests for Windows 32-bit Release build
|
|
ant test-win64-debug | Run JUnit tests for Windows 64-bit Debug build
|
|
ant test-win64-release | Run JUnit tests for Windows 64-bit Release build
|
|
|
|
wolfSSL FIPS 140-2 / 140-3:
|
|
ant test-win32-debug-fips | Run JUnit tests for Windows 32-bit Debug FIPS build
|
|
ant test-win32-release-fips | Run JUnit tests for Windows 32-bit Release FIPS build
|
|
ant test-win64-debug-fips | Run JUnit tests for Windows 64-bit Debug FIPS build
|
|
ant test-win64-release-fips | Run JUnit tests for Windows 64-bit Release FIPS build
|
|
----------------------------------------------------------------------------
|
|
</fail>
|
|
</target>
|
|
|
|
<!-- Primary ant test target, called direct on Linux/OSX
|
|
or from test-win32/test-win64 on Windows -->
|
|
<target name="test" description="Compile and run JUnit tests" depends="antTestWindowsCheck, build-test">
|
|
<property environment="env"/>
|
|
<junit printsummary="yes" showoutput="yes" haltonfailure="yes" fork="true">
|
|
<sysproperty key="sun.boot.library.path" value="$JAVA_HOME/bin:${lib.dir}" />
|
|
<env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:{lib.dir}:/usr/local/lib" />
|
|
<env key="CLASSPATH" path="${env.LD_LIBRARY_PATH}:${env.JUNIT_HOME}/${junit4}" />
|
|
<jvmarg value="-Djava.library.path=$JAVA_HOME/bin${path.separator}${env.LD_LIBRARY_PATH}${path.separator}${env.DYLD_LIBRARY_PATH}${path.separator}${lib.dir}${path.separator}${lib.win.dir}${path.separator}${lib.wolfssl.win.dir}"/>
|
|
|
|
<classpath>
|
|
<pathelement location="${build.dir}"/>
|
|
<pathelement location="${test.build.dir}"/>
|
|
<fileset dir="${env.JUNIT_HOME}">
|
|
<include name="${junit4}"/>
|
|
<include name="${hamcrest-core}"/>
|
|
<include name="${ant-junit4}"/>
|
|
</fileset>
|
|
</classpath>
|
|
|
|
<formatter type="plain"/>
|
|
<formatter type="xml"/>
|
|
|
|
<batchtest fork="yes" todir="${reports.dir}">
|
|
<fileset dir="${test.dir}">
|
|
<include name="**/*TestSuite.java"/>
|
|
</fileset>
|
|
</batchtest>
|
|
</junit>
|
|
</target>
|
|
|
|
<target name="jacoco-taskdef" if="jacoco.available">
|
|
<taskdef uri="antlib:org.jacoco.ant"
|
|
resource="org/jacoco/ant/antlib.xml">
|
|
<classpath path="${env.JACOCO_HOME}/jacocoant.jar"/>
|
|
</taskdef>
|
|
</target>
|
|
|
|
<target name="test-jacoco"
|
|
depends="build-test, jacoco-taskdef"
|
|
if="jacoco.available">
|
|
<jacoco:coverage destfile="${build.dir}/jacoco.exec">
|
|
<junit printsummary="yes" showoutput="yes" haltonfailure="yes" fork="true">
|
|
<classpath>
|
|
<pathelement location="${build.dir}"/>
|
|
<pathelement location="${test.build.dir}"/>
|
|
<fileset dir="${env.JUNIT_HOME}">
|
|
<include name="${junit4}"/>
|
|
<include name="${hamcrest-core}"/>
|
|
<include name="${ant-junit4}"/>
|
|
</fileset>
|
|
</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="${env.LD_LIBRARY_PATH}:{lib.dir}:/usr/local/lib" />
|
|
<env key="CLASSPATH" path="${env.LD_LIBRARY_PATH}:${env.JUNIT_HOME}/${junit4}" />
|
|
|
|
<batchtest fork="yes" todir="${reports.dir}">
|
|
<fileset dir="${test.dir}">
|
|
<include name="**/*TestSuite.java"/>
|
|
</fileset>
|
|
</batchtest>
|
|
|
|
</junit>
|
|
</jacoco:coverage>
|
|
</target>
|
|
|
|
<target name="coverage-report"
|
|
depends="jacoco-taskdef"
|
|
if="jacoco.available">
|
|
<jacoco:report>
|
|
<executiondata>
|
|
<file file="${build.dir}/jacoco.exec"/>
|
|
</executiondata>
|
|
|
|
<structure name="wolfSSL JNI/JSSE">
|
|
<classfiles>
|
|
<fileset dir="${build.dir}">
|
|
<include name="com/wolfssl/*.class"/>
|
|
<include name="com/wolfssl/provider/jsse/*.class"/>
|
|
</fileset>
|
|
</classfiles>
|
|
<sourcefiles>
|
|
<fileset dir="${src.dir}">
|
|
<include name="com/wolfssl/*.java"/>
|
|
<include name="com/wolfssl/provider/jsse/*.java"/>
|
|
</fileset>
|
|
</sourcefiles>
|
|
</structure>
|
|
<html destdir="report"/>
|
|
<csv destfile="report/report.csv"/>
|
|
</jacoco:report>
|
|
</target>
|
|
|
|
<target name="coverage" depends="build-jacoco"/>
|
|
|
|
<!-- SpotBugs static analysis targets -->
|
|
<target name="spotbugs-taskdef" if="spotbugs.available">
|
|
<taskdef
|
|
resource="edu/umd/cs/findbugs/anttask/tasks.properties">
|
|
<classpath>
|
|
<fileset dir="${env.SPOTBUGS_HOME}/lib"
|
|
includes="*.jar"/>
|
|
</classpath>
|
|
</taskdef>
|
|
</target>
|
|
|
|
<target name="spotbugs-check">
|
|
<fail unless="spotbugs.java.compatible">
|
|
SpotBugs requires Java 11 or later to run.
|
|
Current Java version: ${ant.java.version}
|
|
To fix this, run ant with Java 11+:
|
|
export JAVA_HOME=/path/to/jdk11
|
|
ant spotbugs
|
|
</fail>
|
|
<fail unless="spotbugs.available">
|
|
SpotBugs not found. Please set SPOTBUGS_HOME.
|
|
To install SpotBugs:
|
|
1. Download from https://spotbugs.github.io/
|
|
2. Extract (e.g., /opt/spotbugs-4.8.6)
|
|
3. Set SPOTBUGS_HOME=/opt/spotbugs-4.8.6
|
|
4. Run 'ant spotbugs'
|
|
</fail>
|
|
</target>
|
|
|
|
<target name="spotbugs"
|
|
depends="build, spotbugs-check, spotbugs-taskdef"
|
|
description="Run SpotBugs static analysis
|
|
(requires SPOTBUGS_HOME)">
|
|
<mkdir dir="${reports.dir}"/>
|
|
<spotbugs home="${env.SPOTBUGS_HOME}"
|
|
output="html"
|
|
outputFile="${reports.dir}/spotbugs.html"
|
|
effort="max"
|
|
reportLevel="medium"
|
|
excludeFilter="spotbugs-exclude.xml"
|
|
failOnError="false">
|
|
<sourcePath path="${src.dir}"/>
|
|
<class location="${lib.dir}/wolfssl.jar"/>
|
|
<class location="${lib.dir}/wolfssl-jsse.jar"/>
|
|
</spotbugs>
|
|
<spotbugs home="${env.SPOTBUGS_HOME}"
|
|
output="xml"
|
|
outputFile="${reports.dir}/spotbugs.xml"
|
|
effort="max"
|
|
reportLevel="medium"
|
|
excludeFilter="spotbugs-exclude.xml"
|
|
failOnError="false">
|
|
<sourcePath path="${src.dir}"/>
|
|
<class location="${lib.dir}/wolfssl.jar"/>
|
|
<class location="${lib.dir}/wolfssl-jsse.jar"/>
|
|
</spotbugs>
|
|
<echo message="SpotBugs reports generated:
|
|
${reports.dir}/spotbugs.html
|
|
${reports.dir}/spotbugs.xml"/>
|
|
</target>
|
|
|
|
</project>
|