yarl / pattypan

Upload files to Wikimedia Commons. The Spreadsheet Way.
https://commons.wikimedia.org/wiki/Commons:Pattypan
MIT License
56 stars 37 forks source link

Stand alone .jar for Java 11 #149

Closed sebastian-berlin-wmse closed 2 years ago

sebastian-berlin-wmse commented 2 years ago

Continuing the issue with creating a .jar from #138.

sebastian-berlin-wmse commented 2 years ago

I've managed to create a .jar that runs on Windows 10. Apart from Windows specific classes it requires some .dll files not mentioned in the JavaFX documentation. I tried just adding all the .dll files which worked. Now I just have to figure out which ones are actually needed.

Abbe98 commented 2 years ago

No I just have to figure out which ones are actually needed.

@sebastian-berlin-wmse I imagine we need to do so for each platform.

I guess we can't package the platform-specific JARs together without there being conflicts, so maybe we need to go down the route with separate JARs.

sebastian-berlin-wmse commented 2 years ago

I just managed to make a JAR that works on both Linux and Windows (10 in a Virtualbox): https://github.com/sebastian-berlin-wmse/pattypan/releases/tag/pattypan-21-10-experimental-4-package-windows.

It took some manual juggling to get all the correct files for both platforms. It works if you unpack the JavaFX JARs for one platform and then the other, telling it not to overwrite files. That is, there appears to be some classes unique to the Linux JARs and some classes unique to the Windows JARs that must all be included, but the classes themselves don't cause any conflicts. I noticed this was mentioned in the documentation, I must not have read it properly (emphasis mine):

This requires downloading the JavaFX SDKs for all the platforms, extracting all the necessary jars (for instance, javafx.graphics is different for each platform), and copying all the native libraries as shown above.

I'll have a look at it tomorrow to sort it out with Ant. At least now we (hopefully) have a release that works on Windows.

sebastian-berlin-wmse commented 2 years ago

Now there's a PR (https://github.com/Kartkod/pattypan/pull/2) for automating the whole process. The only manual step is to download the OpenJFX ZIPs. The build file may be a bit WET with both Linux and Windows sections looking a lot the same. I still works, though, and I'm not sure how to easily reuse the logic with Ant, though I'm guessing there is a way.

Abbe98 commented 2 years ago

I'm going to do an upload with this to see if #145 is a blocking issue, otherwise, I'm going ahead with an experimental release.

I might be able to do Mac later this week. Is there some documentation regarding which .ddl/.so files are actually needed from OpenJFX? Or is it a matter of trial and error?

sebastian-berlin-wmse commented 2 years ago

The only documentation I found was on https://openjfx.io/openjfx-docs/#install-javafx, at the bottom. It doesn't mention the extra DLLs, though it's only for simple example project. Linux worked without having to add anything more than is mentioned there.

When I ran it on Windows I got an error about missing dependents. It didn't say which ones before I ran with debug, though. I.e. something like this java -Djavafx.verbose=true -Dprism.verbose=true jar pattypan.jar. Not sure which one did it (javafx or prism); the issue was with prism so maybe you need to change that if you get errors for something else.

Abbe98 commented 2 years ago

I didn't run into any serious issues so I'm making an experimental release to get some additional feedback/data while working on MacOS packaging.

One thing that's broken(and might have been broken in the past) is the opening of files on Linux, for example, clicking the "log file" link results in Pattypan freezing until one kills the process.

Another thing I noticed is that while I packaged it with the Linux x64 it ran just fine on ARM although it failed to load some .so files. Maybe this means that all the files mentioned in the OpenJFX installation guide aren't actually necessary.

Abbe98 commented 2 years ago

The following builds and runs on Linux, now I just need to pick up a Mac and test it, possibly tomorrow. Would you be able to check if it didn't break Windows?

https://github.com/Kartkod/pattypan/pull/4

Considering positive reports from the last experimental release, if this is confirmed to work on MacOS we got ourselves a release!

sebastian-berlin-wmse commented 2 years ago

One thing that's broken(and might have been broken in the past) is the opening of files on Linux, for example, clicking the "log file" link results in Pattypan freezing until one kills the process.

I did run into this when (with the log file) before working on the packaging.

Another thing I noticed is that while I packaged it with the Linux x64 it ran just fine on ARM although it failed to load some .so files. Maybe this means that all the files mentioned in the OpenJFX installation guide aren't actually necessary.

That's possible. I only added things that were missing and haven't tried removing any libraries. I can see if we can drop any of the ones included now.

Would you be able to check if it didn't break Windows?

Yes, I'll try it in my Virtualbox installation.

sebastian-berlin-wmse commented 2 years ago

Would you be able to check if it didn't break Windows?

Yes, I'll try it in my Virtualbox installation.

Still works for me.

Abbe98 commented 2 years ago

One thing that's broken(and might have been broken in the past) is the opening of files on Linux, for example, clicking the "log file" link results in Pattypan freezing until one kills the process.

I did run into this when (with the log file) before working on the packaging.

I would be surprised if it originated from packaging, I'm still finding issues caused by the Java 8->11+ migration, I wouldn't consider it blocking anyway.

Would you be able to check if it didn't break Windows?

Yes, I'll try it in my Virtualbox installation.

Still works for me.

Awesome!

sebastian-berlin-wmse commented 2 years ago

Another thing I noticed is that while I packaged it with the Linux x64 it ran just fine on ARM although it failed to load some .so files. Maybe this means that all the files mentioned in the OpenJFX installation guide aren't actually necessary.

That's possible. I only added things that were missing and haven't tried removing any libraries. I can see if we can drop any of the ones included now.

It runs without libdecora_sse, both Linux and Windows. The rest seems to be used. I didn't do an exhaustive test for each individual file on both platforms. I'm worried that I could remove something that still works on my machine, but not others because there are different versions of some libraries.

Here's the PR: https://github.com/Kartkod/pattypan/pull/5.

Abbe98 commented 2 years ago

It runs without libdecora_sse, both Linux and Windows. The rest seems to be used. I didn't do an exhaustive test for each individual file on both platforms. I'm worried that I could remove something that still works on my machine, but not others because there are different versions of some libraries.

Thank you! I was able to do the same on Mac. I built it for Intel-based Macs and assume it works on later architectures as well.

I'm making an experimental release with the intent that this one will be promoted to stable on Monday!

sebastian-berlin-wmse commented 2 years ago

I managed to get the log link to work. Apparently it was a Linux only thing. PR: https://github.com/Kartkod/pattypan/pull/6.

Not directly related to this issue (even if it's mentioned), but I was to lazy to make a new issue for it :)

Abbe98 commented 2 years ago

Pattypan 22.02 is now available!

Abbe98 commented 2 years ago

Future improvements to packaging are covered by #152.