· 2 min read Posted by Kevin Schildhorn

KMMBridge 1.2.1 Released

KMMBridge is a Gradle plugin that publishes Kotlin Multiplatform Xcode Framework dependencies for Swift Package Manager and CocoaPods. The 1.2.1 release fixes issues around publishing packages using CocoaPods.
Photo by Jimmy Woo on Unsplash https://unsplash.com/photos/a-large-bridge-over-a-large-body-of-water-C9ZN4U3FFjs
Credit: Photo by Jimmy Woo on Unsplash https://unsplash.com/photos/a-large-bridge-over-a-large-body-of-water-C9ZN4U3FFjs

For Apple-platform targets, the Kotlin Multiplatform compiler produces Xcode Framework binaries. KMMBridge provides the necessary tooling and configuration to publish these Framework binaries and make them accessible though Swift Package Manager (SPM) and CocoaPods.

Updates for CocoaPods Support

GitHub Releases

Version 1.1.0 of KMMBridge added support for making published binaries accessible through CocoaPods, however with that initial support there was a caveat: Published artifacts needed to be GitHub Packages and could not be GitHub Releases.

This meant that in order to support CocoaPods you needed to call KMMBridge like this:

    addGithubPackagesRepository()

    kmmbridge {
        mavenPublishArtifacts()
        cocoapods("git@github.com:[owner/repo].git")
    }

With version 1.2.1 you can now publish artifacts as GitHub Releases!

To support this you can update your kmmbridge block to look like this:

    kmmbridge {
        gitHubReleaseArtifacts()
        cocoapods("git@github.com:[owner/repo].git")
    }

Better Error Logging

In addition to adding release support, the CocoaPods integration has also been improved by adding better logging support for builds. In previous versions if a kmmBridgePublish call failed, when configured with CocoaPods, it would return an exit code instead of a more detailed error message. For example you might have seen an error like this:

* What went wrong:
Execution failed for task ':shared:pushRemotePodspec'.
> Process 'command 'pod'' finished with non-zero exit value 1

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':shared:pushRemotePodspec'.
Caused by: org.gradle.process.internal.ExecException: Process 'command 'pod'' finished with non-zero exit value 1

This doesn’t help when trying to resolve the issue. In version 1.2.1 this same error will appear like this:

* What went wrong:
Execution failed for task ':shared:pushRemotePodspec'.
> Cloning spec repo `owner-repo` from `git@github.com:Owner/Repo.git`
  [!] Unable to find the `git@github.com:Owner/Repo.git` repo. If it has not yet been cloned, add it via `pod repo add`.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':shared:pushRemotePodspec'.
Caused by: org.gradle.process.internal.ExecException: Cloning spec repo `owner-repo` from `git@github.com:Owner/Repo.git`
[!] Unable to find the `git@github.com:Owner/Repo.git` repo. If it has not yet been cloned, add it via `pod repo add`.

Conclusion

These changes should help smooth the experience of using KMMBridge to publish and access your framework using CocoaPods. To give these changes a try and start publishing your KMP code to iOS devs with these changes, head to the KMMBridge CocoaPods Quick Start.