Ahmed Mourad
09/12/2023, 12:06 PMAhmed Mourad
09/12/2023, 12:10 PMimport dev.icerock.gradle.MRVisibility
plugins {
kotlin("multiplatform")
kotlin("native.cocoapods")
id("com.android.library")
id("kotlin-parcelize")
id("org.jetbrains.compose")
id("dev.icerock.mobile.multiplatform-resources")
id("com.squareup.sqldelight")
id("com.google.devtools.ksp") version "1.8.0-1.0.9"
}
group = "dev.ahmedmourad.clockwise.common"
version = "1.0-SNAPSHOT"
kotlin {
android {
dependencies {
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.3")
}
}
jvm("desktop") {
jvmToolchain(17)
}
listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach { iosTarget ->
iosTarget.binaries.framework {
baseName = "common"
isStatic = true
}
}
cocoapods {
summary = "Some description for the Common Module"
homepage = "Link to the Common Module homepage"
version = "1.0"
ios.deploymentTarget = "14.1"
podfile = project.file("../ios/Podfile")
framework {
baseName = "common"
}
}
sourceSets {
val commonMain by getting {
dependencies {
//...
}
}
val commonTest by getting {
dependencies {
//...
}
}
val androidMain by getting {
dependencies {
//...
}
}
val androidUnitTest by getting {
dependencies {
//...
}
}
val androidInstrumentedTest by getting {
dependencies {
//...
}
}
val desktopMain by getting {
dependencies {
//...
}
}
val desktopTest by getting
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)
}
}
}
Ahmed Mourad
09/12/2023, 12:11 PMA problem occurred configuring project ':common'.
> Could not create task ':common:kspIosMainKotlinMetadata'.
> class org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile_Decorated cannot be cast to class org.jetbrains.kotlin.gradle.tasks.KotlinCompileCommon (org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile_Decorated and org.jetbrains.kotlin.gradle.tasks.KotlinCompileCommon are in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader @103c20a6)
Ahmed Mourad
09/12/2023, 12:14 PMval iosMain by creating {
dependsOn(commonMain)
}
The error changes to this:Ahmed Mourad
09/12/2023, 12:17 PMKonstantin Tskhovrebov
09/12/2023, 12:35 PMAhmed Mourad
09/12/2023, 12:47 PMlistOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach { iosTarget ->
iosTarget.binaries.framework {
baseName = "common"
isStatic = true
}
}
with this:
iosX64()
iosArm64()
iosSimulatorArm64()
it fixes the second case where iosMain
looks like this:
val iosMain by creating {
dependsOn(commonMain)
}
and the build is successful!!
If iosMain looks like this tho it still produces the first error:
val iosMain by creating {
dependsOn(commonMain)
iosX64Main.dependsOn(this)
iosArm64Main.dependsOn(this)
iosSimulatorArm64Main.dependsOn(this)
}
this's for the purpose of having one source set for all the ios variationsAhmed Mourad
09/12/2023, 12:55 PMios()
val iosMain by getting {
dependsOn(commonMain)
}
Jeff Lockhart
09/12/2023, 3:43 PMrusshwolf
09/12/2023, 6:57 PMAhmed Mourad
09/12/2023, 7:04 PMAhmed Mourad
09/12/2023, 7:24 PMconfigurations["ksp"].dependencies.add(project.dependencies.create("io.github.raamcosta.compose-destinations:ksp:1.8.42-beta"))
commenting out this line stops the error for now
Now though i'm getting this error when building ios:
e: java.lang.NullPointerException: null cannot be cast to non-null type org.jetbrains.kotlin.ir.declarations.IrFunction
at org.jetbrains.kotlin.backend.konan.lower.ExpectToActualDefaultValueCopier$copyDefaultArgumentsFromExpectToActual$1.visitValueParameter(ExpectDeclarationsRemoving.kt:227)
I removed all default arguments from all expect functions/classes but that didn't fix it
building desktop works fine, i assume android would as well because it did before, so only ios does thisJeff Lockhart
09/12/2023, 7:42 PMAhmed Mourad
09/12/2023, 8:27 PM