Skip to content

Commit

Permalink
Improve documentation, ensure osgi.version is defined, wrap create-ex…
Browse files Browse the repository at this point in the history
…port-package-metadata.sh, add CHANGES.md entry
  • Loading branch information
matthiasblaesing committed Dec 25, 2022
1 parent 65cf528 commit 1af6eb1
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
---------
Expand Down
9 changes: 8 additions & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
</or>
</condition>
<property name="jna.version" value="${jna.major}.${jna.minor}.${jna.revision}${version.suffix}"/>
<property name="osgi.version" value="${jna.major}.${jna.minor}.${jna.revision}"/>
<!-- jnidispatch library release version -->
<property name="jni.major" value="6"/>
<property name="jni.minor" value="1"/>
Expand Down Expand Up @@ -470,6 +471,12 @@
<attribute name="Bundle-RequiredExecutionEnvironment" value="JavaSE-1.6"/>
<attribute name="Bundle-Vendor" value="${vendor}"/>
<attribute name="Bundle-ActivationPolicy" value="lazy"/>
<!--
The full "Export-Package" statement can be generated by invoking
create-export-package-metadata-pom.sh in the main folder. This is
necessary if the exported packages change. Then the list in the
shell script needs to be updated as well.
-->
<attribute name="Export-Package" value="
com.sun.jna;version=&quot;${osgi.version}&quot;,
com.sun.jna.ptr;version=&quot;${osgi.version}&quot;;uses:=&quot;com.sun.jna&quot;,
Expand Down Expand Up @@ -765,7 +772,7 @@ osname=macosx;processor=aarch64
<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}"/>
<property name="osgi.version" value="${osgi.version}"/>
<fileset dir="${contrib}" includes="platform/build.xml" />
</subant>
<!-- Sources package as required by maven -->
Expand Down
6 changes: 6 additions & 0 deletions contrib/platform/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@
<attribute name="Bundle-RequiredExecutionEnvironment" value="J2SE-1.4"/>
<attribute name="Bundle-Vendor" value="${vendor}"/>
<attribute name="Require-Bundle" value="com.sun.jna;bundle-version=&quot;${osgi.version}&quot;"/>
<!--
The full "Export-Package" statement can be generated by invoking
create-export-package-metadata-pom.sh in the main folder. This is
necessary if the exported packages change. Then the list in the
shell script needs to be updated as well.
-->
<attribute name="Export-Package"
value="
com.sun.jna.platform;version=&quot;${osgi.version}&quot;;uses:=&quot;com.sun.jna,com.sun.jna.platform.win32&quot;,
Expand Down
41 changes: 38 additions & 3 deletions create-export-package-metadata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,50 @@
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/"/\&quot;/g'
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'
}

rm -rf tmp

mkdir tmp

cp -r src tmp
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

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 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

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
Expand Down

0 comments on commit 1af6eb1

Please sign in to comment.