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

Consider packageing Pattypan with JPackage to enable installation without user installed Java/JVM #152

Open Abbe98 opened 2 years ago

Abbe98 commented 2 years ago

We should consider creating standalone .exe (Windows), .dmg (MacOS), .deb/.rpm (Linux) binaries so that users of Pattypan do not need to have Java installed.

Things to consider:

ENOAbes commented 2 years ago

Hi,

I'm working in a national public agency for bibliographic data in France and we are very interested by the plugin Pattypan to realize massive uploads of images in Wikimedia Commons. We would like to offer the opportunity to use this plugin to the community of university libraries in France, to upload their digitizations on Wikimedia Commons, but we are facing two problems to do so

We are particularly interested by the .exe version of the standalone binaries you could create, because all the libraries of our partnership are under Windows.

Do you think you will be able to work on this issue during the next few months or do you consider other issues / other works you have as higher priorities ?

Anyway, thanks for this issue and keep me in touch if you make progress on it,

Etienne

ENOAbes commented 2 years ago

Just to complete my first comment, a former colleague told me about launch4j to package Pattypan and to create the .exe standalone binary we need. Did you already try this solution ?

Etienne

Abbe98 commented 2 years ago

Hi @ENOAbes!

I have personally no plans to work on this in the near future. I would, however, happily review contributions from others in case you find someone who can work on this.

ENOAbes commented 1 year ago

Hi @Abbe98 and hi everyone,

The direction of my agency said it would be possible to pay someone to package Pattypan. We always need a .exe version of the plugin to allow our partners to use Wikimedia Commons in an efficient way.

So if you are interested or if someone of the Wikimedia Commons community is interested, you could contact me here or directly on my mailbox : naddeo@abes.fr

Thanks a lot !

Abbe98 commented 1 year ago

@ENOAbes I will share this in my network and with some developers I know!

wetneb commented 1 year ago

If you do not find anyone, I can be a fallback. I have some experience with launch4j since we use it in OpenRefine too :)

sebastian-berlin-wmse commented 1 year ago

Wikimedia Sverige will work on this. Specifically we will be making a stand alone executable for Windows as @ENOAbes describes. I'll do most of the development and will update here when we have something of interest.

sebastian-berlin-wmse commented 1 year ago

Here's a progress report before the holidays.

I've looked a few different ways to bundle Java runtime with Pattypan. Most of these created an installation file, i.e. a file that the user would download and run to install Pattypan somewhere on the computer, along with Java runtime. At least one tool could create an EXE that could be run without installing, but that could not include Java runtime, which would have to be downloaded separately and placed next to the EXE. Since Abes wanted a program that could be run without installing, none of these would work.

When I looked a bit wider (not just for Java specific tools) I found that you can create self-extracting archives with 7-zip. You can specify what command to run inside the archive when it's executed, so if you include both Java runtime and a Pattypan JAR you have everything you need to run Pattypan. What happens when you run the EXE is that its contents is unpacked to the user's temporary directory and run there. Since there is no persistent installation this is done every time.

The EXE has been tested on Windows by @lokal-profil and can be found over at https://github.com/sebastian-berlin-wmse/pattypan/releases/tag/release-test. I ran into some weird errors during development, but that is likely due to running Windows in a, as it turns out quite unstable, virtual machine. If anyone wants to test it and encounters anything strange, let me know. There are a few rough edges still, but nothing that causes any actual problems:

  1. When launching there are one or more popups warning about the program being from an unknown publisher. Saying that you want to run anyway will start Pattypan.
  2. There is a command prompt window that launches Pattypan and remains behind it. It's closed when Pattypan is closed.
  3. After closing Pattypan there may be a popup saying that it wasn't "installed correctly". Telling it that it was should remove it for subsequent executions.
  4. There are some aesthetics that are lacking, like the icon (which could be from Windows 95🧓) and metadata for the program (shown in file description).

If there is still time after we established that everything works we'll have a look at these.

I've used Github actions to create the EXE. These should be usable on this repo to automatically build the EXE when a new release is made. Building a JAR is part of the process, so that can also be saved as an asset. Some changes needs to be made to include the JavaFX dependencies (these are bundled in the EXE with the Java runtime). If we want to switch Ant to something else, we should be able to keep most of the workflow and just change the JAR build action.

If you want more (technical) information on the development and decisions here are the relevant Pahbricator tasks: https://phabricator.wikimedia.org/T323119 and https://phabricator.wikimedia.org/T323121.

ENOAbes commented 1 year ago

Hi,

Thank you for your report, I’m on holidays tonight, so I don’t have time to read it carefully, but we will answer you during the first or second week of january anyway.

Thanks a lot and we write you soon,

Best for the end of this year,

Etienne

lokal-profil commented 1 year ago

The EXE has been tested on Windows by @lokal-profil and can be found over at https://github.com/sebastian-berlin-wmse/pattypan/releases/tag/untagged-7342897dcee7a8fc23f7. [...]

You should be able to find it over at https://github.com/sebastian-berlin-wmse/pattypan/releases/tag/release-test

sebastian-berlin-wmse commented 1 year ago

Thank you for the link. I didn't realise you had to be logged in to visit the other one. I've updated the original comment.

sebastian-berlin-wmse commented 1 year ago

The EXE seems to work well enough that it could be added to upstream. @Abbe98, I made a PR for the changes, #173, do you think you can merge it?

I had to do a bit of fiddling to get the action to work when I last merged it. I don't think actions are added automatically just because you add YAML files for them and I ended up making a branch with an empty action and then adding the changes. Maybe you have more experience with Github actions. If there are any questions let me know🙂

Abbe98 commented 1 year ago

@sebastian-berlin-wmse thank you! I will make a review.

Regarding Github Actions I'm not sure it's the path we want to go through as I would like the process to be easily reproduced locally. I'm also using all my free Action minute and mores as a part of other projects...

sebastian-berlin-wmse commented 1 year ago

The problem with creating the EXE locally is that you need to have the same OS as the result should be run on. At least I couldn't find any way to create a Windows executable on Linux. Github takes care of that.

If you want to create an executable (on Windows) I guess you can follow the same steps as the action does. Not sure if there's a simple way to make a script from the action file or if you'd need to duplicate that. There may also be Github specific things that would need to be replaced, like getting various bits of Java from other places.