cjstehno / gradle-natives

Gradle plugin to aid in managing native libraries associated with Java-based projects.
http://cjstehno.github.io/gradle-natives/
Apache License 2.0
32 stars 4 forks source link

Native bullet library (for JME3.1) is not extracted #22

Open Entropy4711 opened 7 years ago

Entropy4711 commented 7 years ago

Hello,

I started using this plugin to create a game using JME 3.1l, which uses some native libraries (like LWJGL, OpenAL, and Bullet Physics). The plugin almost works perfectly - but it isn't able to extract the native libary files from the Bullet jar. I have the impression that it has something to do with the different structure of the bullet jar. The other jars have a flat directory structure, but the bullet jar has many nested directories for each platform and even for 32-bit and 64-bit. Here is a screenshot of this structure:

bullet_structure

Here a log of ./gradlew clean build includeNatives:

:client:includeNatives worker Thread 16,5,main]) started.
:client:includeNatives
Putting task artifact state for task ':client:includeNatives' into context took 0.0 secs.
Executing task ':client:includeNatives' (up-to-date check took 0.0 secs) due to:
  Task has not declared any outputs.
Including native libraries found for configurations (compile, runtime)...
 - jinput-platform-2.0.5-natives-linux.jar:
        [LINUX] libjinput-linux.so --> <mypath>/build/natives
        [LINUX] libjinput-linux64.so --> <mypath>/build/natives
 - jinput-platform-2.0.5-natives-osx.jar:
        [MAC] libjinput-osx.jnilib --> <mypath>/build/natives
 - lwjgl-platform-2.9.3-natives-osx.jar:
        [MAC] liblwjgl.dylib --> <mypath>/build/natives
        [MAC] openal.dylib --> <mypath>/build/natives
 - jinput-platform-2.0.5-natives-windows.jar:
        [WINDOWS] jinput-raw_64.dll --> <mypath>/build/natives
        [WINDOWS] jinput-wintab.dll --> <mypath>/build/natives
        [WINDOWS] jinput-raw.dll --> <mypath>/build/natives
        [WINDOWS] jinput-dx8_64.dll --> <mypath>/build/natives
        [WINDOWS] jinput-dx8.dll --> <mypath>/build/natives
 - lwjgl-platform-2.9.3-natives-linux.jar:
        [LINUX] liblwjgl.so --> <mypath>/build/natives
        [LINUX] libopenal64.so --> <mypath>/build/natives
        [LINUX] libopenal.so --> <mypath>/build/natives
        [LINUX] liblwjgl64.so --> <mypath>/build/natives
 - lwjgl-platform-2.9.3-natives-windows.jar:
        [WINDOWS] lwjgl.dll --> <mypath>/build/natives
        [WINDOWS] lwjgl64.dll --> <mypath>/build/natives
        [WINDOWS] OpenAL64.dll --> <mypath>/build/natives
        [WINDOWS] OpenAL32.dll --> <mypath>/build/natives
 - jme3-bullet-native-3.1.0-stable.jar:
        [WINDOWS] native/windows/x86/bulletjme.dll --> <mypath>/build/natives
:client:includeNatives FAILED
:client:includeNatives (Thread[Daemon worker Thread 16,5,main]) completed. Took 0.146 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':client:includeNatives'.
> java.io.FileNotFoundException: <mypath>/build/natives/native/windows/x86/bulletjme.dll (No such file or directory)

The <mypath> texts were added by me. Is this an issue with the plugin, or could I somehow configure this?

cjstehno commented 7 years ago

The plugin should find all native libs in project dependency jars.

Can you add a link to the bullet project so I can have something to test.

Entropy4711 commented 7 years ago

Thanks for your response! I can give you the gradle/maven dependency:

compile 'org.jmonkeyengine:jme3-bullet-native:3.1.0-stable'

EDIT: You'll need this repository url to be able to fetch it:

maven {
   url 'http://updates.jmonkeyengine.org/maven'
}

The jar that you get from that contains the structure from the screenshot. If you need anything else just let me know.

cjstehno commented 7 years ago

Thanks. I will try to take a look at it this week.

Entropy4711 commented 7 years ago

Were you able to find anything? Or could I somehow configure the plugin differently?

cjstehno commented 7 years ago

That repo location returns a 404 - according to the JME3 docs, their artifacts are in JCenter. Using the jcenter() repo, the listNatives task returns:

:listNatives
Native libraries found for configurations (compile, runtime)...
 - jme3-bullet-native-3.1.0-stable.jar:
    [WINDOWS] native/windows/x86/bulletjme.dll
    [WINDOWS] native/windows/x86_64/bulletjme.dll
    [LINUX] native/linux/x86/libbulletjme.so
    [LINUX] native/linux/x86_64/libbulletjme.so
    [MAC] native/osx/x86_64/libbulletjme.dylib
    [MAC] native/osx/x86/libbulletjme.dylib

So it appears to be finding them all. If you are still having issues I would need a standalone example or a failing test to look at.

Entropy4711 commented 7 years ago

You can test it with my project here on github: https://github.com/Entropy4711/infinite-wars Just clone it and run ./gradlew client:includeNatives The file client/build.gradle has the plugin configured. You'll find all dependencies on the file dependencies.gradle Feel free to ask me anything :)

cjstehno commented 7 years ago

I have a lot going on right now, so I am not sure when I will get back to this.