mobanisto / pinpit-gradle-plugin

Platform Independent Native Packaging and Installer Toolkit
Apache License 2.0
47 stars 1 forks source link

Multiplatform plugin instructions #38

Open Syer10 opened 8 months ago

Syer10 commented 8 months ago

Here https://github.com/mobanisto/pinpit-gradle-plugin#usage it has instructions to add it to a jvm project. How would I add it to a multiplatform project? I've tried putting everything in

kotlin {
    jvm() {
        val currentOs: Configuration by configurations.creating {
            extendsFrom(configurations.getByName("implementation"))
            attributes { attribute(attributeUsage, "java-runtime") }
        }

        val windowsX64: Configuration by configurations.creating {
            extendsFrom(configurations.getByName("implementation"))
            attributes { attribute(attributeUsage, "java-runtime") }
        }

        val linuxX64: Configuration by configurations.creating {
            extendsFrom(configurations.getByName("implementation"))
            attributes { attribute(attributeUsage, "java-runtime") }
        }

        val macosArm64: Configuration by configurations.creating {
            extendsFrom(configurations.getByName("implementation"))
            attributes { attribute(attributeUsage, "java-runtime") }
        }

        compilations.getByName("main") {
            compileDependencyFiles = currentOs
            runtimeDependencyFiles = currentOs
        }

        dependencies {
            currentOs(compose.desktop.currentOs)
            windowsX64(compose.desktop.windows_x64)
            linuxX64(compose.desktop.linux_x64)
            macosArm64(compose.desktop.macos_arm64)
        }
    }
}

But it fails to find implementation

sebkur commented 8 months ago

Would this help? https://github.com/mobanisto/pinpit-gradle-examples/tree/master/kotlin/compose-mpp

Syer10 commented 8 months ago

Not exactly, the way we have thing setup, is that we usually use kotlin("multiplatform") instead of kotlin("jvm") projects because it allows us to separate production compilations from internal compilations easily. That compose-mpp project has a separate jvm module for the desktop app.

sebkur commented 8 months ago

hum, OK, interesting. In that example, I'm applying kotlin("multiplatform") to the :compose module and add that as a dependency to the :desktop module where we have id("org.jetbrains.kotlin.jvm").

Unfortunately, I don't think I have a solution for this ready yet.

it allows us to separate production compilations from internal compilations easily

oh, sounds interesting, although honestly I don't quite understand what that means in practice.