Skip to content

Commit 3b9f1ae

Browse files
Move to JDK 8 as minimum runtie JDK and JDK 9+ as build JDK
1 parent 2372067 commit 3b9f1ae

File tree

12 files changed

+622
-1890
lines changed

12 files changed

+622
-1890
lines changed

CHANGES.md

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Important Changes
2323
-----------------
2424
* The interfaces between Java and native code have changed, so `libjnidispatch`
2525
must be rebuilt to be compatible with this release.
26+
* Release drops support for JDKs 6 + 7, so you'll need at least JDK 8 to
27+
update to use this version.
2628

2729
Release (5.13.0)
2830
================

build-ant-tools.xml

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project name="JNA" default="default" basedir=".">
3+
<import file="common.xml" />
34
<description>Builds and tests JNA</description>
45
<property name="build" value="build" />
56
<target name="default">
@@ -8,6 +9,7 @@
89
destdir="${build}/ant-tools"
910
includeantruntime="false"
1011
encoding="UTF-8"
12+
release="${javac.release}"
1113
>
1214
<src path="src" />
1315
<src path="ant-tools-src" />

build.xml

+15-197
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project name="JNA" default="default" basedir="."
33
xmlns:artifact="antlib:org.apache.maven.artifact.ant"
4-
xmlns:as="antlib:org.codehaus.mojo.animal_sniffer"
54
xmlns:if="ant:if"
65
xmlns:unless="ant:unless">
76
<description>Builds and tests JNA</description>
@@ -13,8 +12,7 @@
1312
support it).
1413
1514
Cross-compile by specifying -Dos.prefix={name-arch} to ant
16-
(cross-compile currently only configured/tested on w32ce-arm and
17-
android targets)
15+
(cross-compile currently only configured/tested on android targets)
1816
1917
Use ANT_OPTS=-D-native=true to build native parts, or directly
2018
invoke the native or test targets
@@ -33,7 +31,7 @@
3331

3432
<!-- global properties -->
3533
<!-- (all build-related props should go in -dynamic-properties) -->
36-
<property name="name" value="jna"/>
34+
<import file="common.xml" />
3735
<property name="jar" value="${name}.jar"/>
3836
<property name="aar" value="${name}.aar"/>
3937
<property name="minjar" value="${name}-min.jar"/>
@@ -55,74 +53,7 @@
5553
<property name="doc" location="doc"/>
5654
<property name="javadoc" location="${doc}/javadoc"/>
5755
<property name="stylesheet" location="${javadoc}/doc/css/javadoc.css"/>
58-
<property name="vendor" value="JNA Development Team"/>
59-
<property name="year" value="2018"/>
60-
<property name="copyright"
61-
value="Copyright &amp;copy; 2007-${year} Timothy Wall. All Rights Reserved."/>
62-
<buildnumber/>
63-
64-
<!-- JNA library release version - android versionCode is derived from mjar/minor/revision -->
65-
<property name="jna.major" value="5"/>
66-
<property name="jna.minor" value="14"/>
67-
<property name="jna.revision" value="0"/>
68-
<property name="jna.build" value="0"/> <!--${build.number}-->
69-
<condition property="version.suffix" value="" else="-SNAPSHOT">
70-
<or>
71-
<isset property="release"/>
72-
<isset property="maven-release"/>
73-
</or>
74-
</condition>
75-
<property name="jna.version" value="${jna.major}.${jna.minor}.${jna.revision}${version.suffix}"/>
76-
<property name="osgi.version" value="${jna.major}.${jna.minor}.${jna.revision}"/>
77-
<!-- jnidispatch library release version -->
78-
<property name="jni.major" value="7"/>
79-
<property name="jni.minor" value="0"/>
80-
<property name="jni.revision" value="0"/>
81-
<property name="jni.build" value="0"/> <!--${build.number}-->
82-
<property name="jni.version" value="${jni.major}.${jni.minor}.${jni.revision}"/>
83-
<property name="jni.md5" value="5fb98531302accd485c534c452dd952a"/>
84-
<property name="spec.title" value="Java Native Access (JNA)"/>
85-
<property name="spec.vendor" value="${vendor}"/>
86-
<property name="spec.version" value="${jna.major}"/>
87-
<property name="impl.title" value="com.sun.jna"/>
88-
<property name="impl.vendor" value="${spec.vendor}"/>
89-
<property name="impl.version" value="${jna.version} (b${jna.build})"/>
90-
91-
<!-- Set up restrictions for w32ce, based on JavaME/CDC -->
92-
<condition property="compatibility" value="1.4">
93-
<equals arg1="${os.prefix}" arg2="w32ce-arm"/>
94-
</condition>
95-
<condition property="test.compatibility" value="1.4">
96-
<equals arg1="${os.prefix}" arg2="w32ce-arm"/>
97-
</condition>
98-
99-
<!--
100-
Default compatibility, 1.6, or whatever version is running
101-
102-
Release builds of JNA target 1.6 and should be build on JDK 8, as JDK 9
103-
introduced changes in the ByteBuffer class, which result in classes, that
104-
can't be loaded on Java 6.
105-
106-
JDK 11 is the last JDK, that supports creation of Java 6 compatible class
107-
files.
108-
-->
109-
<condition property="compatibility" value="1.6" else="9">
110-
<matches pattern="^1\.\d+$" string="${ant.java.version}"/>
111-
</condition>
112-
113-
<condition property="compatibility-check" value="true">
114-
<equals arg1="${compatibility}" arg2="1.6" />
115-
</condition>
116-
117-
<property name="platform.compatibility" value="${compatibility}" />
11856

119-
<!-- JNA tests require at least 1.8 compatiblity -->
120-
<condition property="test.compatibility" value="1.8" else="${compatibility}">
121-
<or>
122-
<equals arg1="${compatibility}" arg2="1.6"/>
123-
<equals arg1="${compatibility}" arg2="1.7"/>
124-
</or>
125-
</condition>
12657
<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,**/WebStartTest.java">
12758
<equals arg1="${os.prefix}" arg2="w32ce-arm"/>
12859
</condition>
@@ -189,19 +120,6 @@
189120
</target>
190121

191122
<target name="-dynamic-properties" depends="-prepare-anttools">
192-
<property name="build.os.name" value="${os.name}"/>
193-
<condition property="build.os.family" value="windows">
194-
<contains string="${build.os.name}" substring="windows" casesensitive="false"/>
195-
</condition>
196-
<condition property="build.os.family" value="mac">
197-
<or>
198-
<contains string="${build.os.name}" substring="darwin" casesensitive="false"/>
199-
<contains string="${build.os.name}" substring="mac" casesensitive="false" />
200-
</or>
201-
</condition>
202-
<property name="build.os.family" value="other"/>
203-
<property name="build.os.arch" value="${os.arch}" />
204-
<property name="build.os.endianess" value="${sun.cpu.endian}" />
205123

206124
<condition property="-native" value="true">
207125
<not><isset property="build-native"/></not>
@@ -238,9 +156,6 @@
238156
<condition property="jar.omitted" value="**/*jnidispatch*" else="jnilib-included">
239157
<isset property="omit-jnilib"/>
240158
</condition>
241-
<condition property="cross-compile" value="true">
242-
<isset property="os.prefix"/>
243-
</condition>
244159

245160
<property name="classes" location="${build}/classes"/>
246161
<property name="eclipse.classes" location="build.eclipse/classes"/>
@@ -256,68 +171,8 @@
256171
/>
257172
<BuildArmSoftFloatDetector targetProperty="build.isArmSoftFloat"/>
258173

259-
<!-- Add other supported platforms here -->
260-
<condition property="jre.arch" value="x86">
261-
<matches pattern="(i[3456]86|pentium)" string="${build.os.arch}"/>
262-
</condition>
263-
<condition property="jre.arch" value="x86-64">
264-
<matches pattern="(x86_64|amd64|em64t)" string="${build.os.arch}"/>
265-
</condition>
266-
<condition property="jre.arch" value="ppc">
267-
<matches pattern="(powerpc|power)" string="${build.os.arch}"/>
268-
</condition>
269-
<condition property="jre.arch" value="ppc64le">
270-
<or>
271-
<matches pattern="(powerpc64le|power64le|ppc64le)" string="${build.os.arch}"/>
272-
<and>
273-
<matches pattern="(powerpc64|power64|ppc64)" string="${build.os.arch}"/>
274-
<matches pattern="little" string="${build.os.endianess}"/>
275-
</and>
276-
</or>
277-
</condition>
278-
<condition property="jre.arch" value="ppc64">
279-
<matches pattern="(powerpc64|power64)" string="${build.os.arch}"/>
280-
</condition>
281-
<condition property="jre.arch" value="armel">
282-
<and>
283-
<matches pattern="arm" string="${build.os.arch}"/>
284-
<matches pattern="true" string="${build.isArmSoftFloat}"/>
285-
</and>
286-
</condition>
287-
288-
<property name="jre.arch" value="${build.os.arch}"/>
289-
290-
<condition property="os.prefix" value="linux-${jre.arch}">
291-
<equals arg1="${build.os.name}" arg2="Linux"/>
292-
</condition>
293-
<condition property="os.prefix" value="aix-${jre.arch}">
294-
<equals arg1="${build.os.name}" arg2="AIX"/>
295-
</condition>
296-
<condition property="os.prefix" value="win32-${jre.arch}">
297-
<equals arg1="${build.os.family}" arg2="windows"/>
298-
</condition>
299-
<condition property="os.prefix" value="darwin-${jre.arch}">
300-
<equals arg1="${build.os.family}" arg2="mac"/>
301-
</condition>
302-
<condition property="os.prefix" value="sunos-${jre.arch}">
303-
<equals arg1="${build.os.name}" arg2="SunOS"/>
304-
</condition>
305-
<condition property="os.prefix" value="freebsd-${jre.arch}">
306-
<equals arg1="${build.os.name}" arg2="FreeBSD"/>
307-
</condition>
308-
<condition property="os.prefix" value="openbsd-${jre.arch}">
309-
<equals arg1="${build.os.name}" arg2="OpenBSD"/>
310-
</condition>
311-
<condition property="os.prefix" value="netbsd-${jre.arch}">
312-
<equals arg1="${build.os.name}" arg2="NetBSD"/>
313-
</condition>
314-
<condition property="os.prefix" value="kfreebsd-${jre.arch}">
315-
<equals arg1="${build.os.name}" arg2="GNU/kFreeBSD"/>
316-
</condition>
317-
<property name="resource.prefix" value="${os.prefix}" description="fallback"/>
318174
<fail unless="os.prefix" message="OS/arch not supported (${os.name}/${jre.arch}), edit build.xml and native/Makefile to add it."/>
319175
<!-- Keep all natives separate -->
320-
<property name="native.subdir" value="native-${os.prefix}"/>
321176
<condition property="jdk.home" value="${java.home}">
322177
<available file="${java.home}/include"/>
323178
</condition>
@@ -352,7 +207,7 @@
352207
<mkdir dir="${doc}"/>
353208
<mkdir dir="${build.aar}"/>
354209

355-
<echo>Java version ${java.version}, compatibility: ${compatibility}, ant: ${ant.java.version}</echo>
210+
<echo>Java version ${java.version}, compatibility: ${javac.release}, ant: ${ant.java.version}</echo>
356211
<echo>JNA version ${jna.version}, native ${jni.version}, android ${android.versionCode}</echo>
357212
<echo>${java.vm.name} (${java.vm.vendor}, ${java.vm.version})</echo>
358213
<echo>java.home=${java.home}</echo>
@@ -406,8 +261,7 @@
406261
replace='VERSION_NATIVE = "${jni.version}";'
407262
file="${build}/jna-src/com/sun/jna/Version.java"/>
408263

409-
<javac source="${compatibility}"
410-
target="${compatibility}"
264+
<javac release="${javac.release}"
411265
destdir="${classes}"
412266
includeantruntime="false"
413267
deprecation="on"
@@ -416,9 +270,7 @@
416270
nativeheaderdir="${build.headers}">
417271
<src location="${build}/jna-src/com/sun/jna" />
418272
</javac>
419-
<javac classpath="${compatibility}"
420-
source="${compatibility}"
421-
target="${compatibility}"
273+
<javac release="${javac.release}"
422274
destdir="${classes}"
423275
includeantruntime="false"
424276
deprecation="on"
@@ -760,19 +612,6 @@ osname=macosx;processor=aarch64
760612

761613
<target name="platform-jar" depends="jar">
762614
<subant target="jar" failonerror="true">
763-
<property name="file.reference.jna.build" location="${build}"/>
764-
<property name="file.reference.jna.jar" location="${build}/${jar}"/>
765-
<property name="libs.junit.classpath" refid="test.libs"/>
766-
<property name="javac.source" value="${platform.compatibility}"/>
767-
<property name="javac.target" value="${platform.compatibility}"/>
768-
<!-- OSGi manifest properties -->
769-
<property name="vendor" value="${vendor}"/>
770-
<property name="impl.title" value="${impl.title}.platform"/>
771-
<property name="impl.version" value="${impl.version}"/>
772-
<property name="spec.title" value="${spec.title}"/>
773-
<property name="spec.vendor" value="${spec.vendor}"/>
774-
<property name="spec.version" value="${spec.version}"/>
775-
<property name="osgi.version" value="${osgi.version}"/>
776615
<fileset dir="${contrib}" includes="platform/build.xml" />
777616
</subant>
778617
<!-- Sources package as required by maven -->
@@ -786,8 +625,9 @@ osname=macosx;processor=aarch64
786625
<property name="file.reference.jna.build" location="${build}"/>
787626
<property name="file.reference.jna.jar" location="${build}/${jar}"/>
788627
<property name="libs.junit.classpath" refid="test.libs"/>
789-
<property name="javac.source" value="${compatibility}" />
790-
<property name="javac.target" value="${compatibility}" />
628+
<property name="javac.source" value="${javac.release}" />
629+
<property name="javac.target" value="${javac.release}" />
630+
<property name="javac.release" value="${javac.release}" />
791631
<fileset dir="${contrib}" includes="*/build.xml" excludes="platform/build.xml"/>
792632
</subant>
793633
</target>
@@ -1189,11 +1029,10 @@ cd ..
11891029
description="Compile test code which does not have additional native
11901030
dependencies">
11911031
<javac classpathref="compile-test.path"
1192-
source="${test.compatibility}"
1193-
target="${test.compatibility}"
1194-
destdir="${test.classes}"
1032+
release="${javac.release}"
11951033
includeantruntime="false"
11961034
includes="**/StructureFieldOrderInspector.java"
1035+
destdir="${test.classes}"
11971036
deprecation="on"
11981037
debug="${debug}"
11991038
encoding="UTF-8"
@@ -1205,8 +1044,7 @@ cd ..
12051044
<target name="compile-tests" depends="compile,native,jar"
12061045
description="Compile all test code">
12071046
<javac classpathref="compile-test.path"
1208-
source="${test.compatibility}"
1209-
target="${test.compatibility}"
1047+
release="${javac.release}"
12101048
destdir="${test.classes}"
12111049
includeantruntime="false"
12121050
excludes="${tests.exclude-patterns}"
@@ -1336,25 +1174,9 @@ cd ..
13361174
<property name="build-native" value="true"/>
13371175
</target>
13381176

1339-
<target name="-check-java6-compatibility" depends="-enable-native,jar,compile-tests" if="compatibility-check" unless="clover">
1340-
<echo>Checking JDK compatibility 1.6</echo>
1341-
1342-
<echo></echo>
1343-
1344-
<as:check-signature signature="lib/java16-1.1.signature">
1345-
<path path="${classes}"/>
1346-
</as:check-signature>
1347-
1348-
<echo></echo>
1349-
</target>
1350-
1351-
<target name="-warn-java6-compatiblity" depends="-enable-native,jar,compile-tests" unless="compatibility-check">
1352-
<echo level="warn">Build is not Java 6 compatible and NOT A PRODUCTION BUILD</echo>
1353-
</target>
1354-
13551177
<!-- When running tests from an IDE, be sure to set jna.library.path -->
13561178
<!-- to where the test library (testlib) is found. -->
1357-
<target name="test" depends="-enable-native,jar,compile-tests,-check-java6-compatibility,-warn-java6-compatiblity" unless="cross-compile"
1179+
<target name="test" depends="-enable-native,jar,compile-tests" unless="cross-compile"
13581180
description="Run all unit tests">
13591181

13601182
<property name="test.fork" value="yes"/>
@@ -1429,12 +1251,8 @@ cd ..
14291251

14301252
<target name="test-platform" depends="compile-some-tests,platform-jar"
14311253
description="Run platform-specific tests">
1432-
<subant target="test" failonerror="true" inheritall="true" inheritrefs="true">
1433-
<property name="file.reference.jna.build" location="${build}"/>
1434-
<property name="file.reference.jna.jar" location="${build}/${jar}"/>
1435-
<property name="libs.junit.classpath" refid="test.libs"/>
1436-
<property name="javac.source" value="${test.compatibility}"/>
1437-
<property name="javac.target" value="${test.compatibility}"/>
1254+
<subant target="test" failonerror="true">
1255+
<property name="javac.release" value="${javac.release}"/>
14381256
<fileset dir="${contrib}" includes="platform/build.xml"/>
14391257
</subant>
14401258
</target>
@@ -1492,7 +1310,7 @@ cd ..
14921310
<doctitle>JNA API Documentation</doctitle>
14931311
<header>${header}</header>
14941312
<bottom>${footer}</bottom>
1495-
<link href="http://download.oracle.com/javase/${compatibility}/docs/api/"/>
1313+
<link href="http://download.oracle.com/javase/${javac.release}/docs/api/"/>
14961314

14971315
<packageset dir="${src}" defaultexcludes="yes">
14981316
<patternset>

0 commit comments

Comments
 (0)