KMMBridgeartifactsMaven Repository Artifacts

Maven Repository Artifacts

You can use a “standard” Maven repository to store your KMMBridge zip artifact. This will push the XCFramework zip archive to a standard maven/gradle endpoint. Using this artifact storage method allows for a wider range of publication possibilities, and utilizes standard Gradle publishing config.

Using Maven/Gradle repos to store your KMMBridge artifacts requires a few setup steps, and has some unique considerations. Setup requires handling the following:

  1. Configure push access to your repository.
  2. Configure artifact read access for private repos (generally the ~/.netrc or Mac Keychain Access config).

Due to a bug in the Gradle publishing plugin that is somehow connected to Maven repository definitions, Gradle config cache is not supported using Maven. See our tracking issue.

1) Configure Push Access

Each Maven repo type/vendor has its own unique setup, but essentially we need:

  1. A repo url
  2. A username that can publish to the repo
  3. A password/token for that user

The standard Gradle publishing config looks like the following.

plugins {
    `maven-publish`
    // etc
}

// ...

publishing {
    // Externally set these values. Generally ~/.gradle/gradle.properties or CI Secrets
    val publishUsername: String by project
    val publishPassword: String by project
    repositories {
        maven {
            url = uri("https://someservice/path/to/repo")
            credentials {
                username = publishUsername
                password = publishPassword
            }
        }
    }
}

The repo configuration above is all part of the standard Gragle publishing plugin. It is not specific to KMMBridge. If you are having access issues, please refer to the Gradle Docs and to the vendor docs specific to the maven repo you are using.

With publishing configured, you can publish everything with ./gradlew publish, or just publish the KMMBridge artifact with ./gradlew kmmBridgePublish.

KMMBridge does not define publishing-related tasks under normal operation. See Publishing for more info.

2) Configure Client Read Access

To access your published Xcode Framework package, you’ll need to make sure Xcode has access to the package metadata and the binary itself. The package metadata differs depending on if you use Cocoapods or Swift Pacakge Manager. Access to the binary is the same with either.

Package Metadata

Cocoapods publishes pacakge metadata to a git repo. See CocoaPods setup.

SPM uses git for publishing and git tags for versioning. See SPM setup.

Binary Access

If the binaries are stored in a private server, you’ll need to configure auth access to them. You can do that with ~/.netrc or Mac Keychain Access. We’ll use ~/.netrc here.

Open or create ~/.netrc. Add the server and credentials to access your files.

machine repo.example.com
  login <user>
  password <pass>