diff --git a/CHANGES.md b/CHANGES.md index 4f83b98db5..cc857dc804 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -14,6 +14,7 @@ Features * [#1482](https://github.com/java-native-access/jna/pull/1482): Add multilingual support of `Kernel32Util.formatMessage` - [@overpathz](https://github.com/overpathz). * [#1490](https://github.com/java-native-access/jna/pull/1490): Adds support for a custom `SymbolProvider` in `NativeLibrary` & `Library` - [@soywiz](https://github.com/soywiz). * [#1491](https://github.com/java-native-access/jna/pull/1491): Update libffi to v3.4.4 - [@matthiasblaesing](https://github.com/matthiasblaesing). +* [#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). Bug Fixes --------- diff --git a/build.xml b/build.xml index 5a45679ceb..f5d6251ee6 100644 --- a/build.xml +++ b/build.xml @@ -73,6 +73,7 @@ + @@ -470,7 +471,17 @@ - + + @@ -761,7 +772,7 @@ osname=macosx;processor=aarch64 - + diff --git a/contrib/platform/build.xml b/contrib/platform/build.xml index 47fa8ed330..167d39cabf 100644 --- a/contrib/platform/build.xml +++ b/contrib/platform/build.xml @@ -145,22 +145,28 @@ + diff --git a/create-export-package-metadata-pom.xml b/create-export-package-metadata-pom.xml new file mode 100644 index 0000000000..2cc5179512 --- /dev/null +++ b/create-export-package-metadata-pom.xml @@ -0,0 +1,44 @@ + + 4.0.0 + + net.java.dev.jna + create-export-package-metadata + 1.0.0 + bundle + + + UTF-8 + + + + ${sourceDirectory} + ${outputDirectory} + + + org.apache.felix + maven-bundle-plugin + 5.1.8 + true + + + ${exportedPackages} + ${importedPackages} + + + + + bundle-manifest + process-classes + + manifest + + + + + + + + diff --git a/create-export-package-metadata.sh b/create-export-package-metadata.sh new file mode 100644 index 0000000000..3806c853c9 --- /dev/null +++ b/create-export-package-metadata.sh @@ -0,0 +1,62 @@ +#!/usr/bin/env sh +set -e + +extract_export_package_value_for_buildxml() { + 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/"/\"/g' +} + +rm -rf tmp + +mkdir tmp + +cp -r src tmp + +mvn \ +-f create-export-package-metadata-pom.xml \ +-DsourceDirectory=tmp/src \ +-DoutputDirectory=tmp/target \ +-DexportedPackages=com.sun.jna,com.sun.jna.ptr,com.sun.jna.win32 \ +clean package + +cp -r contrib/platform/src tmp + +mvn \ +-f create-export-package-metadata-pom.xml \ +-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 \ +clean package + +echo 'build.xml: Export-Package:' +echo +extract_export_package_value_for_buildxml tmp/target/META-INF/MANIFEST.MF +echo +echo + +echo 'contrib/platform/build.xml: Export-Package:' +echo +extract_export_package_value_for_buildxml tmp/target-platform/META-INF/MANIFEST.MF +echo +echo + +rm -r tmp