Skip to content

Commit 9744928

Browse files
committed
ensure native bits get built for 'native' target and for tests
1 parent 9c2aebc commit 9744928

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

TODO

+3-2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@
5151
referenced. (not really common)
5252

5353

54+
* eliminate type conversion contexts; these are almost entirely unused and
55+
more complicated than just wrapping a native mapping in a utility function
56+
* direct non-primitive array arguments (String[], Pointer[], NativeMapped[])
5457

5558
* auto-generate direct mappings/bindings on a per-method basis (perform a
5659
method register on first call to an interface-mapped function) with
@@ -64,12 +67,10 @@
6467
and forth multiple times). This also makes it easer to perform conversions
6568
(no native changes required).
6669

67-
* direct/raw non-primitive array arguments (String[], Pointer[], NativeMapped[])
6870
* ppc64 direct/raw failures (multiple)
6971
* direct calls on ppc to varargs (callbacks) with FP args fail; avoid them for
7072
now
7173
* Callback.PostCallWrite.write() cf PostCallRead
72-
* eliminate type conversion contexts; these are almost entirely unused
7374

7475
* universal GCC build w/cross-compile (needs cross compilers...)
7576
* return Pointer.SIZE/LONG_SIZE/WCHAR_SIZE in bits (for consistency with 1.5)

build.xml

+16-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
(cross-compile currently only configured/tested on w32ce-arm and
1313
android-arm/-x86)
1414
15-
Use ANT_OPTS=-Dskip-native to skip building native parts.
15+
Use ANT_OPTS=-Dskip-native=false to build native parts, or directly
16+
invoke the native or test targets
1617
Use ANT_OPTS=-Dheadless to run tests headless
1718
Use ANT_OPTS=-Drelease to stage a final, non-snapshot version
1819
-->
@@ -78,9 +79,6 @@
7879
<property name="impl.title" value="com.sun.jna"/>
7980
<property name="impl.vendor" value="${spec.vendor}"/>
8081
<property name="impl.version" value="${jna.version} (b${jna.build})"/>
81-
<condition property="jni.valid" value="true">
82-
<isset property="skip-native"/>
83-
</condition>
8482

8583
<!-- Set up restrictions for w32ce, based on JavaME/CDC -->
8684
<condition property="compatibility" value="1.4">
@@ -138,6 +136,13 @@
138136

139137
<target name="-dynamic-properties">
140138

139+
<condition property="-native" value="true">
140+
<not><isset property="build-native"/></not>
141+
</condition>
142+
<condition property="jni.valid" value="true">
143+
<isset property="-native"/>
144+
</condition>
145+
141146
<replaceregexp match="(&lt;version&gt;).*(&lt;/version&gt;)"
142147
replace="\1${jna.version}\2"
143148
file="${pom}"/>
@@ -501,7 +506,7 @@ osname=macosx;processor=x86;processor=x86-64;processor=ppc
501506
</subant>
502507
</target>
503508

504-
<target name="javah" depends="compile" unless="skip-native">
509+
<target name="javah" depends="compile" unless="-native">
505510
<javah classpath="${classes}" destdir="${build.native}" force="yes">
506511
<class name="com.sun.jna.Function"/>
507512
<class name="com.sun.jna.Native"/>
@@ -612,7 +617,7 @@ osname=macosx;processor=x86;processor=x86-64;processor=ppc
612617
file="${rsrc}" byline="true"/>
613618
</target>
614619

615-
<target name="native" depends="-setup,javah,-native-api-check,rsrc" unless="skip-native"
620+
<target name="native" depends="-enable-native,-setup,javah,-native-api-check,rsrc" unless="-native"
616621
description="Build native libraries. Use 'ant -DCC=xxx' to build using a compiler other than gcc">
617622
<property name="comment" value="# auto-generated by ant"/>
618623
<replaceregexp match="^JNA_JNI_VERSION=.*"
@@ -832,9 +837,13 @@ osname=macosx;processor=x86;processor=x86-64;processor=ppc
832837
<chmod file="${shared}/*.dll" perm="+x"/>
833838
</target>
834839

840+
<target name="-enable-native" unless="-native">
841+
<property name="build-native" value="true"/>
842+
</target>
843+
835844
<!-- When running tests from an IDE, be sure to set jna.library.path -->
836845
<!-- to where the test library (testlib) is found. -->
837-
<target name="test" depends="jar,compile-tests" unless="cross-compile"
846+
<target name="test" depends="-enable-native,jar,compile-tests" unless="cross-compile"
838847
description="Run all unit tests">
839848
<property name="test.fork" value="yes"/>
840849
<property name="reports.junit" location="${reports}/junit"/>

0 commit comments

Comments
 (0)