Coder Social home page Coder Social logo

touchlab / kmmbridge Goto Github PK

View Code? Open in Web Editor NEW
330.0 14.0 18.0 15.12 MB

KMMBridge is a set of Gradle tooling that facilitates publishing and consuming pre-built KMM (Kotlin Multiplatform Mobile) Xcode Framework binaries. See https://kmmbridge.touchlab.co/docs to get started.

Home Page: https://kmmbridge.touchlab.co/

License: Apache License 2.0

Kotlin 32.71% JavaScript 56.03% TypeScript 0.37% CSS 10.89%
binary framework ios kmm kotlin mobile multiplatform publish xcode

kmmbridge's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kmmbridge's Issues

Draft SPM_DEVELOPMENT.md doc

This should include:

  • How to add a published SPM project repo from Github
  • How to configure the Package.swift file for local dev
  • How to drag the local dev folder into Xcode
  • How to run gradle locally to rebuild the framework

Version should check for semver?

Ideally we could mandate that version prefixes are compatible with semantic versioning, or at least whatever is compatible with SPM and cocoapods. It may be sufficient to have a warning about it.

Move gradle extension config to extension methods

The FaktoryExtension/KMMBridgeExtension has helper methods specific to certain types of artifact and dependency managers. Since these will probably grow and be added to by others, it would make sense to move this config into Kotlin extension methods that live with the implementations.

So, for example, this method is directly in the Gradle extension class:

interface FaktoryExtension
    //etc
    fun s3Public(
        region: String,
        bucket: String,
        accessKeyId: String,
        secretAccessKey: String,
        makeArtifactsPublic: Boolean,
        altBaseUrl: String?
    ) {
        artifactManager.set(
            AwsS3PublicArtifactManager(
                region,
                bucket,
                accessKeyId,
                secretAccessKey,
                makeArtifactsPublic,
                altBaseUrl,
                this
            )
        )
    }
    //etc
}

It would make more sense to do this in the AwsS3PublicArtifactManager file:

fun FaktoryExtension.s3Public(
    region: String,
    bucket: String,
    accessKeyId: String,
    secretAccessKey: String,
    makeArtifactsPublic: Boolean,
    altBaseUrl: String?
) {
    artifactManager.set(
        AwsS3PublicArtifactManager(
            region,
            bucket,
            accessKeyId,
            secretAccessKey,
            makeArtifactsPublic,
            altBaseUrl,
            this
        )
    )
}

class AwsS3PublicArtifactManager(
    private val s3Region: String,
    private val s3Bucket: String,
//etc

This will allow us to have separate extension modules that don't need to be included in the main module, or possibly even private extensions.

Release checklist

  • Add OSS License!!!
  • Update plugin version in readme
  • Link to KMM Bridge blog post in readme (does not exist yet)
  • Link to Repo in blog posts
  • Scan github issues and git history for sensitive info
  • Make Repos public
    • KMMBridge
    • Samples
    • Podspec
  • Double check that JB's post links correctly
    • Also confirm all the other links are right such as touchlabHQ and touchlab.co
  • Publish a version of the KMM Bridge Actions workflow (not main)
  • Change samples and docs to use version
  • Review samples
  • Update docs
  • Update versions (plugin, etc)

Add to this list as we're prepping release...

Doc: COCOAPODS_GITHUB_PODSPEC.md

Move relevent info from GitHubCI.md to COCOAPODS_GITHUB_PODSPEC.md. It should cover:

  • Creating a repo. It is critical that there's at least one commit, so add a readme (it doesn't work without a commit)
  • Adding/creating deploy keys (remove Gitlab reference. We'll need to look into that later)
  • Adding the spec repo to your kotlin config

Please include screenshots for the web UI for the deploy keys sections, and what the spec repo should look like after a release has been successfully published.

On adding to CI, I'd just link out to the default flow file section that does this rather than trying to explain (Link: https://github.com/touchlab/KMMBridgeGithubWorkflow/blob/f6075b60151caf15b8759c811b0d2458fbdd08a7/.github/workflows/faktorybuild.yml#L21)

Quick setup

Doc explaining a simple working setup using github files.

Docs for creating a custom artifact manager

We can leave this relatively sparse. Just explain what the methods do and point to the public examples. Actually getting access to private artifacts can be rather complicated, so whoever is attempting to do this will have a lot to figure out on their own. Quick starter docs would be useful, though.

Use gradle publishing to push zip artifacts

Can we use some Gradle standard publishing mechanism to push zip artifacts? This might let us push to github artifacts, Artifactory, or any of several other options.

Specifically, we'll need a way to publish files, then get a reference to the published zip file itself. A direct URL that we can put in file configs.

Note: We may not be able to access all of them from Xcode, depending on how auth is handled. We'll likely need to be able to access them through ~/.netrc, which means some form of simple user/password. However, this is a separate concern we'll need to test with each publishing target. We should add specific tasks to test publishing and consuming each we'd intend to support.

Doc: Complete IOS_DEV_SETUP.md

Complete the iOS dev setup doc. Needs the SPM and Cocoapods sections, with solid descriptions and screenshots where applicable.

[Spike]Multiple framework modules

Can we support multiple framework modules in a single repo? What is the current state?
It will probably look different for SPM and cocoapods

Define tasks based on your findings

Github release artifact publishing

According to this blog post, https://medium.com/geekculture/xcode-13-3-supports-spm-binary-dependency-in-private-github-release-8d60a47d5e45, SPM should be able to support private binary release zip files as of Xcode 13.3. It also seems plausible that cocoapods could support the same. This could easily become the default for teams publishing frameworks.

Try pushing a release with this, probably using github actions first rather than trying to directly integrate with github.

Remove url file and write url directly as part of dependency management

The only thing we still write to the ".faktory" folder is the URL file. It should be pretty simple to pass that into the DependencyManager somehow rather than writing it to the file system and reading it again. Not entirely sure of the best way of doing that, but having it in the file system is kind of confusing.

Remove jbXcFrameworkBuild from configureDeploy

We're managing setup of the XCFramework config. If we want to use external config, there's a lot that depends on it and we'll need to think through that and sort out dependencies and testing. That was added when the plugin was much simpler.

Review SPM publish git interactions

The SPM Dependency manager arguably does a bit too much when interacting with git. It defaults to using tags vs releases, and actually overwrites, then reverses the Package.swift file. This is all useful for a specific config, but may not be how everybody wants SPM to work specifically. Some of this may be better split out or made configurable.

Deploy Keys section could use some more detail

We're specifically describing Github, although the intro suggests Gitlab also supports deploy keys. I think we should create sections for Github and Gitlab (we can leave Gitlab as "todo"), and add screenshots for Github.

All version managers should write to git tags

For SPM versioning to work properly, we need git tags to have the version info. Currently, only the GitReleaseVersionManager and GitTagVersionManager actually write versions. TimestampVersionManager and ManualVersionManager should also implement this.

Alternatively, we should come up with some form of writing versions that is a different abstraction.

Doc: Remove CI Https for Cocoapods

After looking at the docs and the samples, I agree that CI with Https isn't worth it, so we should just remove CocoapodsCIHttps.md and make sure nothing points to it (I don't think so). If there's anything in there of use, we can pull it out.

Gradle caches some tasks from KMMBridge plugin that should not be cached

Tasks that generate podspec file have incorrectly configured caching. As a result, Gradle skips execution of those tasks on consecutive runs. However, these tasks must always be executed because they update the published artifact version in the podspec file.

They are probably missing something like:

outputs.upToDateWhen { false }

Add support for custom maven publish

maven publish needs the uploadXCFramework task to depend on maven's publish task, but the ArtifactManager interface doesn't currently support that.

Proposal:
Add a fun configure(project: Project, uploadTask: Task, publishRemoteTask: Task) {} to ArtifactManager similar to DependencyManager. This gives a location where it can configure task dependencies it needs. Call that function in the same place that the DependencyManager function is called.

Add a MavenPublishArtifactManager. It can take as input the name of the publication or whatever other metadata it needs to find the correct publish task. Then it calls uploadTask.dependsOn(pubishWhateverPublicationTask) in configure() and returns the url in deployArtifact().

Sample bashing

Find projects to test our configuration against. Look for and report any issues

Check if version exists before publishing anything

The dependency manager implementations both "publish" versions, but we push artifacts before we know if those versions are valid. The DependencyManager interface should have a "checkVersionExists" function that tells you if a version already exists, and we should call them before pushing artifacts.

Version Manager should be optional

We should make version manager optional, so by default, the version used is whatever would normally be used from gradle. Adding a version manager then enables automatic version incrementing.

The Github releases artifact manager currently depends on a version prefix, but this is a somewhat arbitrary decision and can be simplified.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.