Hi Mike,
It's possible to do some pretty cool stuff with Maven, as Hervé points
out, and also be sure to check out the plugins I created for Gradle:
https://github.com/bytedeco/gradle-javacpp
But Gradle is the same as OpenJDK: They do not care about native
libraries. It's great that Gradle allows to be hacked that way, but
there are no incentives, at all, for unifying, creating standards, for
the Java platform, unlike, for example, the Python platform, where we
have well defined specs to get stuff done with native libraries. (The
fact that we can't get anything done in Python without native libraries
is probably what helped it.)
I'm sorry to say, Johan, but it does all come down to politics. There
simply just isn't any money to throw around at the problem, and yes
Gregg I do also believe OpenJDK is much to blame here: That needs to change.
Now, since Oracle finally got the memo in court, I hope they stop
beating down Java, and allow others to pick it up and do something with
it. But who is that going to be? Amazon? IBM? Google? Microsoft? Not
sure any of those would be any better, frankly. My dream would be to
turn Java into an industry standard with its own independent foundation,
just like Linux, Python, LLVM, LibreOffice, etc. Java deserves that too!
And I would vote for Johan to get started on this :) With better
leadership, I'm sure it would be possible to gather a lot lot more
contributors.
Samuel
On 9/28/21 5:20 PM, Mike Hearn wrote:
To get back to technical aspects, the sub-question of native code
loading from JMODs/JARs has come up before. In 2018 I did some
experiments with loading native code directly from memory (i.e. a JAR)
on different operating systems, and wrote up the results here:
https://mail.openjdk.java.net/pipermail/jigsaw-dev/2018-April/013762.html
Linux had the best support, Windows was a runner up and macOS didn't
support it at all - you'd have to just write it out to disk and reload.
Dependencies between multiple native libraries was an open question. The
JVM is flexible, and since 2018 Panama has done a lot of work to improve
the internals of native code loading. It would be easy to make some
prototypes of different approaches now. Jigsaw seems to be de-staffed so
it's very much a case of "he who codes, wins" at this point - I don't
think the Java architects are going to descend from a throne and issue a
recommendation, given that the JDK and JavaFX already picked their own
approach (SDKs with your approach 1).
It may be worth taking a step back and asking to what extent is this
need driven by inadequate build tools, vs a true lack in the
Java platform itself. If Maven/Gradle worked better and the repository
format more supportive of platform-specific modules, would these four
different patterns matter at all? Put another way, what stops the JDK
itself being hosted entirely on Maven Central? If those tools more fully
embraced the jlink model then a lot of these questions and SPI-related
busywork would go away.