parcl icon indicating copy to clipboard operation
parcl copied to clipboard

Usage with Kotlin DSL

Open utybo opened this issue 5 years ago • 1 comments

How can I configure this plugin using the Kotlin DSL? using configure<Exe> does not work.

utybo avatar Aug 04 '19 17:08 utybo

You can use it much in the same way as the Groovy configurations by using the declarative plugins block:

build.gradle.kts

plugins {
    id("java")
    id("application")
    id("org.mini2Dx.parcl") version "1.7.1"
}

parcl {
    exe {
        exeName = "myapplication"
    }

    app {
        appName = "My Application"
        icon = "relative/path/to/icon.icns"
        applicationCategory = "public.app-category.adventure-games"
        displayName = "My Application"
        identifier = "com.example.my.apple.identifier"
        copyright = "Copyright 2015 Your Name Here"
    }

    linux {
        binName = "myapplication"
    }
}

However, some extra setup is required since otherwise gradle infers the name as org.mini2Dx.parcl.gradle.plugin. This can be done by adding a resolution strategy in settings.gradle.kts, such as below:

settings.gradle.kts

pluginManagement {
    repositories {
        mavenCentral()
        gradlePluginPortal()
    }
    resolutionStrategy {
        eachPlugin {
            if (requested.id.namespace == "org.mini2Dx") {
                useModule("org.mini2Dx:parcl:" + requested.version)
            }
        }
    }
}

Harleyoc1 avatar Jul 11 '21 00:07 Harleyoc1