ARCHIVED: Use rapier-ffi/rapier-java instead
(note: uses java 19 FFI API, can be upgraded to java 20)
(note: you need jextract to point to a local install of jextract 19)
Requirements:
Optional: if updating rapier_ffi, also:
git clone https://github.com/aecsocket/rapier-java
cd rapier-java
git submodule update --init
./gradlew buildTo also publish to your local ~/.m2 repo:
./gradlew publishToMavenLocalTo update rapier_ffi:
-
./gradlew generateHeaderstakes the rapier_ffi/src Rust sources and creates a C header file for FFI in rapier-java-sys/build/librapier.h
-
./gradlew generateSystakes the C header file and creates Java sources for FFI in rapier-java-sys/src using jextract
-
Modify the Java source templates in src/main/templates
-
./gradlew generateTemplatestakes the template Java sources in src/main/templates and creates processed Java sources in the
rapier-java-dim*-f*variant projects, using the Pebble Templates engine and a Gradle build script
To generate native libraries:
-
./gradlew assembleNativescompiles rapier_ffi/src Rust sources to a platform-specific shared library in rapier_ffi/target
target/debugfordevprofile builds (default)target/releaseforreleaseprofile builds (published to Maven central) These files are then copied (during theassemblestep) into therapier-java-natives-*project's JAR
To build the JAR and publish to your local Maven repo:
-
./gradlew buildcompiles the processed Java source files from the
rapier-java-dim*-f*variant projects into JARs -
./gradlew publishToMavenLocalpublishes all projects (including headers, variants, natives) to your local
~/.m2