Skip to content
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

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

Open
Abbe98 opened this issue Feb 7, 2022 · 14 comments

Comments

@Abbe98
Copy link
Collaborator

Abbe98 commented Feb 7, 2022

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:

  • Would it be valuable to migrate from Ant to Maven or Gradle? Seems like there are way better JPackage examples/support there.
  • Would updates be impacted?
@ENOAbes
Copy link

ENOAbes commented Sep 7, 2022

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

  • The libraries will not be able to use Pattypan with Java because it's too complex for their organizations
  • We don't know how to package the last version of Pattypan to install it without Java

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
Copy link

ENOAbes commented Sep 7, 2022

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
Copy link
Collaborator Author

Abbe98 commented Sep 7, 2022

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
Copy link

ENOAbes commented Sep 28, 2022

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 : [email protected]

Thanks a lot !

@Abbe98
Copy link
Collaborator Author

Abbe98 commented Sep 28, 2022

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

@wetneb
Copy link

wetneb commented Oct 5, 2022

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
Copy link
Contributor

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
Copy link
Contributor

sebastian-berlin-wmse commented Dec 21, 2022

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
Copy link

ENOAbes commented Dec 21, 2022 via email

@lokal-profil
Copy link

@sebastian-berlin-wmse
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Collaborator Author

Abbe98 commented Mar 21, 2023

@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
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants