touchlab / KMMBridge

KMMBridge is a tool that helps publish Kotlin Multiplatform (KMP) Xcode binaries for use from Swift Package Manager (SPM) and CocoaPods.
https://touchlab.co/kmmbridge/
Apache License 2.0
358 stars 20 forks source link

Publishing JVM libraries #155

Closed gazanfarov closed 1 year ago

gazanfarov commented 1 year ago

Is it possible to use KMM Bridge to publish JVM target?

Thank you.

gazanfarov commented 1 year ago

Never mind Have figured out a way myself In build.gradle of allshared module from example I have just put this settings:

kotlin {
    ios()
    jvm {
        withJava()
        val jvmJar by tasks.getting(org.gradle.jvm.tasks.Jar::class) {
            doFirst {
                duplicatesStrategy = DuplicatesStrategy.EXCLUDE

                manifest {
                    attributes["Main-Class"] = "ua.blink.telegram.ApplicationKt"
                }

                from(
                    configurations.getByName("runtimeClasspath")
                        .map { if (it.isDirectory) it else zipTree(it) }
                )
            }
        }
    }
 }

And in AllPublish GitHub action I have added next config:

name: All Publish
on:
  workflow_dispatch:
#  push:
#    branches:
#      - "main"
jobs:
  call-kmmbridge-publish:
    uses: touchlab/KMMBridgeGithubWorkflow/.github/workflows/faktorybuildbranches.yml@v0.6
    with:
      publishTask: kmmBridgePublish publishAndroidDebugPublicationToGitHubPackagesRepository publishAndroidReleasePublicationToGitHubPackagesRepository publishJvmPublicationToGitHubPackagesRepository
russhwolf commented 1 year ago

We currently only manage native publications, not JVM. But as you've seen, you can modify the workflow to call a separate JVM publish task at the same time.