1201 linhas
52 KiB
XML
1201 linhas
52 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<project name="JNA" default="default" basedir="." xmlns:artifact="antlib:org.apache.maven.artifact.ant">
|
|
<description>Builds and tests JNA</description>
|
|
|
|
<!-- Default build compiles all platform-independent stuff as well
|
|
as the JNI bits for the current platform, using the arch model
|
|
of the current Java VM to determine whether 32- or 64-bit
|
|
binaries are built (ANT_OPTS=-d32/-d64 to switch on platforms that
|
|
support it).
|
|
|
|
Cross-compile by specifying -Dos.prefix={name-arch} to ant
|
|
(cross-compile currently only configured/tested on w32ce-arm and
|
|
android-arm/-x86)
|
|
|
|
Use ANT_OPTS=-Dskip-native=false to build native parts, or directly
|
|
invoke the native or test targets
|
|
Use ANT_OPTS=-Dheadless to run tests headless
|
|
Use ANT_OPTS=-Drelease to stage a final, non-snapshot version
|
|
-->
|
|
|
|
<!--
|
|
Conventions (since ant can't easily specify arbitrary file dependencies):
|
|
The uptodate property for a given target TARGET is "-TARGET"; the actual
|
|
target to generate the uptodate property is named ":TARGET".
|
|
|
|
Properties (except for uptodate properties) separate words by dots, targets
|
|
by dashes.
|
|
-->
|
|
|
|
<!-- global properties -->
|
|
<!-- (all build-related props should go in -dynamic-properties) -->
|
|
<property name="name" value="jna"/>
|
|
<property name="jar" value="${name}.jar"/>
|
|
<property name="minjar" value="${name}-min.jar"/>
|
|
<property name="testjar" value="${name}-test.jar"/>
|
|
<property name="debug" value="true"/>
|
|
<property name="debug.native" value="false"/>
|
|
<property name="cflags_extra.native" value=""/>
|
|
<property name="dynlink.native" value="false"/>
|
|
<property name="native" location="native"/>
|
|
<property name="src" location="src"/>
|
|
<property name="platform.src" location="contrib/platform/src"/>
|
|
<property name="contrib" location="contrib"/>
|
|
<property name="dist" location="dist"/>
|
|
<property name="lib.native" location="lib/native"/>
|
|
<property name="test.src" location="test"/>
|
|
<property name="doc" location="doc"/>
|
|
<property name="javadoc" location="${doc}/javadoc"/>
|
|
<property name="stylesheet" location="${javadoc}/doc/css/javadoc.css"/>
|
|
<property name="vendor" value="JNA Development Team"/>
|
|
<tstamp>
|
|
<format property="year" pattern="yyyy" locale="en,US"/>
|
|
</tstamp>
|
|
<property name="copyright"
|
|
value="Copyright &copy; 2007-${year} Timothy Wall. All Rights Reserved."/>
|
|
<buildnumber/>
|
|
<!-- JNA library release version -->
|
|
<property name="jna.major" value="4"/>
|
|
<property name="jna.minor" value="1"/>
|
|
<property name="jna.revision" value="1"/>
|
|
<property name="jna.build" value="${build.number}"/>
|
|
<condition property="version.suffix" value="" else="-SNAPSHOT">
|
|
<or>
|
|
<isset property="release"/>
|
|
<isset property="maven-release"/>
|
|
</or>
|
|
</condition>
|
|
<property name="jna.version" value="${jna.major}.${jna.minor}.${jna.revision}${version.suffix}"/>
|
|
<!-- jnidispatch library release version -->
|
|
<property name="jni.major" value="4"/>
|
|
<property name="jni.minor" value="0"/>
|
|
<property name="jni.revision" value="0"/>
|
|
<property name="jni.build" value="${build.number}"/>
|
|
<property name="jni.version" value="${jni.major}.${jni.minor}.${jni.revision}"/>
|
|
<property name="jni.md5" value="1a6047467b59e8748f975e03016ce3d9"/>
|
|
<property name="spec.title" value="Java Native Access (JNA)"/>
|
|
<property name="spec.vendor" value="${vendor}"/>
|
|
<property name="spec.version" value="${jna.major}"/>
|
|
<property name="impl.title" value="com.sun.jna"/>
|
|
<property name="impl.vendor" value="${spec.vendor}"/>
|
|
<property name="impl.version" value="${jna.version} (b${jna.build})"/>
|
|
|
|
<!-- Set up restrictions for w32ce, based on JavaME/CDC -->
|
|
<condition property="compatibility" value="1.4">
|
|
<equals arg1="${os.prefix}" arg2="w32ce-arm"/>
|
|
</condition>
|
|
<condition property="test.compatibility" value="1.4">
|
|
<equals arg1="${os.prefix}" arg2="w32ce-arm"/>
|
|
</condition>
|
|
<!-- Default compatibility, 1.6, or whatever version is running -->
|
|
<condition property="compatibility" value="${ant.java.version}" else="1.6">
|
|
<matches pattern="^1.[345]$" string="${ant.java.version}"/>
|
|
</condition>
|
|
<!-- Platform default compatibility, 1.5+ -->
|
|
<condition property="platform.compatibility" value="1.5" else="${compatibility}">
|
|
<equals arg1="${compatibility}" arg2="1.4"/>
|
|
</condition>
|
|
<!-- Test default compatibility, 1.5+ -->
|
|
<condition property="test.compatibility" value="1.5" else="${compatibility}">
|
|
<equals arg1="${compatibility}" arg2="1.4"/>
|
|
</condition>
|
|
<condition property="tests.exclude-patterns" value="**/VarArgsTest.java,**/AnnotatedLibraryTest.java,**/WebStartTest.java,**/PointerBufferTest.java,**/HeadlessLoadLibraryTest.java,**/StructureBufferFieldTest.java,**/PerformanceTest.java,**/*BufferArgumentsMarshalTest.java" else="**/wince/*.java">
|
|
<equals arg1="${os.prefix}" arg2="w32ce-arm"/>
|
|
</condition>
|
|
<property name="dist-jar" value="${dist}/${jar}"/>
|
|
|
|
<!-- Maven -->
|
|
<!-- define Maven coordinates -->
|
|
<property name="groupId" value="net.java.dev.jna" />
|
|
<property name="artifactId" value="jna" />
|
|
|
|
<property name="maven-javadoc-jar" value="${dist}/${artifactId}-${jna.version}-javadoc.jar" />
|
|
<property name="maven-sources-jar" value="${dist}/${artifactId}-${jna.version}-sources.jar" />
|
|
|
|
<property name="platform-jar" value="${dist}/jna-platform.jar"/>
|
|
<property name="platform-javadoc-jar" value="${dist}/platform-${jna.version}-javadoc.jar" />
|
|
<property name="platform-sources-jar" value="${dist}/platform-${jna.version}-sources.jar" />
|
|
|
|
<property name="pom" value="pom-jna.xml" />
|
|
<property name="pom-platform" value="pom-jna-platform.xml" />
|
|
|
|
<!-- defined maven snapshots and staging repository id and url -->
|
|
<property name="maven-snapshots-repository-id" value="snapshots.java.net" />
|
|
<property name="maven-snapshots-repository-url" value="https://maven.java.net/content/repositories/snapshots/" />
|
|
<property name="maven-staging-repository-id" value="staging.java.net" />
|
|
<property name="maven-staging-repository-url" value="https://maven.java.net/service/local/staging/deploy/maven2/" />
|
|
|
|
<!-- Miscellaneous -->
|
|
<property name="build.compiler.emacs" value="true"/>
|
|
|
|
<target name="default" depends="test" description="Build and Test."/>
|
|
|
|
<target name="init" depends="-setup"/>
|
|
<target name="compile-test-single" depends="compile-tests"/>
|
|
<target name="compile-single" depends="compile"/>
|
|
|
|
<target name="-dynamic-properties">
|
|
|
|
<condition property="-native" value="true">
|
|
<not><isset property="build-native"/></not>
|
|
</condition>
|
|
<condition property="jni.valid" value="true">
|
|
<isset property="-native"/>
|
|
</condition>
|
|
|
|
<replaceregexp match="(<version>).*(</version>)"
|
|
replace="\1${jna.version}\2"
|
|
file="${pom}"/>
|
|
|
|
<replaceregexp match="(<version>).*(</version>)"
|
|
replace="\1${jna.version}\2"
|
|
flags="g"
|
|
file="${pom-platform}"/>
|
|
|
|
<replaceregexp match='VERSION = ".*";'
|
|
replace='VERSION = "${jna.version}";'
|
|
file="src/com/sun/jna/Version.java"/>
|
|
<replaceregexp match='VERSION_NATIVE = ".*";'
|
|
replace='VERSION_NATIVE = "${jni.version}";'
|
|
file="src/com/sun/jna/Version.java"/>
|
|
|
|
<condition property="jar.omitted" value="**/*jnidispatch*" else="jnilib-included">
|
|
<isset property="omit-jnilib"/>
|
|
</condition>
|
|
<condition property="cross-compile" value="true">
|
|
<isset property="os.prefix"/>
|
|
</condition>
|
|
<!-- Sun 1.6 VM for windows doesn't support -d32/-d64 switch -->
|
|
<condition property="vm.64" value="-d64" else="-Ddummy">
|
|
<not><os family="windows"/></not>
|
|
</condition>
|
|
<condition property="vm.32" value="-d32" else="-Ddummy">
|
|
<not><os family="windows"/></not>
|
|
</condition>
|
|
<condition property="vmopt.arch" value="${vm.64}" else="${vm.32}">
|
|
<and>
|
|
<not><equals arg1="${os.prefix}" arg2="android-arm" trim="true"/></not>
|
|
<not><equals arg1="${os.prefix}" arg2="android-x86" trim="true"/></not>
|
|
<or>
|
|
<equals arg1="${sun.arch.data.model}" arg2="64" trim="true"/>
|
|
<equals arg1="${com.ibm.vm.bitmode}" arg2="64" trim="true"/>
|
|
<os arch="x86_64"/>
|
|
<os arch="amd64"/>
|
|
<os arch="em64t"/>
|
|
<os arch="sparcv9"/>
|
|
<os arch="ppc64"/>
|
|
<os arch="ia64"/>
|
|
<os arch="aarch64"/>
|
|
</or>
|
|
</and>
|
|
</condition>
|
|
<condition property="ld.preload" value="LD_PRELOAD_64" else="LD_PRELOAD">
|
|
<and>
|
|
<os name="SunOS"/>
|
|
<equals arg1="${vmopt.arch}" arg2="${vm.64}"/>
|
|
</and>
|
|
</condition>
|
|
<property name="build" value="build"/>
|
|
<property name="classes" location="${build}/classes"/>
|
|
<property name="eclipse.classes" location="build.eclipse/classes"/>
|
|
<property name="test.classes" location="${build}/test-classes"/>
|
|
<property name="reports" value="${build}/reports"/>
|
|
|
|
<!-- Add other supported platforms here -->
|
|
<condition property="jre.arch" value="x86">
|
|
<matches pattern="(i[3456]86|pentium)" string="${os.arch}"/>
|
|
</condition>
|
|
<condition property="jre.arch" value="x86-64">
|
|
<matches pattern="(x86_64|amd64|em64t)" string="${os.arch}"/>
|
|
</condition>
|
|
<condition property="jre.arch" value="ppc">
|
|
<matches pattern="(powerpc|power)" string="${os.arch}"/>
|
|
</condition>
|
|
<condition property="jre.arch" value="ppc64">
|
|
<matches pattern="(powerpc64|power64)" string="${os.arch}"/>
|
|
</condition>
|
|
<property name="jre.arch" value="${os.arch}"/>
|
|
<condition property="os.prefix" value="linux-${jre.arch}">
|
|
<os name="Linux"/>
|
|
</condition>
|
|
<condition property="os.prefix" value="aix-${jre.arch}">
|
|
<os name="AIX"/>
|
|
</condition>
|
|
<condition property="os.prefix" value="win32-${jre.arch}">
|
|
<os family="windows"/>
|
|
</condition>
|
|
<!-- Darwin builds are universal, no arch required -->
|
|
<condition property="os.prefix" value="darwin">
|
|
<os family="mac"/>
|
|
</condition>
|
|
<condition property="os.prefix" value="sunos-${jre.arch}">
|
|
<os name="SunOS"/>
|
|
</condition>
|
|
<condition property="os.prefix" value="freebsd-${jre.arch}">
|
|
<os name="FreeBSD"/>
|
|
</condition>
|
|
<condition property="os.prefix" value="openbsd-${jre.arch}">
|
|
<os name="OpenBSD"/>
|
|
</condition>
|
|
<condition property="os.prefix" value="netbsd-${jre.arch}">
|
|
<os name="NetBSD"/>
|
|
</condition>
|
|
<condition property="os.prefix" value="kfreebsd-${jre.arch}">
|
|
<os name="GNU/kFreeBSD"/>
|
|
</condition>
|
|
<fail unless="os.prefix" message="OS/arch not supported (${os.name}/${jre.arch}), edit build.xml and native/Makefile to add it."/>
|
|
<!-- Keep all natives separate -->
|
|
<property name="native.subdir" value="native-${os.prefix}"/>
|
|
<condition property="jdk.home" value="${java.home}">
|
|
<available file="${java.home}/include"/>
|
|
</condition>
|
|
<condition property="jdk.home" value="${java.home}/..">
|
|
<available file="${java.home}/../include"/>
|
|
</condition>
|
|
<condition property="jdk.home" value="/System/Library/Frameworks/JavaVM.framework/Home">
|
|
<available file="/System/Library/Frameworks/JavaVM.framework/Headers"/>
|
|
</condition>
|
|
<fail unless="jdk.home" message="Can't find JNI headers (java.home=${java.home})"/>
|
|
<property name="libarch" value="${os.arch}"/>
|
|
<condition property="libjsig"
|
|
value="${java.home}/lib/${libarch}/libjsig.so" else="">
|
|
<available file="${java.home}/lib/${libarch}/libjsig.so"/>
|
|
</condition>
|
|
<condition property="ld.preload.name" value="${ld.preload}" else="IGNORE">
|
|
<not><equals arg1="${libjsig}" arg2=""/></not>
|
|
</condition>
|
|
<property name="native.jar" value="${os.prefix}.jar"/>
|
|
<property name="build.native" location="${build}/${native.subdir}"/>
|
|
<property name="md5.file" location="${build.native}/jni.checksum"/>
|
|
|
|
<mkdir dir="${build}"/>
|
|
<mkdir dir="${build.native}"/>
|
|
<mkdir dir="${classes}"/>
|
|
<mkdir dir="${test.classes}"/>
|
|
<mkdir dir="${reports}"/>
|
|
<mkdir dir="${doc}"/>
|
|
|
|
<echo>Java version ${java.version}, compatibility: ${compatibility}</echo>
|
|
<echo>JNA version ${jna.version}, native ${jni.version}</echo>
|
|
<echo>${java.vm.name} (${java.vm.vendor}, ${java.vm.version})</echo>
|
|
<echo>java.home=${java.home}</echo>
|
|
<echo>java.library.path=${java.library.path}</echo>
|
|
<echo>os.prefix=${os.prefix}</echo>
|
|
<echo>os.name=${os.name}</echo>
|
|
<echo>os.arch=${os.arch}</echo>
|
|
<echo>build=${build}</echo>
|
|
<echo>build.native=${build.native}</echo>
|
|
|
|
</target>
|
|
|
|
<target name="-setup" depends="-dynamic-properties">
|
|
<path id="compile-test.path">
|
|
<path id="test.libs">
|
|
<fileset dir="lib">
|
|
<include name="junit.jar"/>
|
|
</fileset>
|
|
<fileset dir="lib/test"/>
|
|
<pathelement path="${classes}"/>
|
|
</path>
|
|
</path>
|
|
<path id="compile.path"/>
|
|
<path id="src.path">
|
|
<pathelement location="${src}"/>
|
|
</path>
|
|
<path id="test.runpath">
|
|
<pathelement path="${build}/${jar}"/>
|
|
<pathelement path="${test.classes}"/>
|
|
<pathelement path="${build}/${testjar}"/>
|
|
<pathelement path="lib/clover.jar"/>
|
|
<path refid="test.libs"/>
|
|
</path>
|
|
</target>
|
|
|
|
<target name="compile" depends="-setup"
|
|
description="Compile all Java source">
|
|
<javac classpathref="compile.path"
|
|
source="${compatibility}"
|
|
target="${compatibility}"
|
|
destdir="${classes}"
|
|
includeantruntime="false"
|
|
deprecation="on" debug="${debug}">
|
|
<src refid="src.path"/>
|
|
</javac>
|
|
</target>
|
|
|
|
<target name=":jar">
|
|
<uptodate property="-jar" targetfile="${build}/${jar}">
|
|
<srcfiles dir="${classes}">
|
|
<patternset id="jar-compiled">
|
|
<include name="com/sun/jna/*"/>
|
|
<include name="com/sun/jna/**/*"/>
|
|
</patternset>
|
|
</srcfiles>
|
|
</uptodate>
|
|
</target>
|
|
<target name="jar" depends="-setup,native,:jar" unless="-jar"
|
|
description="Build primary jar">
|
|
<!-- Bundle native components with primary jar to facilitate
|
|
easy distribution to common platforms.
|
|
-->
|
|
<jar jarfile="${build}/${jar}" duplicate="preserve">
|
|
<manifest>
|
|
<attribute name="Main-Class" value="com.sun.jna.Native"/>
|
|
<attribute name="Manifest-Version" value="1.0"/>
|
|
<attribute name="Implementation-Title" value="${impl.title}"/>
|
|
<attribute name="Implementation-Vendor" value="${vendor}"/>
|
|
<attribute name="Implementation-Version" value="${impl.version}"/>
|
|
<attribute name="Specification-Title" value="${spec.title}"/>
|
|
<attribute name="Specification-Vendor" value="${spec.vendor}"/>
|
|
<attribute name="Specification-Version" value="${spec.version}"/>
|
|
<!--
|
|
OSGi Bundle attributes
|
|
See http://www.osgi.org/Specifications/Reference
|
|
-->
|
|
<attribute name="Bundle-Category" value="jni"/>
|
|
<attribute name="Bundle-ManifestVersion" value="2"/>
|
|
<attribute name="Bundle-Name" value="jna"/>
|
|
<attribute name="Bundle-Description" value="JNA Library"/>
|
|
<attribute name="Bundle-SymbolicName" value="com.sun.jna"/>
|
|
<attribute name="Bundle-Version" value="${jna.major}.${jna.minor}.${jna.revision}"/>
|
|
<attribute name="Bundle-RequiredExecutionEnvironment" value="J2SE-1.4"/>
|
|
<attribute name="Bundle-Vendor" value="${vendor}"/>
|
|
<attribute name="Bundle-ActivationPolicy" value="lazy"/>
|
|
<attribute name="Export-Package" value="com.sun.jna,com.sun.jna.ptr,com.sun.jna.win32"/>
|
|
<!-- Note that no terminal "*" is included in this list,
|
|
which will force failure on unsupported platforms.
|
|
-->
|
|
<attribute name="Bundle-NativeCode"
|
|
value="
|
|
com/sun/jna/win32-x86/jnidispatch.dll;
|
|
processor=x86;osname=win32,
|
|
com/sun/jna/win32-x86-64/jnidispatch.dll;
|
|
processor=x86-64;osname=win32,
|
|
com/sun/jna/w32ce-arm/jnidispatch.dll;
|
|
processor=arm;osname=wince,
|
|
|
|
com/sun/jna/sunos-x86/libjnidispatch.so;
|
|
processor=x86;osname=sunos,
|
|
com/sun/jna/sunos-x86-64/libjnidispatch.so;
|
|
processor=x86-64;osname=sunos,
|
|
com/sun/jna/sunos-sparc/libjnidispatch.so;
|
|
processor=sparc;osname=sunos,
|
|
com/sun/jna/sunos-sparcv9/libjnidispatch.so;
|
|
processor=sparcv9;osname=sunos,
|
|
|
|
com/sun/jna/aix-ppc/libjnidispatch.a;
|
|
processor=ppc;osname=aix,
|
|
com/sun/jna/aix-ppc64/libjnidispatch.a;
|
|
processor=ppc64;osname=aix,
|
|
|
|
com/sun/jna/linux-ppc/libjnidispatch.so;
|
|
processor=ppc;osname=linux,
|
|
com/sun/jna/linux-ppc64/libjnidispatch.so;
|
|
processor=ppc64;osname=linux,
|
|
com/sun/jna/linux-x86/libjnidispatch.so;
|
|
processor=x86;osname=linux,
|
|
com/sun/jna/linux-x86-64/libjnidispatch.so;
|
|
processor=x86-64;osname=linux,
|
|
com/sun/jna/linux-arm/libjnidispatch.so;
|
|
processor=arm;osname=linux,
|
|
com/sun/jna/linux-aarch64/libjnidispatch.so;
|
|
processor=aarch64;osname=linux,
|
|
com/sun/jna/linux-ia64/libjnidispatch.so;
|
|
processor=ia64;osname=linux,
|
|
|
|
com/sun/jna/freebsd-x86/libjnidispatch.so;
|
|
processor=x86;osname=freebsd,
|
|
com/sun/jna/freebsd-x86-64/libjnidispatch.so;
|
|
processor=x86-64;osname=freebsd,
|
|
com/sun/jna/openbsd-x86/libjnidispatch.so;
|
|
processor=x86;osname=openbsd,
|
|
com/sun/jna/openbsd-x86-64/libjnidispatch.so;
|
|
processor=x86-64;osname=openbsd,
|
|
|
|
com/sun/jna/darwin/libjnidispatch.jnilib;
|
|
osname=macosx;processor=x86;processor=x86-64;processor=ppc
|
|
"/>
|
|
</manifest>
|
|
<fileset dir="${classes}" excludes="${jar.omitted}">
|
|
<patternset refid="jar-compiled"/>
|
|
</fileset>
|
|
<zipfileset src="${lib.native}/win32-x86.jar"
|
|
includes="*jnidispatch*"
|
|
prefix="com/sun/jna/win32-x86"/>
|
|
<zipfileset src="${lib.native}/aix-ppc.jar"
|
|
includes="*jnidispatch*"
|
|
prefix="com/sun/jna/aix-ppc"/>
|
|
<zipfileset src="${lib.native}/aix-ppc64.jar"
|
|
includes="*jnidispatch*"
|
|
prefix="com/sun/jna/aix-ppc64"/>
|
|
<zipfileset src="${lib.native}/darwin.jar"
|
|
includes="*jnidispatch*"
|
|
prefix="com/sun/jna/darwin"/>
|
|
<zipfileset src="${lib.native}/linux-x86.jar"
|
|
includes="*jnidispatch*"
|
|
prefix="com/sun/jna/linux-x86"/>
|
|
<zipfileset src="${lib.native}/linux-x86-64.jar"
|
|
includes="*jnidispatch*"
|
|
prefix="com/sun/jna/linux-x86-64"/>
|
|
<zipfileset src="${lib.native}/linux-arm.jar"
|
|
includes="*jnidispatch*"
|
|
prefix="com/sun/jna/linux-arm"/>
|
|
<zipfileset src="${lib.native}/linux-aarch64.jar"
|
|
includes="*jnidispatch*"
|
|
prefix="com/sun/jna/linux-aarch64"/>
|
|
<zipfileset src="${lib.native}/linux-ia64.jar"
|
|
includes="*jnidispatch*"
|
|
prefix="com/sun/jna/linux-ia64"/>
|
|
<zipfileset src="${lib.native}/linux-ppc.jar"
|
|
includes="*jnidispatch*"
|
|
prefix="com/sun/jna/linux-ppc"/>
|
|
<zipfileset src="${lib.native}/linux-ppc64.jar"
|
|
includes="*jnidispatch*"
|
|
prefix="com/sun/jna/linux-ppc64"/>
|
|
<zipfileset src="${lib.native}/sunos-x86.jar"
|
|
includes="*jnidispatch*"
|
|
prefix="com/sun/jna/sunos-x86"/>
|
|
<zipfileset src="${lib.native}/sunos-x86-64.jar"
|
|
includes="*jnidispatch*"
|
|
prefix="com/sun/jna/sunos-x86-64"/>
|
|
<zipfileset src="${lib.native}/sunos-sparc.jar"
|
|
includes="*jnidispatch*"
|
|
prefix="com/sun/jna/sunos-sparc"/>
|
|
<zipfileset src="${lib.native}/sunos-sparcv9.jar"
|
|
includes="*jnidispatch*"
|
|
prefix="com/sun/jna/sunos-sparcv9"/>
|
|
<zipfileset src="${lib.native}/freebsd-x86.jar"
|
|
includes="*jnidispatch*"
|
|
prefix="com/sun/jna/freebsd-x86"/>
|
|
<zipfileset src="${lib.native}/freebsd-x86-64.jar"
|
|
includes="*jnidispatch*"
|
|
prefix="com/sun/jna/freebsd-x86-64"/>
|
|
<zipfileset src="${lib.native}/openbsd-x86.jar"
|
|
includes="*jnidispatch*"
|
|
prefix="com/sun/jna/openbsd-x86"/>
|
|
<zipfileset src="${lib.native}/openbsd-x86-64.jar"
|
|
includes="*jnidispatch*"
|
|
prefix="com/sun/jna/openbsd-x86-64"/>
|
|
<zipfileset src="${lib.native}/win32-x86-64.jar"
|
|
includes="*jnidispatch*"
|
|
prefix="com/sun/jna/win32-x86-64"/>
|
|
<zipfileset src="${lib.native}/w32ce-arm.jar"
|
|
includes="*jnidispatch*"
|
|
prefix="com/sun/jna/w32ce-arm"/>
|
|
</jar>
|
|
<zip zipfile="${build}/${minjar}">
|
|
<zipfileset src="${build}/${jar}" excludes="**/*jnidispatch*"/>
|
|
</zip>
|
|
</target>
|
|
|
|
<target name="platform-jar" depends="jar">
|
|
<subant target="jar" failonerror="true">
|
|
<property name="file.reference.jna.build" location="${build}"/>
|
|
<property name="file.reference.jna.jar" location="${build}/${jar}"/>
|
|
<property name="libs.junit.classpath" location="lib/junit.jar"/>
|
|
<property name="javac.source" value="${platform.compatibility}"/>
|
|
<property name="javac.target" value="${platform.compatibility}"/>
|
|
<!-- OSGi manifest properties -->
|
|
<property name="vendor" value="${vendor}"/>
|
|
<property name="impl.title" value="${impl.title}.platform"/>
|
|
<property name="impl.version" value="${impl.version}"/>
|
|
<property name="spec.title" value="${spec.title}"/>
|
|
<property name="spec.vendor" value="${spec.vendor}"/>
|
|
<property name="spec.version" value="${spec.version}"/>
|
|
<property name="osgi.version" value="${jna.major}.${jna.minor}.${jna.revision}"/>
|
|
<fileset dir="${contrib}" includes="platform/build.xml" />
|
|
</subant>
|
|
<!-- Sources package as required by maven -->
|
|
<zip zipfile="${platform-sources-jar}">
|
|
<zipfileset dir="${contrib}/platform/src" />
|
|
</zip>
|
|
</target>
|
|
|
|
<target name="contrib-jars" depends="platform-jar" description="Build contrib jars">
|
|
<subant target="jar" failonerror="true">
|
|
<property name="file.reference.jna.build" location="${build}"/>
|
|
<property name="file.reference.jna.jar" location="${build}/${jar}"/>
|
|
<property name="libs.junit.classpath" location="lib/junit.jar"/>
|
|
<fileset dir="${contrib}" includes="*/build.xml" excludes="platform/build.xml"/>
|
|
</subant>
|
|
</target>
|
|
|
|
<target name="javah" depends="compile" unless="-native">
|
|
<javah classpath="${classes}" destdir="${build.native}" force="yes">
|
|
<class name="com.sun.jna.Function"/>
|
|
<class name="com.sun.jna.Native"/>
|
|
<class name="com.sun.jna.win32.DLLCallback"/>
|
|
</javah>
|
|
<condition property="grep" value="/usr/sfw/bin/ggrep">
|
|
<os name="SunOS"/>
|
|
</condition>
|
|
<condition property="grep" value="ggrep">
|
|
<os name="OpenBSD"/>
|
|
</condition>
|
|
<property name="grep" value="grep"/>
|
|
<condition property="grep.required" value="false" else="true">
|
|
<os name="AIX"/>
|
|
</condition>
|
|
<!-- args are based on GNU grep, other versions may differ -->
|
|
<apply dir="${build.native}" executable="${grep}" parallel="true"
|
|
failonerror="${grep.required}" relative="true" output="${md5.file}">
|
|
<arg value="-A"/>
|
|
<arg value="1"/>
|
|
<arg value="JNIEXPORT"/>
|
|
<fileset dir="${build.native}" includes="*.h"/>
|
|
</apply>
|
|
<!-- Clean up gcj javah output to match that of Sun's javah -->
|
|
<fixcrlf file="${md5.file}" eol="unix"/>
|
|
<replaceregexp match="^((.*\.h):JNIEXPORT[^(]+)( +\(.*)"
|
|
replace="\1
\2- \3
--"
|
|
byline="true"
|
|
file="${md5.file}"/>
|
|
<replaceregexp match="(JNIEnv *\*) *env"
|
|
replace="\1"
|
|
byline="true"
|
|
file="${md5.file}"/>
|
|
<replaceregexp match="
--
.*\.h-$"
|
|
replace=""
|
|
flags="m"
|
|
file="${md5.file}"/>
|
|
<checksum property="md5" file="${md5.file}" />
|
|
<condition property="jni.valid" value="true">
|
|
<or>
|
|
<os name="AIX"/>
|
|
<equals arg1="${jni.md5}" arg2="${md5}" trim="true"/>
|
|
<equals arg1="${jni.md5}" arg2=""/>
|
|
</or>
|
|
</condition>
|
|
</target>
|
|
|
|
<!-- Invalidate native libraries when native API changes -->
|
|
<target name="-native-api-check" depends="javah" unless="jni.valid">
|
|
<echo>Invalidating native code, new checksum is ${md5}</echo>
|
|
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/darwin.jar" overwrite="true"/>
|
|
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/win32-x86.jar" overwrite="true"/>
|
|
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/win32-x86-64.jar" overwrite="true"/>
|
|
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/w32ce-arm.jar" overwrite="true"/>
|
|
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/linux-x86.jar" overwrite="true"/>
|
|
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/linux-x86-64.jar" overwrite="true"/>
|
|
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/linux-arm.jar" overwrite="true"/>
|
|
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/linux-aarch64.jar" overwrite="true"/>
|
|
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/linux-ia64.jar" overwrite="true"/>
|
|
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/linux-ppc.jar" overwrite="true"/>
|
|
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/linux-ppc64.jar" overwrite="true"/>
|
|
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/freebsd-x86.jar" overwrite="true"/>
|
|
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/freebsd-x86-64.jar" overwrite="true"/>
|
|
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/openbsd-x86.jar" overwrite="true"/>
|
|
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/openbsd-x86-64.jar" overwrite="true"/>
|
|
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/sunos-x86.jar" overwrite="true"/>
|
|
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/sunos-x86-64.jar" overwrite="true"/>
|
|
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/sunos-sparc.jar" overwrite="true"/>
|
|
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/sunos-sparcv9.jar" overwrite="true"/>
|
|
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/android-arm.jar" overwrite="true"/>
|
|
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/android-x86.jar" overwrite="true"/>
|
|
<delete failOnError="false" includeEmptyDirs="true">
|
|
<fileset dir="${build.native}" includes="*.o,*jnidispatch*"/>
|
|
</delete>
|
|
<fail>API for native code has changed, or javah output is inconsistent. Re-run this build after checking ${md5.file} or updating jni.version and jni.md5 in build.xml</fail>
|
|
</target>
|
|
|
|
<target name=":rsrc">
|
|
<condition property="-rsrc">
|
|
<and>
|
|
<not><os family="windows"/></not>
|
|
<not><equals arg1="${os.prefix}" arg2="w32ce-arm"/></not>
|
|
</and>
|
|
</condition>
|
|
</target>
|
|
<target name="rsrc" depends="-setup,:rsrc" unless="-rsrc"
|
|
description="Generate w32 DLL version resource information">
|
|
<property name="rsrc" location="${build.native}/jnidispatch.rc"/>
|
|
<copy todir="${build.native}" file="${native}/jnidispatch.rc"/>
|
|
<replaceregexp match="FILEVERSION.*"
|
|
replace="FILEVERSION ${jni.major},${jni.minor},${jni.revision},${jni.build}"
|
|
preserveLastModified="true"
|
|
file="${rsrc}" byline="true"/>
|
|
<replaceregexp match="PRODUCTVERSION.*"
|
|
replace="PRODUCTVERSION ${jna.major},${jna.minor},${jna.revision},${jna.build}"
|
|
preserveLastModified="true"
|
|
file="${rsrc}" byline="true"/>
|
|
<replaceregexp match="FileVersion.*"
|
|
replace="FileVersion","${jni.version}""
|
|
preserveLastModified="true"
|
|
file="${rsrc}" byline="true"/>
|
|
<replaceregexp match="Full Version.*"
|
|
replace="Full Version","${jni.version} b${jni.build}""
|
|
preserveLastModified="true"
|
|
file="${rsrc}" byline="true"/>
|
|
<replaceregexp match="ProductVersion.*"
|
|
replace="ProductVersion","${spec.version}""
|
|
preserveLastModified="true"
|
|
file="${rsrc}" byline="true"/>
|
|
<replaceregexp match="(Copyright.*-)2..."
|
|
replace="\1${year}"
|
|
preserveLastModified="true"
|
|
file="${rsrc}" byline="true"/>
|
|
</target>
|
|
|
|
<target name="native" depends="-enable-native,-setup,javah,-native-api-check,rsrc" unless="-native"
|
|
description="Build native libraries. Use 'ant -DCC=xxx' to build using a compiler other than gcc">
|
|
<property name="comment" value="# auto-generated by ant"/>
|
|
<replaceregexp match="^JNA_JNI_VERSION=.*"
|
|
replace="JNA_JNI_VERSION=${jni.version} ${comment}"
|
|
file="native/Makefile" byline="true"/>
|
|
<replaceregexp match="^CHECKSUM=.*"
|
|
replace="CHECKSUM=${jni.md5} ${comment}"
|
|
file="native/Makefile" byline="true"/>
|
|
<!-- Handle cross-compilation -->
|
|
<condition property="make.OS" value="OS=w32ce">
|
|
<equals arg1="${os.prefix}" arg2="w32ce-arm"/>
|
|
</condition>
|
|
<condition property="make.OS" value="OS=android">
|
|
<or>
|
|
<equals arg1="${os.prefix}" arg2="android-arm"/>
|
|
<equals arg1="${os.prefix}" arg2="android-x86"/>
|
|
</or>
|
|
</condition>
|
|
<property name="make.OS" value="IGNORE="/>
|
|
<!-- Ensure Makefile ARCH property properly set -->
|
|
<condition property="ARCH" value="arm">
|
|
<equals arg1="${os.prefix}" arg2="w32ce-arm"/>
|
|
</condition>
|
|
<condition property="ARCH" value="arm">
|
|
<equals arg1="${os.prefix}" arg2="android-arm"/>
|
|
</condition>
|
|
<condition property="ARCH" value="x86">
|
|
<equals arg1="${os.prefix}" arg2="android-x86"/>
|
|
</condition>
|
|
<condition property="ARCH" value="ppc">
|
|
<equals arg1="${os.prefix}" arg2="aix-ppc"/>
|
|
</condition>
|
|
<condition property="ARCH" value="ppc64">
|
|
<equals arg1="${os.prefix}" arg2="aix-ppc64"/>
|
|
</condition>
|
|
<!-- ensure ARCH is set properly for 64-bit capable platforms -->
|
|
<!-- use ANT_OPTS=-d64/-d32 to build 64-bit/32-bit if not the platform default -->
|
|
<property name="ARCH" value="${os.arch}"/>
|
|
<condition property="make.CC" value="CC=${CC}" else="IGNORE=">
|
|
<isset property="CC"/>
|
|
</condition>
|
|
<condition property="make.ARCH" value="ARCH=${ARCH}" else="IGNORE=">
|
|
<isset property="ARCH"/>
|
|
</condition>
|
|
<condition property="make.SDKROOT" value="SDKROOT=${SDKROOT}">
|
|
<isset property="SDKROOT"/>
|
|
</condition>
|
|
<property name="xcode" value="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform"/>
|
|
<condition property="make.SDKROOT"
|
|
value="SDKROOT=${xcode}/Developer/SDKs/MacOSX10.9.sdk">
|
|
<and>
|
|
<equals arg1="${os.prefix}" arg2="darwin" trim="true"/>
|
|
<available file="${xcode}/Developer/SDKs/MacOSX10.9.sdk"/>
|
|
</and>
|
|
</condition>
|
|
<condition property="make.SDKROOT"
|
|
value="SDKROOT=${xcode}/Developer/SDKs/MacOSX10.8.sdk">
|
|
<and>
|
|
<equals arg1="${os.prefix}" arg2="darwin" trim="true"/>
|
|
<available file="${xcode}/Developer/SDKs/MacOSX10.8.sdk"/>
|
|
</and>
|
|
</condition>
|
|
<condition property="make.SDKROOT"
|
|
value="SDKROOT=/Developer/SDKs/MacOSX10.6.sdk">
|
|
<and>
|
|
<equals arg1="${os.prefix}" arg2="darwin" trim="true"/>
|
|
<available file="/Developer/SDKs/MacOSX10.6.sdk"/>
|
|
</and>
|
|
</condition>
|
|
<condition property="make.SDKROOT"
|
|
value="SDKROOT=/Developer/SDKs/MacOSX10.5.sdk">
|
|
<and>
|
|
<equals arg1="${os.prefix}" arg2="darwin" trim="true"/>
|
|
<available file="/Developer/SDKs/MacOSX10.5.sdk"/>
|
|
</and>
|
|
</condition>
|
|
<condition property="make.SDKROOT"
|
|
value="SDKROOT=/Developer/SDKs/MacOSX10.4u.sdk" else="IGNORE=">
|
|
<and>
|
|
<equals arg1="${os.prefix}" arg2="darwin" trim="true"/>
|
|
<available file="/Developer/SDKs/MacOSX10.4u.sdk"/>
|
|
</and>
|
|
</condition>
|
|
<!-- Windows' drive letters and spaces in absolute paths wreak havoc on
|
|
make -->
|
|
<condition property="make.BUILD" value="BUILD=../${build}/${native.subdir}" else="BUILD=${build.native}">
|
|
<os family="windows"/>
|
|
</condition>
|
|
<condition property="make.PATH" value="PATH=/opt/csw/bin:/usr/sfw/bin:/usr/bin:/usr/ccs/bin" else="IGNORE=">
|
|
<os name="SunOS"/>
|
|
</condition>
|
|
<condition property="make" value="/usr/sfw/bin/gmake">
|
|
<and>
|
|
<os name="SunOS"/>
|
|
<available file="/usr/sfw/bin/gmake"/>
|
|
</and>
|
|
</condition>
|
|
<condition property="make" value="gmake">
|
|
<or>
|
|
<os name="FreeBSD"/>
|
|
<os name="OpenBSD"/>
|
|
<os name="NetBSD"/>
|
|
<os name="SunOS"/>
|
|
<os name="AIX"/>
|
|
</or>
|
|
</condition>
|
|
<!-- Allow explicit override of make variables -->
|
|
<condition property="make.OPTS" value="${EXTRA_MAKE_OPTS}" else="IGNORE=">
|
|
<isset property="EXTRA_MAKE_OPTS"/>
|
|
</condition>
|
|
<!-- Native resource path within jna.jar -->
|
|
<property name="native.path" value="com/sun/jna/${os.prefix}"/>
|
|
|
|
<!-- Default make program -->
|
|
<property name="make" value="make"/>
|
|
|
|
<exec executable="${make}" dir="${native}" failonerror="true">
|
|
<arg value="JAVA_HOME=${jdk.home}"/>
|
|
<arg value="JAVAH=${build.native}"/>
|
|
<arg value="DEBUG=${debug.native}"/>
|
|
<arg value="CFLAGS_EXTRA=${cflags_extra.native}"/>
|
|
<arg value="DYNAMIC_LIBFFI=${dynlink.native}"/>
|
|
<arg value="${make.CC}"/>
|
|
<arg value="${make.BUILD}"/>
|
|
<arg value="${make.SDKROOT}"/>
|
|
<arg value="${make.ARCH}"/>
|
|
<arg value="${make.PATH}"/>
|
|
<arg value="${make.OS}"/>
|
|
<arg line="${make.OPTS}"/>
|
|
<arg value="JNA_JNI_VERSION=${jni.version}"/>
|
|
<arg value="CHECKSUM=${jni.md5}"/>
|
|
</exec>
|
|
<mkdir dir="${classes}/${native.path}"/>
|
|
<copy todir="${classes}/${native.path}">
|
|
<fileset dir="${build.native}"
|
|
includes="jnidispatch.dll,libjnidispatch.*"/>
|
|
</copy>
|
|
<mkdir dir="${eclipse.classes}/${native.path}"/>
|
|
<copy todir="${eclipse.classes}/${native.path}"
|
|
failonerror="false">
|
|
<fileset dir="${build.native}"
|
|
includes="jnidispatch.dll,libjnidispatch.*"/>
|
|
</copy>
|
|
<!-- For web start, native libraries may be provided in the root of -->
|
|
<!-- an included jar file -->
|
|
<jar jarfile="${build}/${native.jar}">
|
|
<fileset dir="${build.native}" includes="jnidispatch.dll,libjnidispatch.*"/>
|
|
<manifest>
|
|
<attribute name="Implementation-Version" value="${jni.version} b${jni.build}"/>
|
|
<attribute name="Specification-Version" value="${jni.version}"/>
|
|
</manifest>
|
|
</jar>
|
|
<copy todir="${lib.native}">
|
|
<fileset dir="${build}" includes="${native.jar}"/>
|
|
</copy>
|
|
</target>
|
|
|
|
<target name="compile-some-tests" depends="compile,jar"
|
|
description="Compile test code which does not have additional native
|
|
dependencies">
|
|
<javac classpathref="compile-test.path"
|
|
source="${test.compatibility}"
|
|
target="${test.compatibility}"
|
|
destdir="${test.classes}"
|
|
includeantruntime="false"
|
|
includes="**/StructureFieldOrderInspector.java"
|
|
deprecation="on" debug="${debug}">
|
|
<src path="${test.src}"/>
|
|
</javac>
|
|
</target>
|
|
|
|
<target name="compile-tests" depends="compile,native,jar"
|
|
description="Compile all test code">
|
|
<javac classpathref="compile-test.path"
|
|
source="${test.compatibility}"
|
|
target="${test.compatibility}"
|
|
destdir="${test.classes}"
|
|
includeantruntime="false"
|
|
excludes="${tests.exclude-patterns}"
|
|
deprecation="on" debug="${debug}">
|
|
<src path="${test.src}"/>
|
|
<exclude name="${tests.exclude}"/>
|
|
</javac>
|
|
<!-- Embed testlib-jar at root and at default resource path -->
|
|
<mkdir dir="${test.classes}/${os.prefix}"/>
|
|
<copy todir="${test.classes}">
|
|
<fileset dir="${build.native}">
|
|
<include name="*testlib-jar*"/>
|
|
</fileset>
|
|
</copy>
|
|
<copy todir="${test.classes}/${os.prefix}">
|
|
<fileset dir="${build.native}">
|
|
<include name="*testlib-jar*"/>
|
|
</fileset>
|
|
</copy>
|
|
<!-- Create a jar for easy movement of tests, and jar load test -->
|
|
<jar jarfile="${build}/${testjar}">
|
|
<fileset dir="${test.classes}">
|
|
<patternset refid="jar-compiled"/>
|
|
<include name="**/*testlib-jar*"/>
|
|
</fileset>
|
|
</jar>
|
|
<!-- Ensure jar-based library is unavailable on FS-based class path -->
|
|
<delete>
|
|
<fileset dir="${build}">
|
|
<include name="**/*testlib-jar*"/>
|
|
</fileset>
|
|
</delete>
|
|
<mkdir dir="${build}/jws"/>
|
|
<copy todir="${build}/jws" file="${build}/${jar}"/>
|
|
<copy todir="${build}/jws" file="${build}/${testjar}"/>
|
|
<copy todir="${build}/jws" file="lib/junit.jar"/>
|
|
<copy todir="${build}/jws" file="lib/clover.jar"/>
|
|
<jar jarfile="${build}/jws/jnidispatch.jar">
|
|
<fileset dir="${build.native}" includes="*jnidispatch.*"/>
|
|
</jar>
|
|
<signjar alias="jna" keystore="jna.keystore" storepass="jnadev" lazy="true">
|
|
<fileset dir="${build}/jws" includes="${jar},${testjar},junit.jar,jnidispatch.jar,clover.jar"/>
|
|
</signjar>
|
|
</target>
|
|
|
|
<target name="android-test-setup" depends="compile-tests"
|
|
description="Configure tests for running on an Android emulator">
|
|
<!-- 'shared' should be the path to a folder mounted as the mobile
|
|
device/simulator storage card. -->
|
|
<property name="shared" value="shared"/>
|
|
</target>
|
|
|
|
<target name="wince-test-setup" depends="compile-tests"
|
|
description="Configure tests for running on the WM emulator">
|
|
<!-- 'shared' should be the path to a folder mounted as the mobile
|
|
device/simulator storage card. -->
|
|
<property name="shared" value="shared"/>
|
|
<!-- w32ce arm testing -->
|
|
<jar jarfile="${shared}/test.jar">
|
|
<zipfileset src="${build}/${jar}"/>
|
|
<zipfileset src="${build}/${testjar}"/>
|
|
</jar>
|
|
<copy todir="${shared}" file="${build}/${jar}"/>
|
|
<copy todir="${shared}" file="${build.native}/jnidispatch.dll"/>
|
|
<copy todir="${shared}" file="${build.native}/testlib.dll"/>
|
|
<copy todir="${shared}" file="${build.native}/testlib2.dll"/>
|
|
<copy todir="${shared}" file="${build.native}/test-path.dll"/>
|
|
<copy todir="${shared}" file="${build.native}/testlib-truncated"/>
|
|
<copy todir="${shared}" file="w32ce-test.lnk"/>
|
|
<chmod file="${shared}/*.dll" perm="+x"/>
|
|
</target>
|
|
|
|
<target name="-enable-native" unless="-native">
|
|
<property name="build-native" value="true"/>
|
|
</target>
|
|
|
|
<!-- When running tests from an IDE, be sure to set jna.library.path -->
|
|
<!-- to where the test library (testlib) is found. -->
|
|
<target name="test" depends="-enable-native,jar,compile-tests" unless="cross-compile"
|
|
description="Run all unit tests">
|
|
<property name="test.fork" value="yes"/>
|
|
<property name="reports.junit" location="${reports}/junit"/>
|
|
<property name="results.junit" location="${build}/junit-results"/>
|
|
<mkdir dir="${results.junit}"/>
|
|
<echo>Saving test results in ${results.junit}</echo>
|
|
<property name="tests.stdcall" value="**/win32/*StdCallTest.java"/>
|
|
<condition property="tests.platform" value="**/win32/**/*Test.java">
|
|
<os family="windows"/>
|
|
</condition>
|
|
<condition property="tests.exclude" value="${tests.stdcall}">
|
|
<and><os family="windows"/><not><os arch="x86"/></not></and>
|
|
</condition>
|
|
<condition property="tests.platform" value="**/unix/*Test.java">
|
|
<and>
|
|
<os family="unix"/>
|
|
<not><os family="mac"/></not>
|
|
</and>
|
|
</condition>
|
|
<property name="tests.platform" value=""/>
|
|
<property name="tests.exclude" value=""/>
|
|
<property name="tests.exclude-patterns" value=""/>
|
|
<condition property="java.awt.headless" value="true">
|
|
<isset property="headless"/>
|
|
</condition>
|
|
<propertyset id="headless">
|
|
<propertyref prefix="java.awt.headless"/>
|
|
</propertyset>
|
|
<junit fork="${test.fork}" failureproperty="testfailure" tempdir="${build}">
|
|
<!-- optionally run headless -->
|
|
<syspropertyset refid="headless"/>
|
|
<!-- avoid VM conflicts with JNA protected mode -->
|
|
<env key="${ld.preload.name}" file="${libjsig}"/>
|
|
<sysproperty key="jna.library.path" file="${build.native}"/>
|
|
<!-- Ignore any system install of JNA -->
|
|
<sysproperty key="jna.nosys" value="true"/>
|
|
<!-- Avoid VM crashes, if possible -->
|
|
<sysproperty key="jna.protected" value="true"/>
|
|
<sysproperty key="jna.builddir" file="${build}"/>
|
|
<sysproperty key="jna.nativedir" file="${build.native}"/>
|
|
<jvmarg value="${vmopt.arch}"/>
|
|
<classpath><path refid="test.runpath"/></classpath>
|
|
<formatter type="brief" usefile="false"/>
|
|
<formatter type="xml"/>
|
|
<batchtest todir="${results.junit}">
|
|
<fileset dir="${test.src}" excludes="${tests.exclude-patterns}">
|
|
<include name="com/sun/jna/*Test.java"/>
|
|
<include name="${tests.platform}"/>
|
|
<exclude name="${tests.exclude}"/>
|
|
</fileset>
|
|
</batchtest>
|
|
</junit>
|
|
<junitreport todir="${results.junit}">
|
|
<fileset dir="${results.junit}">
|
|
<include name="TEST-*.xml"/>
|
|
</fileset>
|
|
<report todir="${reports.junit}"/>
|
|
</junitreport>
|
|
<echo>View test report in file://${reports.junit}/index.html</echo>
|
|
<fail if="testfailure" unless="clover">One or more tests failed</fail>
|
|
</target>
|
|
|
|
<target name="test-platform" depends="compile-some-tests,platform-jar">
|
|
<subant target="test" failonerror="true" inheritall="true" inheritrefs="true">
|
|
<property name="file.reference.jna.build" location="${build}"/>
|
|
<property name="file.reference.jna.jar" location="${build}/${jar}"/>
|
|
<property name="libs.junit.classpath" location="lib/junit.jar"/>
|
|
<property name="javac.source" value="${test.compatibility}"/>
|
|
<property name="javac.target" value="${test.compatibility}"/>
|
|
<fileset dir="${contrib}" includes="platform/build.xml"/>
|
|
</subant>
|
|
</target>
|
|
|
|
<target name="with.clover" description="Enable code coverage for tests">
|
|
<taskdef resource="cloverlib.xml" classpath="lib/clover.jar"/>
|
|
<property name="clover" value="true"/>
|
|
<property name="build" value="build.clover"/>
|
|
<clover-setup/>
|
|
</target>
|
|
|
|
<target name="clover" depends="with.clover,test"
|
|
description="Generate test code coverage reports">
|
|
<property name="reports.clover" value="${reports}/clover"/>
|
|
<mkdir dir="${reports.clover}"/>
|
|
<clover-report>
|
|
<current outfile="${reports.clover}" title="clover">
|
|
<fileset dir="." includes="**/*.java" />
|
|
<testresults dir="${results.junit}" includes="TEST-*.xml"/>
|
|
<format type="html"/>
|
|
</current>
|
|
</clover-report>
|
|
<echo>Reports generated in ${reports.clover}</echo>
|
|
</target>
|
|
|
|
<target name="javadoc" depends="-setup">
|
|
<path id="javadoc.src.path">
|
|
<path refid="src.path"/>
|
|
<pathelement location="${platform.src}"/>
|
|
</path>
|
|
<path id="javadoc.compile.path">
|
|
<path refid="compile.path"/>
|
|
<pathelement location="${classes}"/>
|
|
</path>
|
|
<property name="header"
|
|
value="<b>JNA API</><font size="-1"> ${jna.version}</font>"/>
|
|
<property name="footer"
|
|
value="<center><i>${copyright}</i></center>"/>
|
|
|
|
<mkdir dir="${javadoc}"/>
|
|
<javadoc package="true"
|
|
windowtitle="JNA API"
|
|
sourcepathref="javadoc.src.path"
|
|
classpathref="javadoc.compile.path"
|
|
maxmemory="256m"
|
|
packagenames="com.sun.jna,com.sun.jna.ptr,com.sun.jna.types,com.sun.jna.platform,com.sun.jna.platform.win32"
|
|
overview="${src}/com/sun/jna/overview.html"
|
|
destdir="${javadoc}">
|
|
<!-- stylesheetfile="${stylesheet}" -->
|
|
<doctitle>JNA API Documentation</doctitle>
|
|
<header>${header}</header>
|
|
<bottom>${footer}</bottom>
|
|
<link href="http://download.oracle.com/javase/1.4.2/docs/api/"/>
|
|
|
|
<packageset dir="${src}" defaultexcludes="yes">
|
|
<patternset>
|
|
<include name="com/sun/jna/**/*"/>
|
|
</patternset>
|
|
</packageset>
|
|
<packageset dir="${platform.src}" defaultexcludes="yes">
|
|
<patternset>
|
|
<include name="com/sun/jna/platform/**/*"/>
|
|
</patternset>
|
|
</packageset>
|
|
|
|
<group title="Java Native Access" packages="com.sun.jna,com.sun.jna.ptr,com.sun.jna.types,com.sun.jna.win32"/>
|
|
<group title="Platform Utilities" packages="com.sun.jna.platform,com.sun.jna.platform.dnd"/>
|
|
<group title="Platform Specific" packages="com.sun.jna.platform.*"/>
|
|
|
|
<arg value="-notimestamp"/>
|
|
</javadoc>
|
|
<jar jarfile="${platform-javadoc-jar}">
|
|
<fileset dir="${javadoc}" />
|
|
</jar>
|
|
</target>
|
|
|
|
<target name="dist" depends="jar,javadoc,contrib-jars,compile-tests,native"
|
|
description="Build distribution files">
|
|
<copy todir="${dist}">
|
|
<fileset dir="${build}" includes="${jar},${minjar}"/>
|
|
<fileset dir="${contrib}/platform/dist" includes="jna-platform.jar"/>
|
|
<fileset dir="${lib.native}">
|
|
<include name="*.jar"/>
|
|
<exclude name="out-of-date.jar"/>
|
|
</fileset>
|
|
</copy>
|
|
<copy todir="${dist}/jnacontrib" flatten="true">
|
|
<fileset dir="${contrib}">
|
|
<include name="**/build/demo-*.jar" />
|
|
</fileset>
|
|
</copy>
|
|
<jar jarfile="${maven-javadoc-jar}">
|
|
<fileset dir="${javadoc}" />
|
|
</jar>
|
|
|
|
<zip zipfile="${dist}/doc.zip">
|
|
<zipfileset dir="${javadoc}" prefix="javadoc"/>
|
|
</zip>
|
|
<!-- Javadoc -->
|
|
<!-- JNA sources only, for use in Linux build from source/shared libffi -->
|
|
<zip zipfile="${dist}/src.zip">
|
|
<zipfileset dir="." includes="build.xml,${pom},LICENSE,LGPL2.1,ASL2.0"/>
|
|
<zipfileset dir="${src}" includes="**/*.java" prefix="src"/>
|
|
<zipfileset dir="${test.src}" includes="**/*.java" prefix="test"/>
|
|
<zipfileset dir="${native}" excludes="libffi,libffi/**/*,build,build/**/*" prefix="native"/>
|
|
<zipfileset dir="${contrib}/platform" includes="**/*.java" prefix="contrib/platform"/>
|
|
</zip>
|
|
<!-- Full sources required to build and test everything -->
|
|
<zip zipfile="${dist}/src-full.zip">
|
|
<zipfileset src="${dist}/src.zip"/>
|
|
<zipfileset dir="lib" includes="junit.jar,clover.jar" prefix="lib"/>
|
|
<zipfileset dir="." includes=".classpath,.project"/>
|
|
<zipfileset dir="${native}" includes="libffi,libffi/**/*" prefix="native"/>
|
|
</zip>
|
|
<!-- Sources package as required by maven -->
|
|
<zip zipfile="${maven-sources-jar}">
|
|
<zipfileset dir="${src}" />
|
|
</zip>
|
|
</target>
|
|
|
|
<target name="clean" depends="-dynamic-properties">
|
|
<delete failOnError="false" includeEmptyDirs="true">
|
|
<fileset dir="${build}"/>
|
|
</delete>
|
|
<delete quiet="true" includeEmptyDirs="true">
|
|
<fileset dir=".clover"/>
|
|
<fileset dir="${javadoc}"/>
|
|
<fileset dir="." includes="*~,**/*~,build.number"/>
|
|
</delete>
|
|
<subant target="clean" failonerror="true">
|
|
<fileset dir="${contrib}" includes="*/build.xml"/>
|
|
</subant>
|
|
</target>
|
|
|
|
|
|
<path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.1.3.jar" />
|
|
<typedef resource="org/apache/maven/artifact/ant/antlib.xml"
|
|
uri="antlib:org.apache.maven.artifact.ant"
|
|
classpathref="maven-ant-tasks.classpath" />
|
|
|
|
<!-- NOTE: The 'deploy' target works only if the version (jna.version in build.xml) ends in '-SNAPSHOT'. -->
|
|
<target name="deploy" depends="dist" description="deploy snapshot version to Maven snapshot repository">
|
|
<artifact:mvn failonerror="true">
|
|
<arg value="org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file"/>
|
|
<arg value="-Durl=${maven-snapshots-repository-url}"/>
|
|
<arg value="-DrepositoryId=${maven-snapshots-repository-id}"/>
|
|
<arg value="-DpomFile=${pom}"/>
|
|
<arg value="-Dfile=${dist-jar}"/>
|
|
<arg value="-Dfiles=${maven-sources-jar},${maven-javadoc-jar}"/>
|
|
<arg value="-Dtypes=jar,jar"/>
|
|
<arg value="-Dclassifiers=sources,javadoc"/>
|
|
</artifact:mvn>
|
|
|
|
<artifact:mvn failonerror="true">
|
|
<arg value="org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file"/>
|
|
<arg value="-Durl=${maven-snapshots-repository-url}"/>
|
|
<arg value="-DrepositoryId=${maven-snapshots-repository-id}"/>
|
|
<arg value="-DpomFile=${pom-platform}"/>
|
|
<arg value="-Dfile=${platform-jar}"/>
|
|
<arg value="-Dfiles=${platform-sources-jar},${platform-javadoc-jar}"/>
|
|
<arg value="-Dtypes=jar,jar"/>
|
|
<arg value="-Dclassifiers=sources,javadoc"/>
|
|
</artifact:mvn>
|
|
</target>
|
|
|
|
|
|
<property name="version-maven-gpg-plugin" value="1.4"/>
|
|
|
|
<target name="stage" depends="dist" description="deploy release version to Maven staging repository">
|
|
<!-- sign and deploy the jna artifact -->
|
|
<artifact:mvn failonerror="true">
|
|
<arg value="org.apache.maven.plugins:maven-gpg-plugin:${version-maven-gpg-plugin}:sign-and-deploy-file"/>
|
|
<arg value="-Durl=${maven-staging-repository-url}"/>
|
|
<arg value="-DrepositoryId=${maven-staging-repository-id}"/>
|
|
<arg value="-DpomFile=${pom}"/>
|
|
<arg value="-Dfile=${dist-jar}"/>
|
|
<arg value="-Dgpg.useagent=true"/>
|
|
</artifact:mvn>
|
|
|
|
<!-- sign and deploy the jna sources artifact -->
|
|
<artifact:mvn failonerror="true">
|
|
<arg value="org.apache.maven.plugins:maven-gpg-plugin:${version-maven-gpg-plugin}:sign-and-deploy-file"/>
|
|
<arg value="-Durl=${maven-staging-repository-url}"/>
|
|
<arg value="-DrepositoryId=${maven-staging-repository-id}"/>
|
|
<arg value="-DpomFile=${pom}"/>
|
|
<arg value="-Dfile=${maven-sources-jar}"/>
|
|
<arg value="-Dclassifier=sources"/>
|
|
<arg value="-Dgpg.useagent=true"/>
|
|
</artifact:mvn>
|
|
|
|
<!-- sign and deploy the jna javadoc artifact -->
|
|
<artifact:mvn failonerror="true">
|
|
<arg value="org.apache.maven.plugins:maven-gpg-plugin:${version-maven-gpg-plugin}:sign-and-deploy-file"/>
|
|
<arg value="-Durl=${maven-staging-repository-url}"/>
|
|
<arg value="-DrepositoryId=${maven-staging-repository-id}"/>
|
|
<arg value="-DpomFile=${pom}"/>
|
|
<arg value="-Dfile=${maven-javadoc-jar}"/>
|
|
<arg value="-Dclassifier=javadoc"/>
|
|
<arg value="-Dgpg.useagent=true"/>
|
|
</artifact:mvn>
|
|
|
|
<!-- sign and deploy the platform artifact -->
|
|
<artifact:mvn failonerror="true">
|
|
<arg value="org.apache.maven.plugins:maven-gpg-plugin:${version-maven-gpg-plugin}:sign-and-deploy-file"/>
|
|
<arg value="-Durl=${maven-staging-repository-url}"/>
|
|
<arg value="-DrepositoryId=${maven-staging-repository-id}"/>
|
|
<arg value="-DpomFile=${pom-platform}"/>
|
|
<arg value="-Dfile=${platform-jar}"/>
|
|
<arg value="-Dgpg.useagent=true"/>
|
|
</artifact:mvn>
|
|
|
|
<!-- sign and deploy the platform sources artifact -->
|
|
<artifact:mvn failonerror="true">
|
|
<arg value="org.apache.maven.plugins:maven-gpg-plugin:${version-maven-gpg-plugin}:sign-and-deploy-file"/>
|
|
<arg value="-Durl=${maven-staging-repository-url}"/>
|
|
<arg value="-DrepositoryId=${maven-staging-repository-id}"/>
|
|
<arg value="-DpomFile=${pom-platform}"/>
|
|
<arg value="-Dfile=${platform-sources-jar}"/>
|
|
<arg value="-Dclassifier=sources"/>
|
|
<arg value="-Dgpg.useagent=true"/>
|
|
</artifact:mvn>
|
|
|
|
<!-- sign and deploy the platform javadoc artifact -->
|
|
<artifact:mvn failonerror="true">
|
|
<arg value="org.apache.maven.plugins:maven-gpg-plugin:${version-maven-gpg-plugin}:sign-and-deploy-file"/>
|
|
<arg value="-Durl=${maven-staging-repository-url}"/>
|
|
<arg value="-DrepositoryId=${maven-staging-repository-id}"/>
|
|
<arg value="-DpomFile=${pom-platform}"/>
|
|
<arg value="-Dfile=${platform-javadoc-jar}"/>
|
|
<arg value="-Dclassifier=javadoc"/>
|
|
<arg value="-Dgpg.useagent=true"/>
|
|
</artifact:mvn>
|
|
|
|
</target>
|
|
</project>
|
|
|
|
|