prof18 / kmp-fatframework-cocoa Goto Github PK
View Code? Open in Web Editor NEWA Gradle plugin to generate and publish an iOs FatFramework or XCFramework on Kotlin Multiplatform projects.
License: Apache License 2.0
A Gradle plugin to generate and publish an iOs FatFramework or XCFramework on Kotlin Multiplatform projects.
License: Apache License 2.0
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.
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).
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.