New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename duplicate files based on source jar name (feature request to build with JOGL /jogamp.org) #141
Comments
We have assemblyMergeStrategy in assembly := {
case PathList(ps @ _*) if ps.last endsWith ".so" => MergeStrategy.rename
case PathList(ps @ _*) if ps.last endsWith ".dll" => MergeStrategy.rename
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
} |
No, unfortunately that doesn't solve the issue. |
I think |
Yes, that value is exactly what I need. Any idea if I can use that in a merge strategy? in pseudo code I'd like a renaming merge strategy like
|
Likely what you need is a custom strategy, so I'd say you can start with copy-pasting what's in |
Thank you, I guess it should be possible to just create a new anonymous scala class extending MergeStrategy in the assemblyMergeStrategy partial function case of so/dlls, like you say, just copy pasting that code even and replacing appendJarName :) I'll try it out later and see how it goes! I think what confused me earlier was that assemblyMergeStrategy is a partialfunction, and not the actual merge strategy itself. I'm still a little new to functional programming but loving it so far ^^. Something like this
|
Got it working :). (see https://github.com/GiGurra/dcs-remote/blob/master/dcs-remote-renderer/build.sbt for implementation) |
Nicely done! |
@GiGurra could you post your build.sbt file here please? That link is dead |
Jogamp JOGL (see http://jogamp.org/) is an OpenGL binding for the jvm. I have been talking to one of their maintainers about making it possible to build JOGL applications with Scala and SBT.
Using JOGL in an sbt project is mostly quite simple - it only requires you to specify two dependencies:
This works with sbt build, package, publish, eclipse, run
However it does not work with sbt assembly. This is because JOGL/GlueGen jar files contain native dlls/so files - and these dlls have the same name (but are located in different jar files, e.g. jogl-all-2.2.4-natives-windows-i586.jar and jogl-all-2.2.4-natives-windows-amd64.jar both contain jogl_desktop.dll and a few other dlls).
The JOGL/GlueGen project have several different jar file setups that they support for dynamically finding the correct native opengl dll/so binding file inside a fat jar, as explained here:
https://jogamp.org/wiki/index.php/JogAmp_JAR_File_Handling. One of them is to create a fat jar with a directory structure inside like:
myfat.jar/natives/windows-amd64/jogl_desktop.dll
To make this work with sbt assembly, I suggest a new settings key (or extending merge strategies).
--> Make it possible to change merged file locations based on source jar name.
For example libA.jar/thelibrary.dll maps to assembly.jar/prefixBasedOnSourceJarName/thelibrary.dll
One way would be to extend the assemblyMergeStrategy API so it not only gives the source file but also what jar file it came from. This way I could easily re-map the file locations with no problem.
I posted a thread in their forums (+ had long discussion on IRC with one of their maintainers) here: http://forum.jogamp.org/Help-How-to-Build-an-executable-JAR-with-SBT-JOGL-Scala-tt4033830.html
Here is a sample sbt+JOGL project if you want to try it:
https://github.com/GiGurra/gat
I hope this will not turn into a Jogamp: "you're doing it wrong" vs sbt: "No you're doing it wrong". I'm just looking for a solution for building OpenGL applications in scala and deploying them, preferably with SBT assembly like I normally do.
I haven't found any previous issues or stackoverflow topics on this topic.
The text was updated successfully, but these errors were encountered: