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

Launcher icon not added to rpm and deb packages? #148

Closed
dawidm opened this issue Aug 5, 2020 · 4 comments
Closed

Launcher icon not added to rpm and deb packages? #148

dawidm opened this issue Aug 5, 2020 · 4 comments

Comments

@dawidm
Copy link

dawidm commented Aug 5, 2020

I'm using following configuration (JVM 14.0.2 gradle 6.5.1):

jlink {
    options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
    launcher {
        name = 'Cryptonose'
    }
    forceMerge('log4j-api')

    jpackage {
        // Set the environment property BADASS_JLINK_JPACKAGE_HOME or explicitly configure the below property
        // jpackageHome = '/usr/lib/jvm/adoptopenjdk-14-openj9-amd64'
        installerOptions += [
                '--description', project.description,
                '--app-version', version,
                '--copyright', 'Copyrigtht 2020 Dawid Motyka',
                '--license-file', 'LICENSE.txt',
                '--vendor', 'Dawid Motyka'
        ]
        if (org.gradle.internal.os.OperatingSystem.current().linux) {
            imageOptions += ['--icon', 'src/main/resources/launcher.png']
            installerOptions += [
                    '--linux-menu-group', 'Internet',
                    '--description', project.description,
                    '--app-version', version,
                    '--linux-shortcut',
                    '--linux-deb-maintainer', '[email protected]',
                    '--linux-rpm-license-type', 'MIT'
            ]
        }
        if (org.gradle.internal.os.OperatingSystem.current().windows) {
            imageOptions += ['--icon', 'src/main/resources/launcher.ico']
            installerOptions += ['--win-per-user-install',
                                 '--win-dir-chooser',
                                 '--win-menu',
                                 '--win-shortcut',]
        }
    }
}

Provided png icon is added to image folder build/jpackage/Cryptonose/lib (Cryptonose.png) not to deb and rpm packages (they contain default icon). The icon is added correctly to Windows installers if built on Windows.

@siordache
Copy link
Member

You probably need to specify the resource-dir:

if (org.gradle.internal.os.OperatingSystem.current().linux) {
    imageOptions += ['--icon', 'src/main/resources/launcher.png']
    installerOptions += [
	    '--resource-dir', "build/jpackage/Cryptonose/lib",
	    '--linux-menu-group', 'Internet',
	    '--description', project.description,
	    '--app-version', version,
	    '--linux-shortcut',
	    '--linux-deb-maintainer', '[email protected]',
	    '--linux-rpm-license-type', 'MIT'
    ]
}

@dawidm
Copy link
Author

dawidm commented Aug 7, 2020

It works, thanks. Is it workaround or is it expected behaviour that icon is not added when --resource-dir is not set? I'm asking because for Windows the parameter is not needed.

@siordache
Copy link
Member

I'm not sure if it's expected behavior or a jpackage issue. The documentation says:

If the default resources that jpackage uses when packaging an application don't meet your needs, create a directory and add your customized files to it. If you override a file, your custom file must contain all of the properties that the default contains. Pass the path to the directory to jpackage using the --resource-dir option. The path can be absolute or relative to the current directory.

Note: Resources such as icons, application version, application description, copyright, and others can be overridden from the command line. Use of the command line options is recommended when available.

My initial understanding was that the --icon option should be enough. But, as it turned out, --resource-dir is also required on Linux (and probably macOS) when running jpackage in two phase mode (first creating an application image and then an application package).

@airsquared
Copy link
Collaborator

I believe this is fixed in v3.0.0 by #236.

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

No branches or pull requests

3 participants