sghpjuikit / player

Audio player and management application.
21 stars 2 forks source link

Provide executables #147

Open sghpjuikit opened 5 years ago

sghpjuikit commented 5 years ago

Objective: create Linux executable Secondary: automate creating Windows/Linux executables

Windows Ready for release, although there are improvements to make our life easier. I'm using launch4j (manually) to generate Player.exe. This exe delegates to the PlayerFX.jar, turning it into windows application. The exe generation configuration is in the PlayerFX.xml file. We may also use launch4j gradle plugin to automate it.

Linux @Xerus2000 Any ideas how to go about this? What we need is file that:

PS: It would be very good if we avoided duplication for things like jvmargs. Cause it hurts. The only possible source of truth for jvmargs can be gradle build file. We can either completely automate executable generation or at least create a task that will create a file or print all jvmargs.

xeruf commented 5 years ago

We could easily have a gradle task that generates a shell-starter doing all these things, I have done similar things before. The only thing I haven't yet tried are file associations.

We should also generate a proper .desktop-file so that it can easily be integrated into the start menu, idk if we have looked into this yet. But this should probably be in the application, similar to how IDEA does it.

sghpjuikit commented 5 years ago

Can I ask you to take care of this on Linux side of things? It would be quite difficult and time consuming for me to handle it and you seem better for the job.

Is .desktop a Linux thing? What do you mean by 'be in the application'?

I think we can ignore file associations for now.

sghpjuikit commented 5 years ago

We may also wanna support user specified jvm options, also in Idea style.

Also Linux portable app image thing is something to consider, pols have a look https://appimage.org/

xeruf commented 5 years ago

App Images are usually rather unpopuplar because the do not integrate with the system and receive no auto-updates, but I guess that is fine with your intended use-case.

Can I ask you to take care of this on Linux side of things? It would be quite difficult and time consuming for me to handle it and you seem better for the job.

Is .desktop a Linux thing? What do you mean by 'be in the application'?

Of course, but I can't make a guarantee for doing it soon. A .desktop file is a starter in Linux, which defines application name, icon, description and executable for the start menu and desktop.

IDEA has a little button for creating this file: image

This is what it then puts into my start menu, but you can easily do with a lot fewer attributes:

[Desktop Entry]
Categories=Development;IDE;
Comment[de_DE]=IntelliJ IDEA
Comment=IntelliJ IDEA
Exec=/opt/idea/bin/idea.sh
GenericName[de_DE]=
GenericName=
Icon=/opt/idea/bin/idea.png
MimeType=
Name[de_DE]=Idea Ultimate
Name=Idea Ultimate
Path=
StartupNotify=true
Terminal=false
TerminalOptions=
TryExec=/opt/idea/bin/idea.sh
Type=Application
Version=1.0
sghpjuikit commented 5 years ago

Ok I will investigate the .desktop and AppImage some more. And take your time, I have plenty more to do on this myself so you have time.

sghpjuikit commented 5 years ago

@Xerus2000 any rough ETA on this? This can be just a manually written file (I will keep it maintained), no need for fancy gradle stuff. We jsut want to be able to launch the program on Unix.

xeruf commented 5 years ago

But it has to be dynamic, since the icon location can differ depending on where the player is. This would be my draft:

[Desktop Entry]
Name=PlayerFX
Comment=Audio player and management application
Categories=AudioVideo;Audio;Utility;Java;Player;Music
Exec=/opt/playerfx/PlayerFX.sh
Icon=/opt/playerfx/resources/icon512.png

I added categories as I saw fit best according to https://specifications.freedesktop.org/menu-spec/menu-spec-1.0.html#category-registry, feel free to modify.

sghpjuikit commented 5 years ago

@Xerus2000 Check the changes in 874e06b

xeruf commented 5 years ago

For the args to always stay in sync, the starter scripts should not be checked into git but always automatically generated. I have actually written a small custom task in another project to easily do that: https://github.com/CAU-Kiel-Tech-Inf/socha/blob/master/buildSrc/src/ScriptsTask.kt

sghpjuikit commented 5 years ago

I understand and I'd like to use it in the future, but not right now. This this is broader topic, because the same goes for the windows executables. Unless we have those automated too, it may be easier to not automate sh/bat either.

Interesting task. Though it requires .bat and .sh to have the same content. For example: I think it is recommended to use exec for the sh that launches java. Also -cp delimiter is different on WIndows.

There is launch4j gradle task to generate exe files, but I'm not sold on it yet.

xeruf commented 5 years ago

@defvs has implemented launch4j in one of my projects, maybe you can talk with him if you are struggling ;)

sghpjuikit commented 5 years ago

Interesting. Sounds good. I'll certainly will.

defvs commented 5 years ago

hello it's me i've been summonned :dog: feel free to ask me anything about Install4J, I've learned to use it by now. Also regarding license for opensource projects, you can get a full license for free as soon as you credit them in your website/readme :)

defvs commented 5 years ago

Easy ! Set your classpath / module path when creating a Launcher and enter your main class name.

"Allow VM passthrough parameters" when in Create Launcher

See above

That's up to the .desktop file on linux. in Create Launcher, advanced settings, "Unix Options". Additional content for .desktop file

in Create Launcher, there is an advanced option "Redirection". But it's only for stdout / stderr

sghpjuikit commented 5 years ago

Hello @defvs and sorry for the Kuchiyose no Jutsu.

I didn't know of Install4j, I probably overlooked it due to licencing. Looks very feature-packed, I especially like the vmoptions file support.

Unfortunately I have yet to set a licence for the project as I'm reluctant to use GPL, so it is not impossible that I wont be able to get the open source licence that Install4j asks for.

Regarding .desktop file, I understand that the file does not reside in application's directory, but specified OS directory (user/bin ?) and points to the application. I didn't know file associations in Linux work (also?) through .desktop file, good to know. I take it, you recommend application to provide a .desktop file for best user experience? Although this can only be done by the installer or by the application itself, since the application path is required to be known at the time of creation of the file. Correct?

Regarding stdout/stderr, I meant it as: running the program using executable/script/whatever in terminal will produce application output - the executable/script/whatever must not hide or 'lose' this information, for example by creating a child process and just wait for it to end. The redirection in install4j you mentioned is a logging feature and concerns redirecting to files - useful, just not relevant in this case.

Regarding the use of install4j, I'm not sold just yet. Besides the licencing issue, its value for this project comes down to only two things:

I have a question: do you have any experience with gradle ntegration for install4j and launch4j? Can you compare the two in this regard?

sghpjuikit commented 5 years ago

Follow up note on providing installers.

I'm against the use of installers for this project for several reasons:

I think installers are unnecessary legacy, best avoided.

xeruf commented 5 years ago

Woops, I apparently mixed up install4j and launch4j 🙈

defvs commented 5 years ago

@sghpjuikit

EDIT :

EDIT 2 : Licensing The license is NOT cheap, at all. 2K€ for a regular license, 400€ for a command-line only license. But it's free for FOSS.

defvs commented 5 years ago

@Xerus2000 I got baited by you into thinking you were talking about Install4j and not Launch4j

sghpjuikit commented 5 years ago

Well, Install4j does indeed look capable of handling all needs concerning bundling and installing, which is very useful. If I set on an opensource licence for the player module, I think it would be worth using it.

Ultimately, this will be done post release though as I have plenty other things to do before that and I'm already past deadline.

@defvs thx for the inputs

defvs commented 5 years ago

btw just looked at the player; great work. Good luck !

sghpjuikit commented 5 years ago

@defvs thx. What OS did you try this with. Windows?

sghpjuikit commented 5 years ago

There is a alpha release provided now. I'm leaving this task open until I provide release for Linux as well.