beryx / badass-runtime-plugin

Create a custom runtime image of your non-modular application
https://badass-runtime-plugin.beryx.org
Apache License 2.0
162 stars 21 forks source link

I believe the mapping from operating system to installerType is incorrect #14

Closed Parth closed 5 years ago

Parth commented 5 years ago

this code

  List<String> getPackageTypes() {
        def jpd = td.jpackageData
        if(jpd.installerType) return [jpd.installerType]
        if(OperatingSystem.current().windows) {
            return ['exe', 'msi']
        } else if(OperatingSystem.current().macOsX) {
            return ['rpm', 'deb']
        } else {
            return ['pkg', 'dmg']
        }
    }

sets up the wrong defaults. I believe the last two clauses should be switched. pkg, dmg belong to macOs.

would be happy to PR over the weekend if I'm right.

Parth commented 5 years ago

I can also update the docs to reflect what the installerType options are

Parth commented 5 years ago

It is correct on the jlink side of things

siordache commented 5 years ago

Thanks @Parth, a PR would be much appreciated!

Parth commented 5 years ago
  1. Could you give me some guidance on how local development works for a gradle plugin like this one?

  2. Another thing I'm interested in PR'ing is: exposing the --icon flag for the jpackageImage task (and other similar ones). Thoughts on that?

siordache commented 5 years ago

1.

After making changes to the plugin code, run:

./gradlew test

to check that everything still works.

Ideally, we should have tests for all use cases, but it is quite difficult to provide automated tests for the jpackage task and ensure that these tests also work in Travis. So, for the moment jpackage-related fixes are manually tested.

I added the maven-publish plugin to build.gradle, in order to make testing easier. After executing:

./gradlew publishToMavenLocal

the plugin will be available in your local Maven repository.

After that, you can use it in a test project (this can be one of your own projects or one of the example projects).

In the settings.gradle of your test project insert:

pluginManagement {
    repositories {
        mavenLocal()
        gradlePluginPortal()
    }
}

Then, in build.gradle configure the version of the plugin available in your local Maven repository. For example:

plugins {
    id 'org.beryx.runtime' version '1.3.1-SNAPSHOT'
    ....
}

2.

Right now, imageOptions can be used to pass additional options to jpackage:

runtime {
    jpackage {
        imageOptions = ['--icon', 'src/main/resources/java.ico']
        ...
    }
    ...
}

A dedicated plugin option for setting the icon is certainly a nice to have feature. I didn't expose the --icon flag and other ones as plugin options because jpackage has quite a few of them and they sometimes changed between jpackage releases (because jpackage is still early-access). I thought that exposing only a subset of the available flags will rather confuse the users, so I stuck with imageOptions as the only mechanism to pass options to jpackage.

msgilligan commented 5 years ago

The same bug existed in the badass-jlink-plugin -- see https://github.com/beryx/badass-jlink-plugin/issues/75 -- and was fixed by https://github.com/beryx/badass-jlink-plugin/commit/3376032f2754662cfff469425f8fc2fb7a525c1f.

msgilligan commented 5 years ago

@Parth Are you going to submit a PR soon? If not I can do it as I'd like to see this fixed.

Parth commented 5 years ago

Go for it @msgilligan, I'll make PR's for some doc improvements instead

msgilligan commented 5 years ago

See PR #16!

siordache commented 5 years ago

Thanks, @msgilligan! Your PR is included in release 1.3.1.