feat: add the platform classifier to the native library filename #194
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey 👋
Currently the project builds 6 native libraries:
webrtc-java.dll
for Windows x86_64 inwebrtc-java-$VERSION-windows-x86_64.jar
libwebrtc-java.so
for Linux x86_64 inwebrtc-java-$VERSION-linux-x86_64.jar
libwebrtc-java.so
for Linux aarch32 inwebrtc-java-$VERSION-linux-aarch32.jar
libwebrtc-java.so
for Linux aarch64 inwebrtc-java-$VERSION-linux-aarch64.jar
libwebrtc-java.dylib
for macOS x86_64 inwebrtc-java-$VERSION-macos-x86_64.jar
libwebrtc-java.dylib
for macOS aarch64 inwebrtc-java-$VERSION-macos-aarch64.jar
For a cross-platform app that doesn't ship a different package per platform, all 6 of these jars might be in the classpath together.
This means that
NativeLoader
can load the wrong one, because it just looks for a filename with an extension matching the current platform.I suggest appending the OS and architecture to the filename:
webrtc-java-windows-x86_64.dll
for Windows x86_64 inwebrtc-java-$VERSION-windows-x86_64.jar
libwebrtc-java-linux-x86_64.so
for Linux x86_64 inwebrtc-java-$VERSION-linux-x86_64.jar
libwebrtc-java-linux-aarch32.so
for Linux aarch32 inwebrtc-java-$VERSION-linux-aarch32.jar
libwebrtc-java-linux-aarch64.so
for Linux aarch64 inwebrtc-java-$VERSION-linux-aarch64.jar
libwebrtc-java-macos-x86_64.dylib
for macOS x86_64 inwebrtc-java-$VERSION-macos-x86_64.jar
libwebrtc-java-macos-aarch64.dylib
for macOS aarch64 inwebrtc-java-$VERSION-macos-aarch64.jar
Then we can lookup with
webrtc-java-$OS-$ARCH
, and all 6 jars can live together in the classpath - I tested it and it works.What do you think?
Thanks