Giter Site home page Giter Site logo

prof18 / kmp-fatframework-cocoa Goto Github PK

View Code? Open in Web Editor NEW
27.0 3.0 2.0 252 KB

A Gradle plugin to generate and publish an iOs FatFramework or XCFramework on Kotlin Multiplatform projects.

License: Apache License 2.0

Kotlin 100.00%
kotlin-multiplatform gradle-plugin cocoapods cocoapod xcframework

kmp-fatframework-cocoa's Issues

Supporting Swift Package Manager

Thanks for this plugin ๐Ÿ˜„ !

We have a private fork which adds support for Swift package manager. This fork uses the same logic and steps you did for Cocoapods and tunes it to SPM.

Would be happy submit a PR and work to get it merged if that's a direction you want to take.

InvalidUserDataException - after adding the plugin

Hi, after adding your plugin, I'm getting the below error:
Caused by: org.gradle.api.InvalidUserDataException: You must provide the property frameworkName

My build.gradle.kts for reference:

import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget

plugins {
    kotlin("multiplatform")
    kotlin("native.cocoapods")
    id("com.android.library")
    id("org.jetbrains.dokka") version Versions.dokka
    id("maven-publish")
    id("signing")
    id("com.prof18.kmp.fatframework.cocoa") version "0.2.1"
}

group = "com.msabhi"
version = "1.0.2-RC"

kotlin {
    jvm {
        compilations.all {
            kotlinOptions.jvmTarget = "1.8"
        }
        testRuns["test"].executionTask.configure {
            useJUnit()
        }
    }
    android {
        //publishLibraryVariants("release", "debug")
        publishAllLibraryVariants()
    }
    js(BOTH) {
        browser()
        nodejs()
    }
    ios()
    watchos()
    tvos()
    macosX64()
    linuxX64()
    mingwX64()
    sourceSets {
        val commonMain by getting {
            dependencies {
                implementation(Dependencies.Coroutines.common)
            }
        }
        val commonTest by getting {
            dependencies {
                implementation(Dependencies.KotlinTest.common)
                implementation(Dependencies.KotlinTest.annotations)
            }
        }
        val jvmMain by getting {
            dependencies {
                implementation(kotlin("reflect", Versions.kotlin))
            }
        }
        val jvmTest by getting {
            dependencies {
                implementation(Dependencies.KotlinTest.jvm)
                implementation(Dependencies.KotlinTest.junit)
                implementation(Dependencies.Coroutines.test)
                implementation(Dependencies.AndroidTest.core)
                implementation(Dependencies.AndroidTest.junit)
                implementation(Dependencies.AndroidTest.runner)
                implementation(Dependencies.AndroidTest.rules)
            }
        }
        val androidMain by getting {
            dependencies {
                implementation(kotlin("reflect", Versions.kotlin))
                implementation(Dependencies.Coroutines.android)
                implementation(Dependencies.Android.lifecycleRuntime)
                implementation(Dependencies.Android.lifecycleViewModel)
            }
        }
        val androidTest by getting {
            dependsOn(jvmTest)
        }
        val jsMain by getting
        val jsTest by getting {
            dependencies {
                implementation(kotlin("test-js", Versions.kotlin))
            }
        }
        val nativeMain by creating {
            dependsOn(commonMain)
        }
        val nativeTest by creating {
            dependsOn(commonTest)
        }
        val appleMain by creating {
            dependsOn(commonMain)
        }
        val appleTest by creating {
            dependsOn(commonTest)
        }
        val iosMain by getting {
            dependsOn(appleMain)
        }
        val iosTest by getting {
            dependsOn(appleTest)
        }
        val watchosMain by getting {
            dependsOn(appleMain)
        }
        val watchosTest by getting {
            dependsOn(appleTest)
        }
        val tvosMain by getting {
            dependsOn(appleMain)
        }
        val tvosTest by getting {
            dependsOn(appleTest)
        }
        val macosX64Main by getting {
            dependsOn(appleMain)
        }
        val macosX64Test by getting {
            dependsOn(appleTest)
        }
        val linuxX64Main by getting {
            dependsOn(nativeMain)
        }
        val linuxX64Test by getting {
            dependsOn(nativeTest)
        }
        val mingwX64Main by getting {
            dependsOn(nativeMain)
        }
        val mingwX64Test by getting {
            dependsOn(nativeTest)
        }
        cocoapods {
            // Configure fields required by CocoaPods.
            summary = "DryRunKotlinMPP Kotlin/Native module CocoaPods"
            homepage = "https://github.com/abhimuktheeswarar/DryRunKotlinMPP"
        }
    }
}

android {
    compileSdkVersion(Versions.Android.compileSdk)
    sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
    defaultConfig {
        minSdkVersion(Versions.Android.minSdk)
        targetSdkVersion(Versions.Android.targetSdk)
    }
    //Sample
    dependencies {
        debugImplementation(kotlin("reflect", Versions.kotlin))
    }
}

val packForXcode by tasks.creating(Sync::class) {
    group = "build"
    val mode = System.getenv("CONFIGURATION") ?: "DEBUG"
    val sdkName = System.getenv("SDK_NAME") ?: "iphonesimulator"
    val targetName = "ios" + if (sdkName.startsWith("iphoneos")) "Arm64" else "X64"
    val framework =
        kotlin.targets.getByName<KotlinNativeTarget>(targetName).binaries.getFramework(mode)
    inputs.property("mode", mode)
    dependsOn(framework.linkTask)
    val targetDir = File(buildDir, "xcode-frameworks")
    from({ framework.outputDirectory })
    into(targetDir)
}

tasks.getByName("build").dependsOn(packForXcode)

//----------------------------------------------------------------------------------

val dokkaOutputDir = "$buildDir/docs"

tasks.dokkaHtml.configure {
    outputDirectory.set(file(dokkaOutputDir))
}

val deleteDokkaOutputDir by tasks.register<Delete>("deleteDokkaOutputDirectory") {
    delete(dokkaOutputDir)
}

val javadocJar = tasks.register<Jar>("javadocJar") {
    dependsOn(deleteDokkaOutputDir, tasks.dokkaHtml)
    archiveClassifier.set("javadoc")
    from(dokkaOutputDir)
}

publishing {
    
}

signing {
   
}

Another suggestion:
Though its good to have a develop branch for debug. It would be great, if you can make that optional.
My understanding is that, gradle cocoapods plugin generates the framework in build directory & the podspec in shared module's folder. So, if we could have a task, that copies / run the gradle cocoapods task, move / copy the generated .framework to a folder & copy / move the podspec file, optionally commit the git & push it to cocoapods trunk (for public use).

Plugin is building framework only for arm64 and X64

Hello,

I am trying to provide Cocoapod repository for our iOS team. I expected that the plugin will built the pod for all the architectures (x64, armv7, armv7s and arm64).

However, when we check the supported architectures via this command: lipo -info [nameOfFramework] it shows this message:

Architectures in the fat file: [nameOfFramework] are: x86_64 arm64

Did I miss some way how to config the plugin? My goal is to be able to deliver framework which run on all iPhone devices and simulator.

Thank you.

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.