Skip to content

Commit 1af6eb1

Browse files
Improve documentation, ensure osgi.version is defined, wrap create-export-package-metadata.sh, add CHANGES.md entry
1 parent 65cf528 commit 1af6eb1

File tree

4 files changed

+53
-4
lines changed

4 files changed

+53
-4
lines changed

CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Features
1414
* [#1482](https://github.com/java-native-access/jna/pull/1482): Add multilingual support of `Kernel32Util.formatMessage` - [@overpathz](https://github.com/overpathz).
1515
* [#1490](https://github.com/java-native-access/jna/pull/1490): Adds support for a custom `SymbolProvider` in `NativeLibrary` & `Library` - [@soywiz](https://github.com/soywiz).
1616
* [#1491](https://github.com/java-native-access/jna/pull/1491): Update libffi to v3.4.4 - [@matthiasblaesing](https://github.com/matthiasblaesing).
17+
* [#1487](https://github.com/java-native-access/jna/issues/1487): Add 'uses' information to OSGI metadata in MANIFEST.MF to improve stability of package resolution - [@sratz](https://github.com/sratz).
1718

1819
Bug Fixes
1920
---------

build.xml

+8-1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
</or>
7474
</condition>
7575
<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}"/>
7677
<!-- jnidispatch library release version -->
7778
<property name="jni.major" value="6"/>
7879
<property name="jni.minor" value="1"/>
@@ -470,6 +471,12 @@
470471
<attribute name="Bundle-RequiredExecutionEnvironment" value="JavaSE-1.6"/>
471472
<attribute name="Bundle-Vendor" value="${vendor}"/>
472473
<attribute name="Bundle-ActivationPolicy" value="lazy"/>
474+
<!--
475+
The full "Export-Package" statement can be generated by invoking
476+
create-export-package-metadata-pom.sh in the main folder. This is
477+
necessary if the exported packages change. Then the list in the
478+
shell script needs to be updated as well.
479+
-->
473480
<attribute name="Export-Package" value="
474481
com.sun.jna;version=&quot;${osgi.version}&quot;,
475482
com.sun.jna.ptr;version=&quot;${osgi.version}&quot;;uses:=&quot;com.sun.jna&quot;,
@@ -765,7 +772,7 @@ osname=macosx;processor=aarch64
765772
<property name="spec.title" value="${spec.title}"/>
766773
<property name="spec.vendor" value="${spec.vendor}"/>
767774
<property name="spec.version" value="${spec.version}"/>
768-
<property name="osgi.version" value="${jna.major}.${jna.minor}.${jna.revision}"/>
775+
<property name="osgi.version" value="${osgi.version}"/>
769776
<fileset dir="${contrib}" includes="platform/build.xml" />
770777
</subant>
771778
<!-- Sources package as required by maven -->

contrib/platform/build.xml

+6
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,12 @@
145145
<attribute name="Bundle-RequiredExecutionEnvironment" value="J2SE-1.4"/>
146146
<attribute name="Bundle-Vendor" value="${vendor}"/>
147147
<attribute name="Require-Bundle" value="com.sun.jna;bundle-version=&quot;${osgi.version}&quot;"/>
148+
<!--
149+
The full "Export-Package" statement can be generated by invoking
150+
create-export-package-metadata-pom.sh in the main folder. This is
151+
necessary if the exported packages change. Then the list in the
152+
shell script needs to be updated as well.
153+
-->
148154
<attribute name="Export-Package"
149155
value="
150156
com.sun.jna.platform;version=&quot;${osgi.version}&quot;;uses:=&quot;com.sun.jna,com.sun.jna.platform.win32&quot;,

create-export-package-metadata.sh

+38-3
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,50 @@
22
set -e
33

44
extract_export_package_value_for_buildxml() {
5-
sed -z -E 's:\r?\n ::g' "$1" | grep '^Export-Package' | sed 's/^Export-Package: //' | sed 's/",/",\n/g' | sed 's/1\.0\.0/${osgi.version}/g' | sed 's/"/\&quot;/g'
5+
sed -z -E 's:\r?\n ::g' "$1" \
6+
| grep '^Export-Package' \
7+
| sed 's/^Export-Package: //' \
8+
| sed 's/",/",\n/g' \
9+
| sed 's/1\.0\.0/${osgi.version}/g' \
10+
| sed 's/"/\&quot;/g'
611
}
712

813
rm -rf tmp
14+
915
mkdir tmp
16+
1017
cp -r src tmp
11-
mvn -f create-export-package-metadata-pom.xml clean package -DsourceDirectory=tmp/src -DoutputDirectory=tmp/target -DexportedPackages=com.sun.jna,com.sun.jna.ptr,com.sun.jna.win32
18+
19+
mvn \
20+
-f create-export-package-metadata-pom.xml \
21+
-DsourceDirectory=tmp/src \
22+
-DoutputDirectory=tmp/target \
23+
-DexportedPackages=com.sun.jna,com.sun.jna.ptr,com.sun.jna.win32 \
24+
clean package
25+
1226
cp -r contrib/platform/src tmp
13-
mvn -f create-export-package-metadata-pom.xml clean package -DsourceDirectory=tmp/src -DoutputDirectory=tmp/target-platform -DexportedPackages=com.sun.jna.platform,com.sun.jna.platform.dnd,com.sun.jna.platform.linux,com.sun.jna.platform.mac,com.sun.jna.platform.unix,com.sun.jna.platform.unix.aix,com.sun.jna.platform.unix.solaris,com.sun.jna.platform.win32,com.sun.jna.platform.win32.COM,com.sun.jna.platform.win32.COM.tlb,com.sun.jna.platform.win32.COM.tlb.imp,com.sun.jna.platform.win32.COM.util,com.sun.jna.platform.win32.COM.util.annotation,com.sun.jna.platform.wince -DimportedPackages=com.sun.jna,com.sun.jna.ptr,com.sun.jna.win32
27+
28+
mvn \
29+
-f create-export-package-metadata-pom.xml \
30+
-DsourceDirectory=tmp/src \
31+
-DoutputDirectory=tmp/target-platform \
32+
-DexportedPackages=\
33+
com.sun.jna.platform,\
34+
com.sun.jna.platform.dnd,\
35+
com.sun.jna.platform.linux,\
36+
com.sun.jna.platform.mac,\
37+
com.sun.jna.platform.unix,\
38+
com.sun.jna.platform.unix.aix,\
39+
com.sun.jna.platform.unix.solaris,\
40+
com.sun.jna.platform.win32,\
41+
com.sun.jna.platform.win32.COM,\
42+
com.sun.jna.platform.win32.COM.tlb,\
43+
com.sun.jna.platform.win32.COM.tlb.imp,\
44+
com.sun.jna.platform.win32.COM.util,\
45+
com.sun.jna.platform.win32.COM.util.annotation,\
46+
com.sun.jna.platform.wince \
47+
-DimportedPackages=com.sun.jna,com.sun.jna.ptr,com.sun.jna.win32 \
48+
clean package
1449

1550
echo 'build.xml: Export-Package:'
1651
echo

0 commit comments

Comments
 (0)