[Git][java-team/hawtjni][upstream] New upstream version 1.17
Emmanuel Bourg
gitlab at salsa.debian.org
Thu Jul 18 10:25:28 BST 2019
Emmanuel Bourg pushed to branch upstream at Debian Java Maintainers / hawtjni
Commits:
913d348c by Emmanuel Bourg at 2019-07-11T21:52:43Z
New upstream version 1.17
- - - - -
29 changed files:
- changelog.md
- hawtjni-example/pom.xml
- hawtjni-example/src/main/java/test/Example.java
- hawtjni-example/src/main/native-package/src/foo.c
- hawtjni-example/src/main/native-package/src/foo.h
- hawtjni-generator/pom.xml
- hawtjni-generator/src/main/java/org/fusesource/hawtjni/generator/NativesGenerator.java
- hawtjni-generator/src/main/java/org/fusesource/hawtjni/generator/StructsGenerator.java
- hawtjni-generator/src/main/java/org/fusesource/hawtjni/generator/model/JNIField.java
- + hawtjni-generator/src/main/java/org/fusesource/hawtjni/generator/model/JNIFieldAccessor.java
- hawtjni-generator/src/main/java/org/fusesource/hawtjni/generator/model/ReflectField.java
- + hawtjni-generator/src/main/java/org/fusesource/hawtjni/generator/model/ReflectFieldAccessor.java
- hawtjni-maven-plugin/pom.xml
- hawtjni-maven-plugin/src/main/java/org/fusesource/hawtjni/maven/BuildMojo.java
- hawtjni-maven-plugin/src/main/java/org/fusesource/hawtjni/maven/GenerateMojo.java
- hawtjni-maven-plugin/src/main/resources/project-template/m4/osx-universal.m4
- hawtjni-maven-plugin/src/main/resources/project-template/readme.md
- + hawtjni-maven-plugin/src/main/resources/project-template/vs2010.custom.props
- hawtjni-maven-plugin/src/main/resources/project-template/vs2010.vcxproj
- hawtjni-runtime/pom.xml
- hawtjni-runtime/src/main/java/org/fusesource/hawtjni/runtime/FieldFlag.java
- hawtjni-runtime/src/main/java/org/fusesource/hawtjni/runtime/JniField.java
- hawtjni-runtime/src/main/java/org/fusesource/hawtjni/runtime/Library.java
- hawtjni-website/ext/Website.scala
- hawtjni-website/pom.xml
- hawtjni-website/src/documentation/developer-guide.md
- hawtjni-website/src/index.page
- pom.xml
- readme.md
Changes:
=====================================
changelog.md
=====================================
@@ -1,89 +1,143 @@
-#![HawtJNI](http://fusesource.github.io/hawtjni/images/project-logo.png)
-
-## [HawtJNI 1.15](http://fusesource.github.io/hawtjni/blog/releases/release-1-15.html), released 2017-05-xx
-
-906cedb Default to extract in the users' home folder in case the temp directory is not writable
-ed95784 search in library.$name.path like in META-INF/native resources
-477c8cc Fix some other problems with platform, especially on windows when compiling for the non native platform
-58834e8 Upgrade some plugins
-992ee3f Fix bad naming for the extracted file when the version contains a dot
-6b58328 Do not include the extension in the windows project name, #23
-9165154 Merge pull request #30 from felixvf/fix_lib64_bug
-1cb6770 Merge pull request #34 from hboutemy/master
-4c430c6 Merge pull request #20 from felixvf/fix_bug_18
-f99972b Better exception reporting when unable to load a library, fixes #27
-1c5b81f Allow the windows project name to be specified, fixes #23
-ef3437c Allow the -Dplatform=xxx setting to be used when doing the actual native build
-0072848 Remove explicit array creation when using var args
-c6fb914 Remove unused imports
-145f3ee Fix typos in method names
-81a35e1 prepare gh-pages publication with scm-publish plugin
-b3982d5 Use latest version of maven javadoc plugin
-cb2ad85 Merge branch 'hboutemy-hawtjni-31'
-cd20329 #31 fixed API doc generation and misc other Maven-related conf
-784a50f Fix libdir to "/lib". Prevent any variation such as "/lib64".
-401ce1c Update readme.md
-a73fc16 Merge pull request #11 from OhmData/travis
-098c501 Simplify the fallback case a bit
-40f9f23 Merge pull request #22 from slaunay/use-java7-chmod-with-unix-chmod-fallback
+# ![HawtJNI](http://fusesource.github.io/hawtjni/images/project-logo.png)
+
+## HawtJNI 1.17, released 2019-04-03
+
+* [`1c4a17b`](https://github.com/fusesource/hawtjni/commit/1c4a17b31bf988f99df6da7085f86829b935c342) Remove shared_ptr support until it's working
+* [`d3f9d0a`](https://github.com/fusesource/hawtjni/commit/d3f9d0ab71fd25d8d6f6eb9c3de6c6b47ddae92e) Keep (long*) for standard pointers
+* [`906aa15`](https://github.com/fusesource/hawtjni/commit/906aa158c24d3603aca6f3766b7fa0da306d23d6) Merge branch 'calin-iorgulescu-master'
+* [`c5130eb`](https://github.com/fusesource/hawtjni/commit/c5130eb900279531f67d4734ccf1ad2f2ad95a70) Fix typo
+* [`9d38df2`](https://github.com/fusesource/hawtjni/commit/9d38df2f4a25ee55fbb0dc921fb2004b33c59541) Merge branch 'master' of https://github.com/calin-iorgulescu/hawtjni into calin-iorgulescu-master
+* [`1c42406`](https://github.com/fusesource/hawtjni/commit/1c42406ec55ed1955d2fc573e3002e5fa557c984) Merge branch 'master' of https://github.com/batterseapower/hawtjni into batterseapower-master
+* [`55afd36`](https://github.com/fusesource/hawtjni/commit/55afd361a8fe44d4d6126de30b279c5b941894ba) Add 10.14 in OSX SDK version list
+* [`d094c95`](https://github.com/fusesource/hawtjni/commit/d094c95e7fd0fb879f896b49c796a92adee72369) Merge pull request #45 from wjsl/osx10.13
+* [`d028542`](https://github.com/fusesource/hawtjni/commit/d028542040a23e090633ab0b192ca9c08f7838e2) Merge pull request #48 from castortech/master
+* [`c0cfb25`](https://github.com/fusesource/hawtjni/commit/c0cfb2558b8e11edd224f08fd7da6daa84876b34) Merge branch 'master' into master
+* [`73e0b4f`](https://github.com/fusesource/hawtjni/commit/73e0b4f68d4597295bcb6d0196a1c030ff14589a) Merge pull request #55 from tdemande/hawtjni-issue-54
+* [`ec9cc6c`](https://github.com/fusesource/hawtjni/commit/ec9cc6c3ce72b7fcd99d356f1abbc0f36fbb9a29) Merge branch 'hawtjni_shared_pointer' of https://github.com/ossdev07/hawtjni into ossdev07-hawtjni_shared_pointer
+* [`bd514b7`](https://github.com/fusesource/hawtjni/commit/bd514b71878415e7091b914420a291310de3ec30) Implement a different strategy with sha1 checksum for extracting libraries, fixes #56
+* [`40e0b2f`](https://github.com/fusesource/hawtjni/commit/40e0b2f27a2218b4d10ae3989a4ed74bcf40562d) Formatting
+* [`bc3f187`](https://github.com/fusesource/hawtjni/commit/bc3f187087a043caa6737a78c10f982159bd8c2c) #54 Also search in base dir when finding/extracting native lib
+* [`8f464d0`](https://github.com/fusesource/hawtjni/commit/8f464d07bc9a807acf33f0f2e355065471f15235) Implement new JNIField accessor model: allow support for separate getter/setter methods for individual fields.
+* [`5f52fee`](https://github.com/fusesource/hawtjni/commit/5f52fee5720c5cbeeaae71cfaa90611bcba56e8d) StructsGenerator: Fix bug where a JniClass extending another class that has only ignored fields would generate calls to cache the fields.
+* [`2b88a8f`](https://github.com/fusesource/hawtjni/commit/2b88a8f56fdbbf0e71b213f15b333a681e7dc72f) StructsGenerator: Fix bug where an empty field declaration would be created if only skipped fields are declared in a struct.
+* [`235f0b9`](https://github.com/fusesource/hawtjni/commit/235f0b985acba4559cfda588a0312287f9420791) Change maven settings to allow building.
+* [`839ddcf`](https://github.com/fusesource/hawtjni/commit/839ddcf2bff9e53020f162feeac7258ea6ac97db) added icon for hawtjni-runtime artifact in Central
+* [`27af76b`](https://github.com/fusesource/hawtjni/commit/27af76b5f73af61ef592cc66ed65fb12438cc166) Update StructsGenerator.java
+* [`f29f849`](https://github.com/fusesource/hawtjni/commit/f29f84960133e5a5740bcd6b6120b8bb7f172f0d) added Automatic-Module-Name to manifest for Java 9 auto-module name
+* [`1c2d511`](https://github.com/fusesource/hawtjni/commit/1c2d511d970ad07924ebdbb1e8566fb56e2edf6c) Hawtjni: Shared_pointer support added in hawtjni
+* [`7a6082f`](https://github.com/fusesource/hawtjni/commit/7a6082faed85ea73945065466e68ad6035cf724d) fixed typo
+* [`35c061c`](https://github.com/fusesource/hawtjni/commit/35c061ca7ffedb11fa52a18c8c087a41bbb5cd88) added Runtime API as a feature
+* [`6c1f140`](https://github.com/fusesource/hawtjni/commit/6c1f140970a59727a102b8ee2daef909eb991b78) Added customization for the Windows build.
+* [`98b1531`](https://github.com/fusesource/hawtjni/commit/98b1531628f236aa9a68fd49b67ac09f1b547868) Added missing case of "no directory" as per method documentation.
+* [`a103c50`](https://github.com/fusesource/hawtjni/commit/a103c50b1b1b357d6a5d932cac7ebc599bb0d16b) Added support to detect newer versions of Visual Studio as candidates for msbuild
+* [`6f891af`](https://github.com/fusesource/hawtjni/commit/6f891af96768e77f5e800fd0f723712b87e30735) Updated documentation to clearly indicate the vcbuild is deprecated and that msbuild is supported.
+* [`84aa381`](https://github.com/fusesource/hawtjni/commit/84aa381836dae2b784ea685b71c54c6eb6622646) update changelog.md for 1.16 release
+* [`3fffa67`](https://github.com/fusesource/hawtjni/commit/3fffa67c2b23f92a1c57552e3779c58382795855) fixed and improved changelog.md formatting
+* [`2c7134b`](https://github.com/fusesource/hawtjni/commit/2c7134b4ee612af788d8486181459580811ba1d6) Add 10.13 in OSX SDK version list
+
+## HawtJNI 1.16, released 2018-02-02
+
+* [`2e99592`](https://github.com/fusesource/hawtjni/commit/2e99592f7be976a935beeed7d7395d4a5787e04e) fixed site build
+* [`14f1d05`](https://github.com/fusesource/hawtjni/commit/14f1d0564d6e2c71c74288e537fcfa4acf7f4c18) renamed maven-hawtjni-plugin to hawtjni-maven-plugin
+* [`743d57b`](https://github.com/fusesource/hawtjni/commit/743d57b25337dc1e0b5dcfc7dce63b15a4433f78) switched Maven plugin from javadoc annotations to Java5 annotations
+* [`4a42ee6`](https://github.com/fusesource/hawtjni/commit/4a42ee611ad66c71a6d4b32d41b78ca02ca225e4) [#36](http://github.com/fusesource/hawtjni/issues/36) added info on loaded native library
+* [`16c5d82`](https://github.com/fusesource/hawtjni/commit/16c5d820e84864fe437ce77a33011b50b2a6f66d) Merge pull request [#37](http://github.com/fusesource/hawtjni/issues/37) from ghost/patch-1
+* [`45e8a55`](https://github.com/fusesource/hawtjni/commit/45e8a557788a8dbf9fd134df6f8e99f456e3324f) [#43](http://github.com/fusesource/hawtjni/issues/43) mark HawtJNI annotations @Documented
+* [`f0c3b54`](https://github.com/fusesource/hawtjni/commit/f0c3b547aeecd508498871583595ab7adff54ea3) s/your/you're/
+
+## [HawtJNI 1.15](http://fusesource.github.io/hawtjni/blog/releases/release-1-15.html), released 2017-05-04
+
+* [`7537b9d`](https://github.com/fusesource/hawtjni/commit/7537b9d19be9806b210674ccad4b96d90a11d50b) Update changelog
+* [`906cedb`](https://github.com/fusesource/hawtjni/commit/906cedb80b9661d0ea08f524fb464243610653a9) Default to extract in the users' home folder in case the temp directory is not writable
+* [`ed95784`](https://github.com/fusesource/hawtjni/commit/ed95784f9a4d3ed1afb0a14bd3dccc815d3e3cbe) search in library.$name.path like in META-INF/native resources
+* [`477c8cc`](https://github.com/fusesource/hawtjni/commit/477c8ccac78c3695ebcf6299d8b201adb3394d34) Fix some other problems with platform, especially on windows when compiling for the non native platform
+* [`58834e8`](https://github.com/fusesource/hawtjni/commit/58834e835c6f196f6188c6f35aa9c349db610d84) Upgrade some plugins
+* [`992ee3f`](https://github.com/fusesource/hawtjni/commit/992ee3fa28f30823913fe95a790fe3a08d19bdf3) Fix bad naming for the extracted file when the version contains a dot
+* [`6b58328`](https://github.com/fusesource/hawtjni/commit/6b58328635bd181c18048387aa7d83fda51d5be8) Do not include the extension in the windows project name, [#23](http://github.com/fusesource/hawtjni/issues/23)
+* [`9165154`](https://github.com/fusesource/hawtjni/commit/916515413152d2b25268d0f813c1f0f411388b3a) Merge pull request [#30](http://github.com/fusesource/hawtjni/issues/30) from felixvf/fix_lib64_bug
+* [`1cb6770`](https://github.com/fusesource/hawtjni/commit/1cb6770dc7348958d96b38d8d0b1f4b065f43da5) Merge pull request [#34](http://github.com/fusesource/hawtjni/issues/34) from hboutemy/master
+* [`4c430c6`](https://github.com/fusesource/hawtjni/commit/4c430c6d4454b37e035c1fb7ae284b8d3ac99c03) Merge pull request [#20](http://github.com/fusesource/hawtjni/issues/20) from felixvf/fix_bug_18
+* [`f99972b`](https://github.com/fusesource/hawtjni/commit/f99972b7892fd621dca1442b8c8f3234edd4b02f) Better exception reporting when unable to load a library, fixes [#27](http://github.com/fusesource/hawtjni/issues/27)
+* [`1c5b81f`](https://github.com/fusesource/hawtjni/commit/1c5b81fb386f74e47e776f3ba2775d15003f2ae9) Allow the windows project name to be specified, fixes [#23](http://github.com/fusesource/hawtjni/issues/23)
+* [`ef3437c`](https://github.com/fusesource/hawtjni/commit/ef3437cde117c04793d773b25bd0627e5e260e66) Allow the -Dplatform=xxx setting to be used when doing the actual native build
+* [`0072848`](https://github.com/fusesource/hawtjni/commit/0072848253e100c98745725bdf5224e63103fad7) Remove explicit array creation when using var args
+* [`c6fb914`](https://github.com/fusesource/hawtjni/commit/c6fb9149b43292564bbc854d9942d4898a7f728d) Remove unused imports
+* [`145f3ee`](https://github.com/fusesource/hawtjni/commit/145f3ee50204c8b8f8ae728cc91533dd19424d7d) Fix typos in method names
+* [`81a35e1`](https://github.com/fusesource/hawtjni/commit/81a35e1a923bb1c7b0e6ffbdd66a08c83e119324) prepare gh-pages publication with scm-publish plugin
+* [`b3982d5`](https://github.com/fusesource/hawtjni/commit/b3982d573b04878918aebe5435a5f64af6a4401f) Use latest version of maven javadoc plugin
+* [`cb2ad85`](https://github.com/fusesource/hawtjni/commit/cb2ad85bc551e1628be25181acd6f9e97e04afab) Merge branch 'hboutemy-hawtjni-31'
+* [`cd20329`](https://github.com/fusesource/hawtjni/commit/cd20329a801e5d904d7a43c46d3cb150b4767b66) [#31](http://github.com/fusesource/hawtjni/issues/31) fixed API doc generation and misc other Maven-related conf
+* [`784a50f`](https://github.com/fusesource/hawtjni/commit/784a50f22d0abd1d4fa05f1fb720e70623092e63) Fix libdir to "/lib". Prevent any variation such as "/lib64".
+* [`401ce1c`](https://github.com/fusesource/hawtjni/commit/401ce1cc6f053fccae386977b695ae7a5948ef4d) Update readme.md
+* [`a73fc16`](https://github.com/fusesource/hawtjni/commit/a73fc165306a139e8cbb82f9dc28002c05d6d206) Merge pull request [#11](http://github.com/fusesource/hawtjni/issues/11) from OhmData/travis
+* [`098c501`](https://github.com/fusesource/hawtjni/commit/098c501c90feb20749105840eaca1f51fbae2559) Simplify the fallback case a bit
+* [`40f9f23`](https://github.com/fusesource/hawtjni/commit/40f9f23b4839941e217a8415eb9799aa539e0e36) Merge pull request [#22](http://github.com/fusesource/hawtjni/issues/22) from slaunay/use-java7-chmod-with-unix-chmod-fallback
## [HawtJNI 1.14](http://fusesource.github.io/hawtjni/blog/releases/release-1.14.html), released 2016-06-20
-e2522b0 Merge pull request #26 from michael-o/freebsd
-6dc93fe Improve FreeBSD support
+* [`e2522b0`](https://github.com/fusesource/hawtjni/commit/e2522b0ddd9f8975dc3a1cc99534ea458b807ddd) Merge pull request [#26](http://github.com/fusesource/hawtjni/issues/26) from michael-o/freebsd
+* [`6dc93fe`](https://github.com/fusesource/hawtjni/commit/6dc93fe4c3b67e68d9805b6f0cc7f2b7c36d5b06) Improve FreeBSD support
+* [`2d49307`](https://github.com/fusesource/hawtjni/commit/2d493076d264f6d8e2ac81ada4da4fcd78b2dabf) Deploy to sonatype.
## [HawtJNI 1.12](http://fusesource.github.io/hawtjni/blog/releases/release-1.12.html), released 2016-04-26
-70f24ba Don't build the website by default.
-ef93152 Better JDK detection on OS X.
-61ac652 Use Files.setPosixFilePermissions for chmod
-57e5b32 Define JNI64 not only in case of \__x86_64__ but in general for any _LP64 platform.
+* [`70f24ba`](https://github.com/fusesource/hawtjni/commit/70f24ba7438a698d8e1e0de599b304774e01f5d4) Don't build the website by default.
+* [`ef93152`](https://github.com/fusesource/hawtjni/commit/ef931527b4ca915a53c59eb6f6ef0222f8cf3c12) Better JDK detection on OS X.
+* [`61ac652`](https://github.com/fusesource/hawtjni/commit/61ac6525a42117f0ea8820417d00616ef7f27452) Use Files.setPosixFilePermissions for chmod
+* [`57e5b32`](https://github.com/fusesource/hawtjni/commit/57e5b3262a86ac0541585f3b3a40bf3b8933561b) Define JNI64 not only in case of \_\_x86\_64\_\_ but in general for any \_LP64 platform.
## [HawtJNI 1.11](http://fusesource.github.io/hawtjni/blog/releases/release-1.11.html), released 2015-04-21
-e1da91a Update xbean version used.
-354e277 Disable deployment of website since web host is not there anymore.
-08cfdd0 Update parent pom.
-86e97d1 Merge pull request #19 from jerrydlamme/master
-1e2ee63 Added architecture specific native library loading path
-d10c4b0 Merge pull request #16 from NJAldwin/use-absolute-path
-3d3aa0b Ensure absolute path is used for library
-8c28532 Merge pull request #13 from batterseapower/master
-c10adf5 Version bumps and markup fixes necessary for building on JDK8
-aed6cbd Build a stock travis
+* [`e1da91a`](https://github.com/fusesource/hawtjni/commit/e1da91aec68eda9f40350b062c4fed4e75fb4cb1) Update xbean version used.
+* [`354e277`](https://github.com/fusesource/hawtjni/commit/354e2773cfb60008fd7500eef52ea7de8e9bb74a) Disable deployment of website since web host is not there anymore.
+* [`08cfdd0`](https://github.com/fusesource/hawtjni/commit/08cfdd0995bb298d88e87d559d2ce39018e6b509) Update parent pom.
+* [`86e97d1`](https://github.com/fusesource/hawtjni/commit/86e97d161d956009bbc92f2913dd570ece2ec3da) Merge pull request [#19](http://github.com/fusesource/hawtjni/issues/19) from jerrydlamme/master
+* [`1e2ee63`](https://github.com/fusesource/hawtjni/commit/1e2ee6330f6832a374e29b78a1fff2df62d4a52c) Added architecture specific native library loading path
+* [`d10c4b0`](https://github.com/fusesource/hawtjni/commit/d10c4b0914301810297f0f917ce3dba3e8868ff1) Merge pull request [#16](http://github.com/fusesource/hawtjni/issues/16) from NJAldwin/use-absolute-path
+* [`3d3aa0b`](https://github.com/fusesource/hawtjni/commit/3d3aa0be17cc8d35e251ea3594b1e684ce919d0d) Ensure absolute path is used for library
+* [`8c28532`](https://github.com/fusesource/hawtjni/commit/8c2853238e31b6e92f61fbdeda84314e5a529254) Merge pull request [#13](http://github.com/fusesource/hawtjni/issues/13) from batterseapower/master
+* [`c10adf5`](https://github.com/fusesource/hawtjni/commit/c10adf5139969f1bfa6cb6e8dd6af204d64280a9) Version bumps and markup fixes necessary for building on JDK8
+* [`aed6cbd`](https://github.com/fusesource/hawtjni/commit/aed6cbd06b4579170617dae7146ec9c61b70d82c) Build a stock travis
+* [`efa684c`](https://github.com/fusesource/hawtjni/commit/efa684c0a87136f16b0bca67bc518ee9bf698f85) Ignore IDEA project files.
+* [`18cb7e5`](https://github.com/fusesource/hawtjni/commit/18cb7e5d98e0edf687ba2d02c724c36d631e9f65) prepare for next development iteration
+* [`f3bd38e`](https://github.com/fusesource/hawtjni/commit/f3bd38e1d83a5563c63b1bbebadf0c77c1fb54b8) Upgrade parent pom version.
+* [`175faf0`](https://github.com/fusesource/hawtjni/commit/175faf07fbc2ec1c42582d0b935bb05fd46fc33f) Merge pull request [#8](http://github.com/fusesource/hawtjni/issues/8) from normanmaurer/netty\_needs
+* [`b3f8609`](https://github.com/fusesource/hawtjni/commit/b3f8609c6682bda6d6c112c2e19c0c6cdc6dcfc6) Allow to also use generate mojo with existing native src files
+* [`c27b5a0`](https://github.com/fusesource/hawtjni/commit/c27b5a0c4640bce9437488275b0d8c360c45c1e6) Avoid warning.
+* [`c1980ef`](https://github.com/fusesource/hawtjni/commit/c1980ef32387547b0a5bba408abb00cbceaf6705) Add support for building against the Oracle JDK on OS X.
## [HawtJNI 1.10](http://fusesource.github.io/hawtjni/blog/releases/release-1.10.html), released 2014-02-12
-efa684c Ignore IDEA project files.
-18cb7e5 prepare for next development iteration
-f3bd38e Upgrade parent pom version.
-175faf0 Merge pull request #8 from normanmaurer/netty_needs
-b3f8609 Allow to also use generate mojo with existing native src files
-c27b5a0 Avoid warning.
-c1980ef Add support for building against the Oracle JDK on OS X.
+* `efa684c` Ignore IDEA project files.
+* `18cb7e5` prepare for next development iteration
+* `f3bd38e` Upgrade parent pom version.
+* `175faf0` Merge pull request [#8](http://github.com/fusesource/hawtjni/issues/8) from normanmaurer/netty\_needs
+* `b3f8609` Allow to also use generate mojo with existing native src files
+* `c27b5a0` Avoid warning.
+* `c1980ef` Add support for building against the Oracle JDK on OS X.
## [HawtJNI 1.9](http://fusesource.github.io/hawtjni/blog/releases/release-1-9.html), released 2013-09-09
-* Fix issue #7. We now do a write barrier before setting the 'cached' field to 1 so that reader don't see this get re-ordered before all the fields are readable.
-* Improve the auto generated build systems for windows/OS X
+* [`1d27b2f`](https://github.com/fusesource/hawtjni/commit/1d27b2f1396920be7fce0be8b1995ac0459c69ef) Improve the generated build settings.
+* [`d9cd0ab`](https://github.com/fusesource/hawtjni/commit/d9cd0ab660ac5acbdc5f84c806ba14b77e197385) Should fix issue [#7](http://github.com/fusesource/hawtjni/issues/7). We now do a write barrier before setting the 'cached' field to 1 so that reader don't see this get re-ordered before all the fields are readable.
## [HawtJNI 1.8](http://fusesource.github.io/hawtjni/blog/releases/release-1-8.html), released 2013-05-13
-* Improved shared lib extraction logic.
+* [`92c2661`](https://github.com/fusesource/hawtjni/commit/92c266170ce98edc200c656bd034a237098b8aa5) Simplify shared lib extraction.
## [HawtJNI 1.7](http://fusesource.github.io/hawtjni/blog/releases/release-1-7.html), released 2013-03-20
-* Support explicitly configuring which build tool to use on windows.
-* Fix for automake 1.11
+* [`3567b1d`](https://github.com/fusesource/hawtjni/commit/3567b1d89d458bddb651df252f3bb275c9076e1a) Support explicitly configuring which build tool to use on windows.
+* [`d566bf7`](https://github.com/fusesource/hawtjni/commit/d566bf7de5d6a67fa7c7b3e04352ca2630fb55fe) Fix for automake 1.11
## [HawtJNI 1.6](http://fusesource.github.io/hawtjni/blog/releases/release-1-6.html), released 2012-08-09
-* Updating hawtjni generate projects so that they work on OS X Lion.
-* Fixes issue #2 : Support passing the JNIEnv pointer to native methods.
+* [`11df668`](https://github.com/fusesource/hawtjni/commit/11df668cb0d1269c0f98d9c09d80c56cf0770421) Updating hawtjni generate projects so that they work on OS X Lion.
+* [`f0e3ace`](https://github.com/fusesource/hawtjni/commit/f0e3ace6422e5c5413445229ac79d27f68b1485b) Fixes [#2](http://github.com/fusesource/hawtjni/issues/2) : Support passing the JNIEnv pointer to native methods.
## [HawtJNI 1.5](http://fusesource.github.io/hawtjni/blog/releases/release-1-5.html), released 2011-09-21
-* Only include config.h if it's available.
+* [`15d5b1a`](https://github.com/fusesource/hawtjni/commit/15d5b1a4c928fb8c39eee0705316478af30704b5) Only include config.h if it's available.
## [HawtJNI 1.4](http://fusesource.github.io/hawtjni/blog/releases/release-1-4.html), released 2011-08-18
=====================================
hawtjni-example/pom.xml
=====================================
@@ -21,7 +21,7 @@
<parent>
<groupId>org.fusesource.hawtjni</groupId>
<artifactId>hawtjni-project</artifactId>
- <version>1.16</version>
+ <version>1.17</version>
</parent>
<artifactId>hawtjni-example</artifactId>
=====================================
hawtjni-example/src/main/java/test/Example.java
=====================================
@@ -222,6 +222,9 @@ public class Example {
@JniField(cast="struct foo *")
public long prev;
+ @JniField(getter = "get_d()", setter = "set_d()", flags = { GETTER_NONMEMBER, SETTER_NONMEMBER })
+ private float d;
+
@Override
public int hashCode() {
final int prime = 31;
@@ -231,6 +234,7 @@ public class Example {
result = prime * result + Arrays.hashCode(c);
result = prime * result + c5;
result = prime * result + (int) (prev ^ (prev >>> 32));
+ result = prime * result + Float.valueOf(d).hashCode();
return result;
}
@@ -253,12 +257,15 @@ public class Example {
return false;
if (prev != other.prev)
return false;
+ if (d != other.d) {
+ return false;
+ }
return true;
}
@Override
public String toString() {
- return "foo [a=" + a + ", b=" + b + ", c=" + Arrays.toString(c) + ", c5=" + c5 + ", prev=" + prev + "]";
+ return "foo [a=" + a + ", b=" + b + ", c=" + Arrays.toString(c) + ", c5=" + c5 + ", prev=" + prev + ", d=" + d + "]";
}
}
@@ -282,7 +289,7 @@ public class Example {
@JniMethod(cast = "char *")
public static final native long char_add(@JniArg(cast="char *")long ptr, int count);
- @JniClass(flags={ClassFlag.STRUCT, ClassFlag.TYPEDEF})
+ @JniClass(flags={ClassFlag.STRUCT, ClassFlag.TYPEDEF})
static public class point {
static {
LIBRARY.load();
@@ -326,4 +333,15 @@ public class Example {
public static final native void passingtheenv (String msg, JNIEnv env);
+ @JniClass(flags={ClassFlag.STRUCT})
+ static class ClassWithAccessors {
+ static {
+ LIBRARY.load();
+ }
+
+ @JniField(getter = "get_e()", setter = "set_e()")
+ private float e;
+
+
+ }
}
=====================================
hawtjni-example/src/main/native-package/src/foo.c
=====================================
@@ -9,8 +9,14 @@
#include "foo.h"
#include <stdio.h>
+float get_d(struct foo *arg) {
+ return 0.0f;
+}
+void set_d(struct foo *arg, float d) {
+}
+
void print_foo(struct foo *arg) {
- printf("foo@%p: { a: %d, b: %d, c: \"%s\", prev: @%p}\n", arg, arg->a, (int)arg->b, arg->c, arg->prev);
+ printf("foo@%p: { a: %d, b: %d, c: \"%s\", prev: @%p, d: %f}\n", arg, arg->a, (int)arg->b, arg->c, arg->prev, get_d(arg));
}
long foowork(struct foo **arg, int count) {
=====================================
hawtjni-example/src/main/native-package/src/foo.h
=====================================
@@ -20,7 +20,7 @@ struct foo {
int a;
size_t b;
char c[20];
- struct foo *prev;
+ struct foo *prev;
};
typedef struct _point {
@@ -28,6 +28,19 @@ typedef struct _point {
int y;
} point;
+struct ClassWithAccessors {
+ float e;
+
+ float (*get_e)();
+ void (*set_e)(float e);
+};
+
+float get_d(struct foo *arg);
+void set_d(struct foo *arg, float d);
+
+float ClassWithAccessors_get_e(struct foo *arg);
+void ClassWithAccessors_set_e(struct foo *arg, float e);
+
struct foo * foo_add(struct foo *arg, int count);
char * char_add(char *arg, int count);
=====================================
hawtjni-generator/pom.xml
=====================================
@@ -21,7 +21,7 @@
<parent>
<groupId>org.fusesource.hawtjni</groupId>
<artifactId>hawtjni-project</artifactId>
- <version>1.16</version>
+ <version>1.17</version>
</parent>
<artifactId>hawtjni-generator</artifactId>
=====================================
hawtjni-generator/src/main/java/org/fusesource/hawtjni/generator/NativesGenerator.java
=====================================
@@ -16,6 +16,7 @@ import java.util.List;
import org.fusesource.hawtjni.generator.model.JNIClass;
import org.fusesource.hawtjni.generator.model.JNIField;
+import org.fusesource.hawtjni.generator.model.JNIFieldAccessor;
import org.fusesource.hawtjni.generator.model.JNIMethod;
import org.fusesource.hawtjni.generator.model.JNIParameter;
import org.fusesource.hawtjni.generator.model.JNIType;
@@ -189,9 +190,7 @@ public class NativesGenerator extends JNIGenerator {
boolean allowConversion = !type.equals(type64);
String simpleName = type.getSimpleName();
- String accessor = field.getAccessor();
- if (accessor == null || accessor.length() == 0)
- accessor = field.getName();
+ JNIFieldAccessor accessor = field.getAccessor();
String fieldId = "(*env)->GetStaticFieldID(env, that, \""+field.getName()+"\", \""+type.getTypeSignature(allowConversion)+"\")";
if (isCPP) {
@@ -208,7 +207,7 @@ public class NativesGenerator extends JNIGenerator {
if( field.isPointer() ) {
output("(intptr_t)");
}
- output(accessor);
+ output(accessor.getter());
output(");");
} else if (type.isArray()) {
@@ -238,7 +237,7 @@ public class NativesGenerator extends JNIGenerator {
} else {
output("ArrayRegion(env, lpObject1, 0, sizeof(");
}
- output(accessor);
+ output(accessor.getter());
output(")");
if (!componentType.isType("byte")) {
output(" / sizeof(");
@@ -248,7 +247,7 @@ public class NativesGenerator extends JNIGenerator {
output(", (");
output(type.getTypeSignature4(allowConversion, false));
output(")");
- output(accessor);
+ output(accessor.getter());
outputln(");");
output("\t}");
} else {
@@ -268,7 +267,7 @@ public class NativesGenerator extends JNIGenerator {
output("\tif (lpObject1 != NULL) set");
output(simpleName);
output("Fields(env, lpObject1, &lpStruct->");
- output(accessor);
+ output(accessor.getter());
outputln(");");
output("\t}");
}
=====================================
hawtjni-generator/src/main/java/org/fusesource/hawtjni/generator/StructsGenerator.java
=====================================
@@ -12,10 +12,12 @@ package org.fusesource.hawtjni.generator;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import org.fusesource.hawtjni.generator.model.JNIClass;
import org.fusesource.hawtjni.generator.model.JNIField;
+import org.fusesource.hawtjni.generator.model.JNIFieldAccessor;
import org.fusesource.hawtjni.generator.model.JNIType;
import org.fusesource.hawtjni.runtime.ClassFlag;
@@ -29,6 +31,8 @@ public class StructsGenerator extends JNIGenerator {
static final boolean GLOBAL_REF = false;
+ private HashMap<JNIClass, ArrayList<JNIField>> structFields = new HashMap<JNIClass, ArrayList<JNIField>>();
+
public StructsGenerator(boolean header) {
this.header = header;
}
@@ -60,15 +64,19 @@ public class StructsGenerator extends JNIGenerator {
}
private ArrayList<JNIField> getStructFields(JNIClass clazz) {
- ArrayList<JNIField> rc = new ArrayList<JNIField>();
- List<JNIField> fields = clazz.getDeclaredFields();
- for (JNIField field : fields) {
- int mods = field.getModifiers();
- if ( (mods & Modifier.STATIC) == 0 && (mods & Modifier.TRANSIENT) == 0) {
- rc.add(field);
+ if (!structFields.containsKey(clazz)) {
+ ArrayList<JNIField> rc = new ArrayList<JNIField>();
+ List<JNIField> fields = clazz.getDeclaredFields();
+ for (JNIField field : fields) {
+ int mods = field.getModifiers();
+ if ((mods & Modifier.STATIC) == 0 && (mods & Modifier.TRANSIENT) == 0) {
+ rc.add(field);
+ }
}
+
+ structFields.put(clazz, rc);
}
- return rc;
+ return structFields.get(clazz);
}
void generateHeaderFile(JNIClass clazz) {
@@ -165,13 +173,14 @@ public class StructsGenerator extends JNIGenerator {
outputln("_FID_CACHE {");
outputln("\tint cached;");
outputln("\tjclass clazz;");
- output("\tjfieldID ");
List<JNIField> fields = clazz.getDeclaredFields();
boolean first = true;
for (JNIField field : fields) {
if (ignoreField(field))
continue;
- if (!first)
+ if (first)
+ output("\tjfieldID ");
+ else
output(", ");
output(field.getName());
first = false;
@@ -193,7 +202,7 @@ public class StructsGenerator extends JNIGenerator {
output(simpleName);
outputln("Fc.cached) return;");
JNIClass superclazz = clazz.getSuperclass();
- if (!superclazz.getName().equals("java.lang.Object")) {
+ if (!superclazz.getName().equals("java.lang.Object") && hasNonIgnoredFields(superclazz)) {
String superName = superclazz.getSimpleName();
output("\tcache");
output(superName);
@@ -252,7 +261,8 @@ public class StructsGenerator extends JNIGenerator {
JNIClass superclazz = clazz.getSuperclass();
String clazzName = clazz.getNativeName();
String superName = superclazz.getNativeName();
- if (!superclazz.getName().equals("java.lang.Object")) {
+ String methodname;
+ if (!superclazz.getName().equals("java.lang.Object") && hasNonIgnoredFields(superclazz)) {
/*
* Windows exception - cannot call get/set function of super class
* in this case
@@ -277,15 +287,22 @@ public class StructsGenerator extends JNIGenerator {
}
JNIType type = field.getType(), type64 = field.getType64();
String simpleName = type.getSimpleName();
- String accessor = field.getAccessor();
- if (accessor == null || accessor.length() == 0)
- accessor = field.getName();
+ JNIFieldAccessor accessor = field.getAccessor();
+ output("\t");
if (type.isPrimitive()) {
- output("\tlpStruct->");
- output(accessor);
- output(" = ");
+ if (!accessor.isNonMemberSetter())
+ output("lpStruct->");
+ if (accessor.isMethodSetter()) {
+ String setterStart = accessor.setter().split("\\(")[0];
+ output(setterStart + "(");
+ if (accessor.isNonMemberSetter())
+ output("lpStruct, ");
+ } else {
+ output(accessor.setter());
+ output(" = ");
+ }
output(field.getCast());
- if( field.isPointer() ) {
+ if (field.isPointer()) {
output("(intptr_t)");
}
if (isCPP) {
@@ -302,11 +319,13 @@ public class StructsGenerator extends JNIGenerator {
output(field.getDeclaringClass().getSimpleName());
output("Fc.");
output(field.getName());
+ if (accessor.isMethodSetter())
+ output(")");
output(");");
} else if (type.isArray()) {
JNIType componentType = type.getComponentType(), componentType64 = type64.getComponentType();
if (componentType.isPrimitive()) {
- outputln("\t{");
+ outputln("{");
output("\t");
output(type.getTypeSignature2(!type.equals(type64)));
output(" lpObject1 = (");
@@ -327,11 +346,13 @@ public class StructsGenerator extends JNIGenerator {
}
output(componentType.getTypeSignature1(!componentType.equals(componentType64)));
if (isCPP) {
- output("ArrayRegion(lpObject1, 0, sizeof(lpStruct->");
+ output("ArrayRegion(lpObject1, 0, sizeof(");
} else {
- output("ArrayRegion(env, lpObject1, 0, sizeof(lpStruct->");
+ output("ArrayRegion(env, lpObject1, 0, sizeof(");
}
- output(accessor);
+ if (!accessor.isNonMemberGetter())
+ output("lpStruct->");
+ output(accessor.getter());
output(")");
if (!componentType.isType("byte")) {
output(" / sizeof(");
@@ -340,8 +361,10 @@ public class StructsGenerator extends JNIGenerator {
}
output(", (");
output(type.getTypeSignature4(!type.equals(type64), false));
- output(")lpStruct->");
- output(accessor);
+ output(")");
+ if (!accessor.isNonMemberGetter())
+ output("lpStruct->");
+ output(accessor.getter());
outputln(");");
output("\t}");
} else {
@@ -361,7 +384,7 @@ public class StructsGenerator extends JNIGenerator {
output("\tif (lpObject1 != NULL) get");
output(simpleName);
output("Fields(env, lpObject1, &lpStruct->");
- output(accessor);
+ output(accessor.getter());
outputln(");");
output("\t}");
}
@@ -405,7 +428,7 @@ public class StructsGenerator extends JNIGenerator {
JNIClass superclazz = clazz.getSuperclass();
String clazzName = clazz.getNativeName();
String superName = superclazz.getNativeName();
- if (!superclazz.getName().equals("java.lang.Object")) {
+ if (!superclazz.getName().equals("java.lang.Object") && hasNonIgnoredFields(superclazz)) {
/*
* Windows exception - cannot call get/set function of super class
* in this case
@@ -432,9 +455,7 @@ public class StructsGenerator extends JNIGenerator {
boolean allowConversion = !type.equals(type64);
String simpleName = type.getSimpleName();
- String accessor = field.getAccessor();
- if (accessor == null || accessor.length() == 0)
- accessor = field.getName();
+ JNIFieldAccessor accessor = field.getAccessor();
if (type.isPrimitive()) {
if (isCPP) {
output("\tenv->Set");
@@ -455,7 +476,17 @@ public class StructsGenerator extends JNIGenerator {
if( field.isPointer() ) {
output("(intptr_t)");
}
- output("lpStruct->"+accessor);
+ if (!accessor.isNonMemberGetter())
+ output("lpStruct->");
+ if (accessor.isMethodGetter()) {
+ String getterStart = accessor.getter().split("\\(")[0];
+ output(getterStart + "(");
+ if (accessor.isNonMemberGetter())
+ output("lpStruct");
+ output(")");
+ } else {
+ output(accessor.getter());
+ }
output(");");
} else if (type.isArray()) {
JNIType componentType = type.getComponentType(), componentType64 = type64.getComponentType();
@@ -481,11 +512,21 @@ public class StructsGenerator extends JNIGenerator {
}
output(componentType.getTypeSignature1(!componentType.equals(componentType64)));
if (isCPP) {
- output("ArrayRegion(lpObject1, 0, sizeof(lpStruct->");
+ output("ArrayRegion(lpObject1, 0, sizeof(");
+ } else {
+ output("ArrayRegion(env, lpObject1, 0, sizeof(");
+ }
+ if (!accessor.isNonMemberGetter())
+ output("lpStruct->");
+ if (accessor.isMethodGetter()) {
+ String getterStart = accessor.getter().split("\\(")[0];
+ output(getterStart + "(");
+ if (accessor.isNonMemberGetter())
+ output("lpStruct");
+ output(")");
} else {
- output("ArrayRegion(env, lpObject1, 0, sizeof(lpStruct->");
+ output(accessor.getter());
}
- output(accessor);
output(")");
if (!componentType.isType("byte")) {
output(" / sizeof(");
@@ -494,8 +535,10 @@ public class StructsGenerator extends JNIGenerator {
}
output(", (");
output(type.getTypeSignature4(allowConversion, false));
- output(")lpStruct->");
- output(accessor);
+ output(")");
+ if (!accessor.isNonMemberGetter())
+ output("lpStruct->");
+ output(accessor.getter());
outputln(");");
output("\t}");
} else {
@@ -515,7 +558,7 @@ public class StructsGenerator extends JNIGenerator {
output("\tif (lpObject1 != NULL) set");
output(simpleName);
output("Fields(env, lpObject1, &lpStruct->");
- output(accessor);
+ output(accessor.getter());
outputln(");");
output("\t}");
}
@@ -560,4 +603,10 @@ public class StructsGenerator extends JNIGenerator {
return field.ignore() || ((mods & Modifier.FINAL) != 0) || ((mods & Modifier.STATIC) != 0);
}
+ boolean hasNonIgnoredFields(JNIClass clazz) {
+ for (JNIField field : getStructFields(clazz))
+ if (!ignoreField(field)) return true;
+ return false;
+ }
+
}
=====================================
hawtjni-generator/src/main/java/org/fusesource/hawtjni/generator/model/JNIField.java
=====================================
@@ -27,7 +27,7 @@ public interface JNIField {
public JNIType getType64();
public JNIClass getDeclaringClass();
- public String getAccessor();
+ public JNIFieldAccessor getAccessor();
public String getCast();
public String getConditional();
public boolean ignore();
=====================================
hawtjni-generator/src/main/java/org/fusesource/hawtjni/generator/model/JNIFieldAccessor.java
=====================================
@@ -0,0 +1,19 @@
+package org.fusesource.hawtjni.generator.model;
+
+/**
+ * @author <a href="mailto:calin.iorgulescu at gmail.com">Calin Iorgulescu</a>
+ */
+public interface JNIFieldAccessor {
+ public String getter();
+
+ public String setter();
+
+ public boolean isNonMemberGetter();
+
+ public boolean isNonMemberSetter();
+
+ public boolean isMethodGetter();
+
+ public boolean isMethodSetter();
+
+}
=====================================
hawtjni-generator/src/main/java/org/fusesource/hawtjni/generator/model/ReflectField.java
=====================================
@@ -14,6 +14,7 @@ import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.HashSet;
+import org.apache.commons.lang.StringUtils;
import org.fusesource.hawtjni.runtime.FieldFlag;
import org.fusesource.hawtjni.runtime.JniField;
import org.fusesource.hawtjni.runtime.T32;
@@ -33,6 +34,7 @@ public class ReflectField implements JNIField {
private JniField annotation;
private HashSet<FieldFlag> flags;
private boolean allowConversion;
+ private ReflectFieldAccessor accessor;
public ReflectField(ReflectClass parent, Field field) {
this.parent = parent;
@@ -78,8 +80,8 @@ public class ReflectField implements JNIField {
return type.asType64(allowConversion);
}
- public String getAccessor() {
- return annotation == null ? "" : annotation.accessor();
+ public JNIFieldAccessor getAccessor() {
+ return accessor;
}
public String getCast() {
@@ -95,7 +97,7 @@ public class ReflectField implements JNIField {
if( annotation == null ) {
return false;
}
- return getFlag(POINTER_FIELD) || ( type.getWrappedClass() == Long.TYPE && getCast().endsWith("*)") );
+ return getFlag(POINTER_FIELD) || ( type.getWrappedClass() == Long.TYPE && getCast().endsWith("*") );
}
public String getConditional() {
@@ -128,8 +130,19 @@ public class ReflectField implements JNIField {
this.type = new ReflectType(field.getType());
this.annotation = this.field.getAnnotation(JniField.class);
this.flags = new HashSet<FieldFlag>();
+ this.accessor = new ReflectFieldAccessor(this.field.getName());
if( this.annotation!=null ) {
this.flags.addAll(Arrays.asList(this.annotation.flags()));
+ if (!StringUtils.isEmpty(this.annotation.accessor())) {
+ this.accessor = new ReflectFieldAccessor(this.annotation.accessor());
+ } else if (!StringUtils.isEmpty(this.annotation.getter()) &&
+ !StringUtils.isEmpty(this.annotation.setter())) {
+ this.accessor = new ReflectFieldAccessor(
+ this.annotation.getter(),
+ this.flags.contains(GETTER_NONMEMBER),
+ this.annotation.setter(),
+ this.flags.contains(SETTER_NONMEMBER));
+ }
}
allowConversion = this.field.getAnnotation(T32.class)!=null;
=====================================
hawtjni-generator/src/main/java/org/fusesource/hawtjni/generator/model/ReflectFieldAccessor.java
=====================================
@@ -0,0 +1,48 @@
+package org.fusesource.hawtjni.generator.model;
+
+/**
+ * @author <a href="mailto:calin.iorgulescu at gmail.com">Calin Iorgulescu</a>
+ */
+public class ReflectFieldAccessor implements JNIFieldAccessor {
+
+ private String getter;
+ private String setter;
+ private boolean nonMemberGetter;
+ private boolean nonMemberSetter;
+
+ public ReflectFieldAccessor(String value) {
+ this.getter = this.setter = value;
+ this.nonMemberGetter = this.nonMemberSetter = false;
+ }
+
+ public ReflectFieldAccessor(String getter, boolean nonMemberGetter, String setter, boolean nonMemberSetter) {
+ this.getter = getter;
+ this.nonMemberGetter = nonMemberGetter;
+ this.setter = setter;
+ this.nonMemberSetter = nonMemberSetter;
+ }
+
+ public String getter() {
+ return getter;
+ }
+
+ public String setter() {
+ return setter;
+ }
+
+ public boolean isNonMemberGetter() {
+ return nonMemberGetter;
+ }
+
+ public boolean isNonMemberSetter() {
+ return nonMemberSetter;
+ }
+
+ public boolean isMethodGetter() {
+ return getter.contains("(");
+ }
+
+ public boolean isMethodSetter() {
+ return setter.contains("(");
+ }
+}
=====================================
hawtjni-maven-plugin/pom.xml
=====================================
@@ -21,7 +21,7 @@
<parent>
<groupId>org.fusesource.hawtjni</groupId>
<artifactId>hawtjni-project</artifactId>
- <version>1.16</version>
+ <version>1.17</version>
</parent>
<artifactId>hawtjni-maven-plugin</artifactId>
=====================================
hawtjni-maven-plugin/src/main/java/org/fusesource/hawtjni/maven/BuildMojo.java
=====================================
@@ -258,7 +258,9 @@ public class BuildMojo extends AbstractMojo {
if( vcinstalldir!=null ) {
if( vcinstalldir.contains("Microsoft Visual Studio 10") ||
vcinstalldir.contains("Microsoft Visual Studio 11") ||
- vcinstalldir.contains("Microsoft Visual Studio 12")
+ vcinstalldir.contains("Microsoft Visual Studio 12") ||
+ vcinstalldir.contains("Microsoft Visual Studio 14") ||
+ vcinstalldir.contains("Microsoft Visual Studio\\2017")
) {
useMSBuild = true;
}
@@ -286,8 +288,6 @@ public class BuildMojo extends AbstractMojo {
}
}
-
-
File libFile=FileUtils.resolveFile(buildDir, "target/"+platform+"-"+configuration+"/lib/"+library.getLibraryFileName());
if( !libFile.exists() ) {
throw new MojoExecutionException("vcbuild did not generate: "+libFile);
@@ -318,7 +318,7 @@ public class BuildMojo extends AbstractMojo {
File distDirectory = new File(buildDir, "target");
File distLibDirectory = new File(distDirectory, "lib");
- distLibDirectory.mkdirs();
+ distLibDirectory.mkdirs();
if( autogen.exists() && !skipAutogen ) {
if( (!configure.exists() && !CLI.IS_WINDOWS) || forceAutogen ) {
=====================================
hawtjni-maven-plugin/src/main/java/org/fusesource/hawtjni/maven/GenerateMojo.java
=====================================
@@ -148,7 +148,7 @@ public class GenerateMojo extends AbstractMojo {
/**
* The build tool to use on Windows systems. Set
- * to 'msbuild', 'vcbuild', or 'detect'
+ * to 'msbuild', 'vcbuild', or 'detect' or 'none'
*/
@Parameter(defaultValue = "detect")
private String windowsBuildTool;
@@ -160,6 +160,33 @@ public class GenerateMojo extends AbstractMojo {
*/
@Parameter
private String windowsProjectName;
+
+ /**
+ * Set this value to true to include the import of a custom properties file in your vcxproj (not applicable
+ * to vs2008). This greatly simplifies the configurability of your project.
+ */
+ @Parameter(defaultValue = "false")
+ private boolean windowsCustomProps;
+
+ /**
+ * The tools version used in the header of your vcxproj (not applicable to vs2008).
+ */
+ @Parameter(defaultValue = "4.0")
+ private String windowsToolsVersion;
+
+ /**
+ * The target platform version used in your vcxproj (not applicable to vs2008).
+ * Not supplied by default.
+ */
+ @Parameter
+ private String windowsTargetPlatformVersion;
+
+ /**
+ * The platform toolset version used in your vcxproj (not applicable to vs2008).
+ * Not supplied by default.
+ */
+ @Parameter
+ private String windowsPlatformToolset;
private File targetSrcDir;
@@ -235,8 +262,14 @@ public class GenerateMojo extends AbstractMojo {
if( "detect".equals(tool) ) {
copyTemplateResource("vs2008.vcproj", (windowsProjectName != null ? windowsProjectName : "vs2008") + ".vcproj", true);
copyTemplateResource("vs2010.vcxproj", (windowsProjectName != null ? windowsProjectName : "vs2010") + ".vcxproj", true);
+ if (windowsCustomProps) {
+ copyTemplateResource("vs2010.custom.props", (windowsProjectName != null ? windowsProjectName : "vs2010") + ".custom.props", true);
+ }
} else if( "msbuild".equals(tool) ) {
copyTemplateResource("vs2010.vcxproj", (windowsProjectName != null ? windowsProjectName : "vs2010") + ".vcxproj", true);
+ if (windowsCustomProps) {
+ copyTemplateResource("vs2010.custom.props", (windowsProjectName != null ? windowsProjectName : "vs2010") + ".custom.props", true);
+ }
} else if( "vcbuild".equals(tool) ) {
copyTemplateResource("vs2008.vcproj", (windowsProjectName != null ? windowsProjectName : "vs2008") + ".vcproj", true);
} else if( "none".equals(tool) ) {
@@ -340,8 +373,8 @@ public class GenerateMojo extends AbstractMojo {
}
sources += " src/"+f;
- xml_sources+=" <File RelativePath=\".\\src\\"+ (f.replace('/', '\\')) +"\"/>\n";
- vs10_sources+=" <ClCompile Include=\".\\src\\"+ (f.replace('/', '\\')) +"\"/>\n";
+ xml_sources+=" <File RelativePath=\".\\src\\"+ (f.replace('/', '\\')) +"\" />\n";
+ vs10_sources+=" <ClCompile Include=\".\\src\\"+ (f.replace('/', '\\')) +"\" />\n"; //VS adds trailing space and eases compares
}
if( cpp_files.isEmpty() ) {
@@ -353,8 +386,16 @@ public class GenerateMojo extends AbstractMojo {
values.put("PROJECT_SOURCES", sources);
values.put("PROJECT_XML_SOURCES", xml_sources);
values.put("PROJECT_VS10_SOURCES", vs10_sources);
-
- FileUtils.FilterWrapper wrapper = new FileUtils.FilterWrapper() {
+
+ values.put("CUSTOM_PROPS", windowsCustomProps ? "<Import Project=\"" +
+ (windowsProjectName != null ? windowsProjectName : "vs2010") + ".custom.props\" />" : "");
+ values.put("TOOLS_VERSION", windowsToolsVersion);
+ values.put("TARGET_PLATFORM_VERSION", windowsTargetPlatformVersion != null ?
+ "<WindowsTargetPlatformVersion>" + windowsTargetPlatformVersion + "</WindowsTargetPlatformVersion>" : "");
+ values.put("PLATFORM_TOOLSET", windowsPlatformToolset != null ?
+ "<PlatformToolset>" + windowsPlatformToolset + "</PlatformToolset>" : "");
+
+ FileUtils.FilterWrapper wrapper = new FileUtils.FilterWrapper() {
public Reader getReader(Reader reader) {
StringSearchInterpolator propertiesInterpolator = new StringSearchInterpolator(startExp, endExp);
propertiesInterpolator.addValueSource(new MapBasedValueSource(values));
=====================================
hawtjni-maven-plugin/src/main/resources/project-template/m4/osx-universal.m4
=====================================
@@ -53,7 +53,7 @@ AC_DEFUN([WITH_OSX_UNIVERSAL],
],[
OSX_SDKS_DIR=""
OSX_VERSION=""
- for v in 10.0 10.1 10.2 10.3 10.4 10.5 10.6 10.7 10.8 10.9 10.10 10.11 10.12; do
+ for v in 10.0 10.1 10.2 10.3 10.4 10.5 10.6 10.7 10.8 10.9 10.10 10.11 10.12 10.13 10.14; do
for location in "/Developer/SDKs" "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs" ; do
if test -z "${OSX_VERSION}" && test -d "${location}/MacOSX${v}.sdk" ; then
OSX_SDKS_DIR="${location}"
=====================================
hawtjni-maven-plugin/src/main/resources/project-template/readme.md
=====================================
@@ -42,11 +42,16 @@ all the headers, libraries, and build tools needed to compile the JNI library.
Set the `JAVA_HOME` environment variable to the location where your JDK is
installed.
-Use the "Start>All Programs>Microsoft Windows SDK vX.X>CMD" command window
-and change to the directory that this file is located in and then run:
+Use the installed command window and change to the directory that this file is located in and then run:
- vcbuild vs2008.vcproj
+For recent SDK Versions:
+
+ msbuild vs2010.vcxproj (or )
+
+For legacy SDK Versions:
+
+ vcbuild vs2008.vcproj
The dll files will be located under the target directory.
-[1]: http://www.microsoft.com/downloads/details.aspx?FamilyID=c17ba869-9671-4330-a63e-1fd44e0e2505
\ No newline at end of file
+[1]: https://developer.microsoft.com/en-us/windows/downloads
\ No newline at end of file
=====================================
hawtjni-maven-plugin/src/main/resources/project-template/vs2010.custom.props
=====================================
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <!--
+ # This is just a stub. If you wish to customize your vs2010.vcxproj
+ # just copy this file to src/main/native-package/vs2010.custom.props
+ # then replace add your msbuild statements here.
+ <ItemDefinitionGroup>
+ <ClCompile>
+ <AdditionalIncludeDirectories>$(ProjectDir)\my-headers;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(ProjectDir)\libmylibrary.a;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ -->
+</Project>
\ No newline at end of file
=====================================
hawtjni-maven-plugin/src/main/resources/project-template/vs2010.vcxproj
=====================================
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- msbuild vs2008.vcxproj -->
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project DefaultTargets="Build" ToolsVersion="@TOOLS_VERSION@" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="debug|Win32">
<Configuration>debug</Configuration>
@@ -22,24 +22,29 @@
<PropertyGroup Label="Globals">
<ProjectName>@PROJECT_NAME@</ProjectName>
<RootNamespace>@PROJECT_NAME@</RootNamespace>
+ @TARGET_PLATFORM_VERSION@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
+ @PLATFORM_TOOLSET@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
+ @PLATFORM_TOOLSET@
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
+ @PLATFORM_TOOLSET@
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
+ @PLATFORM_TOOLSET@
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
@@ -73,6 +78,7 @@
<IntDir Condition="'$(Configuration)|$(Platform)'=='debug|x64'">$(ProjectDir)/target/$(Platform)-$(Configuration)/obj\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='debug|x64'">true</LinkIncremental>
</PropertyGroup>
+ @CUSTOM_PROPS@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\src\windows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
=====================================
hawtjni-runtime/pom.xml
=====================================
@@ -21,15 +21,26 @@
<parent>
<groupId>org.fusesource.hawtjni</groupId>
<artifactId>hawtjni-project</artifactId>
- <version>1.16</version>
+ <version>1.17</version>
</parent>
<artifactId>hawtjni-runtime</artifactId>
<name>HawtJNI Runtime</name>
<description>The API that projects using HawtJNI should build against.</description>
-
+
<build>
- <plugins>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Automatic-Module-Name>org.fusesource.hawtjni.runtime</Automatic-Module-Name>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
@@ -42,7 +53,7 @@
</execution>
</executions>
</plugin>
- </plugins>
+ </plugins>
</build>
</project>
=====================================
hawtjni-runtime/src/main/java/org/fusesource/hawtjni/runtime/FieldFlag.java
=====================================
@@ -31,5 +31,22 @@ public enum FieldFlag {
* Indicate that the field is a pointer.
*/
POINTER_FIELD,
-
-}
\ No newline at end of file
+
+ /**
+ * Indicate that the getter method used is not part of
+ * the structure. Useful for using wrappers to access
+ * certain structure fields.
+ *
+ * Only useful when the getter is declared explicitly.
+ */
+ GETTER_NONMEMBER,
+
+ /**
+ * Indicate that the setter method used is not part of
+ * the structure. Useful for using wrappers to access
+ * certain structure fields.
+ *
+ * Only useful when the setter is declared explicitly.
+ */
+ SETTER_NONMEMBER,
+}
=====================================
hawtjni-runtime/src/main/java/org/fusesource/hawtjni/runtime/JniField.java
=====================================
@@ -27,6 +27,8 @@ public @interface JniField {
String cast() default "";
String accessor() default "";
+ String getter() default "";
+ String setter() default "";
String conditional() default "";
FieldFlag[] flags() default {};
=====================================
hawtjni-runtime/src/main/java/org/fusesource/hawtjni/runtime/Library.java
=====================================
@@ -12,6 +12,8 @@ package org.fusesource.hawtjni.runtime;
import java.io.*;
import java.lang.reflect.Method;
import java.net.URL;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Set;
@@ -80,8 +82,15 @@ import java.util.Set;
*/
public class Library {
+ public static final String STRATEGY_PROPERTY = "hawtjni.strategy";
+ public static final String STRATEGY_SHA1 = "sha1";
+ public static final String STRATEGY_TEMP = "temp";
+
static final String SLASH = System.getProperty("file.separator");
+ static final String STRATEGY = System.getProperty(STRATEGY_PROPERTY,
+ "windows".equals(getOperatingSystem()) ? STRATEGY_SHA1 : STRATEGY_TEMP);
+
final private String name;
final private String version;
final private ClassLoader classLoader;
@@ -288,7 +297,8 @@ public class Library {
return new String[] {
getPlatform() + "/" + System.getProperty("os.arch"),
getPlatform(),
- getOperatingSystem()
+ getOperatingSystem(),
+ "."
};
}
@@ -310,7 +320,12 @@ public class Library {
file(System.getProperty("user.home"), ".hawtjni", name))) {
if( path!=null ) {
// Try to extract it to the custom path...
- File target = extract(errors, resource, prefix, suffix, path);
+ File target;
+ if (STRATEGY_SHA1.equals(STRATEGY)) {
+ target = extractSha1(errors, resource, prefix, suffix, path);
+ } else {
+ target = extractTemp(errors, resource, prefix, suffix, path);
+ }
if( target!=null ) {
if( load(errors, target) ) {
nativeLibrarySourceUrl = resource;
@@ -348,7 +363,81 @@ public class Library {
return libName;
}
- private File extract(ArrayList<Throwable> errors, URL source, String prefix, String suffix, File directory) {
+ private File extractSha1(ArrayList<Throwable> errors, URL source, String prefix, String suffix, File directory) {
+ File target = null;
+ directory = directory.getAbsoluteFile();
+ if (!directory.exists()) {
+ if (!directory.mkdirs()) {
+ errors.add(new IOException("Unable to create directory: " + directory));
+ return null;
+ }
+ }
+ try {
+ String sha1 = computeSha1(source.openStream());
+ String sha1f = "";
+ target = new File(directory, prefix + sha1 + suffix);
+
+ if (target.isFile() && target.canRead()) {
+ sha1f = computeSha1(new FileInputStream(target));
+ }
+ if (sha1f.equals(sha1)) {
+ return target;
+ }
+
+ FileOutputStream os = null;
+ InputStream is = null;
+ try {
+ is = source.openStream();
+ if (is != null) {
+ byte[] buffer = new byte[4096];
+ os = new FileOutputStream(target);
+ int read;
+ while ((read = is.read(buffer)) != -1) {
+ os.write(buffer, 0, read);
+ }
+ chmod755(target);
+ }
+ return target;
+ } finally {
+ close(os);
+ close(is);
+ }
+ } catch (Throwable e) {
+ IOException io;
+ if (target != null) {
+ target.delete();
+ io = new IOException("Unable to extract library from " + source + " to " + target);
+ } else {
+ io = new IOException("Unable to create temporary file in " + directory);
+ }
+ io.initCause(e);
+ errors.add(io);
+ }
+ return null;
+ }
+
+ private String computeSha1(InputStream is) throws NoSuchAlgorithmException, IOException {
+ String sha1;
+ try {
+ MessageDigest mDigest = MessageDigest.getInstance("SHA1");
+ int read;
+ byte[] buffer = new byte[4096];
+ while ((read = is.read(buffer)) != -1) {
+ mDigest.update(buffer, 0, read);
+ }
+ byte[] result = mDigest.digest();
+ StringBuilder sb = new StringBuilder();
+ for (byte b : result) {
+ sb.append(Integer.toString((b & 0xff) + 0x100, 16).substring(1));
+ }
+ sha1 = sb.toString();
+ } finally {
+ close(is);
+ }
+ return sha1;
+ }
+
+ private File extractTemp(ArrayList<Throwable> errors, URL source, String prefix, String suffix, File directory) {
File target = null;
directory = directory.getAbsoluteFile();
if (!directory.exists()) {
@@ -380,7 +469,7 @@ public class Library {
}
} catch (Throwable e) {
IOException io;
- if( target!=null ) {
+ if (target != null) {
target.delete();
io = new IOException("Unable to extract library from " + source + " to " + target);
} else {
@@ -393,7 +482,7 @@ public class Library {
}
static private void close(Closeable file) {
- if(file!=null) {
+ if (file != null) {
try {
file.close();
} catch (Exception ignore) {
=====================================
hawtjni-website/ext/Website.scala
=====================================
@@ -35,7 +35,7 @@ object Website {
val project_wiki_url= "https://github.com/fusesource/hawtjni/wiki"
val project_logo= "/images/project-logo.png"
val project_version= "1.16"
- val project_snapshot_version= "1.16-SNAPSHOT"
+ val project_snapshot_version= "1.17-SNAPSHOT"
val project_versions = List(
project_version,
"1.15",
=====================================
hawtjni-website/pom.xml
=====================================
@@ -22,7 +22,7 @@
<parent>
<groupId>org.fusesource.hawtjni</groupId>
<artifactId>hawtjni-project</artifactId>
- <version>1.16-SNAPSHOT</version>
+ <version>1.16</version>
</parent>
<artifactId>hawtjni-website</artifactId>
=====================================
hawtjni-website/src/documentation/developer-guide.md
=====================================
@@ -68,7 +68,7 @@ If you are not familiar with Maven, please checkout
[Maven by Example](http://www.sonatype.com/books/mvnex-book/reference/public-book.html).
The easiest way to get started with HawtJNI is copy and use
-[the example Maven project](http://github.com/fusersource/hawtjni/tree/master/hawtjni-example/) as a template for your module.
+[the example Maven project](http://github.com/fusesource/hawtjni/tree/master/hawtjni-example/) as a template for your module.
At the root of the Maven project run:
{pygmentize:: text}
@@ -800,13 +800,12 @@ Download and install the free [Microsoft Windows SDK][ms_sdk]. The SDK includes
all the headers, libraries, and build tools needed to compile the JNI library.
Set the `JAVA_HOME` environment variable to the location where your JDK is
-installed.
+installed.
-Make sure the `vcbuild` tool is on in your system PATH. The simplest way
-to use SDK command prompt by following the following menu choices:
-`Start > All Programs > Microsoft Windows SDK ... > CMD`
+Make sure the `msbuild` (`vcbuild` for legacy SDK versions) tool is on in your system PATH. The simplest way
+is to use SDK command prompt.
-[ms_sdk]: http://www.microsoft.com/downloads/details.aspx?FamilyID=c17ba869-9671-4330-a63e-1fd44e0e2505
+[ms_sdk]: https://developer.microsoft.com/en-us/windows/downloads
### Ubuntu Linux
=====================================
hawtjni-website/src/index.page
=====================================
@@ -36,11 +36,12 @@ Features
* Maven integration:
* Generates JNI source code
* Generates an autoconf and msbuild source project to build the
- native library. This gets attached to the maven project as as
+ native library. This gets attached to the Maven project as as
the native source zip file.
* Builds the native source tar for the current platform
* Built native library is stored in a platform specific jar. This
- gets attached to the maven project as a platform specific jar file.
+ gets attached to the Maven project as a platform specific jar file.
+* [Runtime API](documentation/api/) to load the library.
Introduction
------------
=====================================
pom.xml
=====================================
@@ -26,7 +26,7 @@
<groupId>org.fusesource.hawtjni</groupId>
<artifactId>hawtjni-project</artifactId>
- <version>1.16</version>
+ <version>1.17</version>
<packaging>pom</packaging>
<name>HawtJNI</name>
@@ -87,7 +87,7 @@
<connection>scm:git:https://github.com/fusesource/${forge-project-id}.git</connection>
<developerConnection>scm:git:https://github.com/fusesource/${forge-project-id}.git</developerConnection>
<url>https://github.com/fusesource/${forge-project-id}/tree/${project.scm.tag}</url>
- <tag>hawtjni-project-1.16</tag>
+ <tag>hawtjni-project-1.17</tag>
</scm>
<distributionManagement>
@@ -122,8 +122,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
- <source>1.5</source>
- <target>1.5</target>
+ <source>1.8</source>
+ <target>1.8</target>
</configuration>
</plugin>
<plugin>
=====================================
readme.md
=====================================
@@ -7,6 +7,7 @@ Description
[HawtJNI][1] is a code generator that produces the JNI code needed to implement java native methods. It is based on the [jnigen][2] code generator that is part of the SWT Tools
project which is used to generate all the JNI code which powers the eclipse platform.
+[![Maven Central](https://img.shields.io/maven-central/v/org.fusesource.hawtjni/hawtjni-runtime.svg?label=Maven%20Central)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.fusesource.hawtjni%22%20a%3A%22hawtjni-runtime%22)
Features
--------
View it on GitLab: https://salsa.debian.org/java-team/hawtjni/commit/913d348c77a5fc4b7faf86ad5f9e784338ace1f3
--
View it on GitLab: https://salsa.debian.org/java-team/hawtjni/commit/913d348c77a5fc4b7faf86ad5f9e784338ace1f3
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20190718/254733ea/attachment.html>
More information about the pkg-java-commits
mailing list