Summary: | On jar file location agnosticism | ||
---|---|---|---|
Product: | [JogAmp] General | Reporter: | Mark Raynsford <org.jogamp> |
Component: | builds | Assignee: | Mark Raynsford <org.jogamp> |
Status: | RESOLVED FIXED | ||
Severity: | major | CC: | sgothel |
Priority: | --- | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | all | ||
See Also: | https://jogamp.org/bugzilla/show_bug.cgi?id=1023 | ||
Type: | --- | SCM Refs: | |
Workaround: | --- | ||
Bug Depends on: | 1023, 1032 | ||
Bug Blocks: |
Description
Mark Raynsford
2014-06-23 19:53:04 CEST
I forget: Wasn't there a way to turn off all of this stuff entirely and force the user to set -Djava.library.path with the locations of the natives? (In reply to comment #1) > I forget: Wasn't there a way to turn off all of this stuff entirely and > force the user to set -Djava.library.path with the locations of the natives? A fourth value of "none" is what I was getting at... > > 1. "same_directory" > > This gives the traditional JOGL behaviour as things stand now. It's also the > default, and will be used by JOGL if the user doesn't define a > com.jogamp.native_jar_loading_type property. Negative impact: adds some complexity > > 2. "classpath" > > For various technical reasons, JOGL doesn't inspect the classpath to find > native directories. However, as a direct consequence of how Maven and Gradle > handle dependencies, the full paths to each of the native jars will be > (completely unconditionally, at least in Maven's case) placed on the > classpath! This means that even if all of the jar files exist in different > directories (Gradle), JOGL can still find them. Negative impact: Using ClassLoader and hence adding alot complexity as well as having a performance impact. Inspecting the classpath to find the right native jar file would required: - adding an identifying class into the jar file to find it - and query the jar files purpose (platform) - using the ClassLoader, i.e. making resource lookup more expensive since all ClassLoader resources, as well as all ClassLoader would need to be traversed. - requires networking applications to transfer all jar files to the client, e.g. Applets. Our current solution only transfer the requested native jar file to the client. > > Tentatively, I might suggest a third value: > > 3. "same_directory_without_aliasing" > > This gives the traditional JOGL behaviour but with aliasing disabled. In > effect, when the "jogl-all-noawt" package looks for its native jars, it'll > look for "jogl-all-noawt-*-natives.jar" instead of "jogl-all-*-natives.jar". > This would > allow for fixing bug 1023 with some minor changes to the current Maven > packages. Negative impact: Duplication of artifacts, but no code, performance or 'process' sideffects. Strong UP-VOTE! I.e. simply produce matching native jar files for all 'all-<variant>' java jar files, while removing the 'aliasing' altogether. This also _REMOVES_ code complexity, which is good. > > If we had the above, suddenly our Maven packages become a lot easier to > rearrange (because we don't have to desperately try to get Maven to download > everything to the right place), and resistant to any future repository > layout changes. We'd also gain the ability for people to use Gradle as their > build system (it outright won't work at all, at the moment). Having talked about this on IRC, it seems that the best approach would be to essentially let the classloader do the work of classpath inspection by adding classes to the native jars that can be queried at runtime. Basically: 1. Attempt to load native jars using what would have been the "same_directory_without_aliasing" behaviour described. This eliminates some complexity that the current aliasing introduces, and makes it possible to fix bug 1023. 2. If the above loading failed, assume that the native jar files are on the classpath and therefore can be looked up by class. The classloader will attempt to look up a class named, for example, "jogl_linux_amd64" which will be inserted into the jogl-all-natives-linux-amd64.jar at JOGL build time. The location of the jar file containing that class can obviously then be derived from the resulting class and the unpacking of jar files can continue as normal. 3. If the class loading failed, give up. Advantage of this is that it's not necessary to inspect a platform-specific classpath that may or may not actually contain valid URIs. |