Vhagar
06/20/2023, 3:27 AMVhagar
06/20/2023, 3:52 AMplugins {
kotlin("multiplatform")
kotlin("native.cocoapods")
id("com.android.library")
id("org.jetbrains.compose")
id("kotlin-parcelize")
}
kotlin {
android()
iosX64()
iosArm64()
iosSimulatorArm64()
cocoapods {
version = "1.0.0"
summary = "Some description for the Shared Module"
homepage = "Link to the Shared Module homepage"
ios.deploymentTarget = "14.1"
podfile = project.file("../iosApp/Podfile")
framework {
baseName = "shared"
isStatic = true
}
extraSpecAttributes["resources"] =
"['src/commonMain/resources/**', 'src/iosMain/resources/**']"
}
sourceSets {
val commonMain by getting {
dependencies {
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material)
@OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
implementation(compose.components.resources)
implementation("com.arkivanov.decompose:decompose:2.0.0-compose-experimental-beta-01")
implementation("com.arkivanov.decompose:extensions-compose-jetbrains:2.0.0-compose-experimental-beta-01")
implementation("com.arkivanov.essenty:lifecycle:1.1.0")
// Optional, only if you need state preservation on Darwin (Apple) targets
implementation("com.arkivanov.essenty:state-keeper:1.1.0")
// Optional, only if you need state preservation on Darwin (Apple) targets
implementation("com.arkivanov.parcelize.darwin:runtime:0.1.4")
}
}
val androidMain by getting {
dependencies {
api("androidx.activity:activity-compose:1.6.1")
api("androidx.appcompat:appcompat:1.6.1")
api("androidx.core:core-ktx:1.9.0")
}
}
val iosX64Main by getting
val iosArm64Main by getting
val iosSimulatorArm64Main by getting
val iosMain by creating {
dependsOn(commonMain)
iosX64Main.dependsOn(this)
iosArm64Main.dependsOn(this)
iosSimulatorArm64Main.dependsOn(this)
}
}
targets
.filterIsInstance<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget>()
.filter { it.konanTarget.family == org.jetbrains.kotlin.konan.target.Family.IOS }
.forEach {
it.binaries.framework {
export("com.arkivanov.decompose:2.0.0-compose-experimental-beta-01")
export("com.arkivanov.decompose:extensions-compose-jetbrains:2.0.0-compose-experimental-beta-01")
export("com.arkivanov.essenty:lifecycle:1.1.0")
// Optional, only if you need state preservation on Darwin (Apple) targets
export("com.arkivanov.essenty:state-keeper:1.1.0")
// Optional, only if you need state preservation on Darwin (Apple) targets
export("com.arkivanov.parcelize.darwin:runtime:0.1.4")
}
}
}
android {
compileSdk = (findProperty("android.compileSdk") as String).toInt()
namespace = "com.myapplication.common"
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
sourceSets["main"].res.srcDirs("src/androidMain/res")
sourceSets["main"].resources.srcDirs("src/commonMain/resources")
defaultConfig {
minSdk = (findProperty("android.minSdk") as String).toInt()
targetSdk = (findProperty("android.targetSdk") as String).toInt()
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlin {
jvmToolchain(11)
}
}
kotlin {
android()
iosX64()
iosArm64()
iosSimulatorArm64()
cocoapods {
version = "1.0.0"
summary = "Some description for the Shared Module"
homepage = "Link to the Shared Module homepage"
ios.deploymentTarget = "14.1"
podfile = project.file("../iosApp/Podfile")
framework {
baseName = "shared"
isStatic = true
}
extraSpecAttributes["resources"] =
"['src/commonMain/resources/**', 'src/iosMain/resources/**']"
}
sourceSets {
val commonMain by getting {
dependencies {
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material)
@OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
implementation(compose.components.resources)
implementation("com.arkivanov.decompose:decompose:2.0.0-compose-experimental-beta-01")
implementation("com.arkivanov.decompose:extensions-compose-jetbrains:2.0.0-compose-experimental-beta-01")
implementation("com.arkivanov.essenty:lifecycle:1.1.0")
}
}
val androidMain by getting {
dependencies {
api("androidx.activity:activity-compose:1.6.1")
api("androidx.appcompat:appcompat:1.6.1")
api("androidx.core:core-ktx:1.9.0")
}
}
val iosX64Main by getting
val iosArm64Main by getting
val iosSimulatorArm64Main by getting
val iosMain by creating {
dependsOn(commonMain)
iosX64Main.dependsOn(this)
iosArm64Main.dependsOn(this)
iosSimulatorArm64Main.dependsOn(this)
}
}
targets
.filterIsInstance<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget>()
.filter { it.konanTarget.family == org.jetbrains.kotlin.konan.target.Family.IOS }
.forEach {
it.binaries.framework {
export("com.arkivanov.decompose:2.0.0-compose-experimental-beta-01")
export("com.arkivanov.decompose:extensions-compose-jetbrains:2.0.0-compose-experimental-beta-01")
export("com.arkivanov.essenty:lifecycle:1.1.0")
}
}
}
android {
compileSdk = (findProperty("android.compileSdk") as String).toInt()
namespace = "com.myapplication.common"
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
sourceSets["main"].res.srcDirs("src/androidMain/res")
sourceSets["main"].resources.srcDirs("src/commonMain/resources")
defaultConfig {
minSdk = (findProperty("android.minSdk") as String).toInt()
targetSdk = (findProperty("android.targetSdk") as String).toInt()
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlin {
jvmToolchain(11)
}
}
Arkadii Ivanov
06/20/2023, 7:12 AMkotlin
section etc. in your build.gradle file? Also try using api
instead of implementation
for decompose
and lifecycle
dependencies.