Osman Saral
09/16/2021, 12:25 PMStefan Oltmann
09/16/2021, 12:25 PMOsman Saral
09/16/2021, 12:26 PMval iosTarget: (String, KotlinNativeTarget.() -> Unit) -> KotlinNativeTarget =
when {
System.getenv("SDK_NAME")?.startsWith("iphoneos") == true -> ::iosArm64
System.getenv("NATIVE_ARCH")?.startsWith("arm") == true -> ::iosSimulatorArm64
else -> ::iosX64
}
val xcf = XCFramework()
iosTarget("ios") {
binaries.framework {
baseName = "KMM"
xcf.add(this)
}
}
Stefan Oltmann
09/16/2021, 12:26 PMval xcf = XCFramework()
/* App Store */
iosArm64 {
binaries.framework {
baseName = "shared"
embedBitcode("bitcode")
xcf.add(this)
}
}
/* iOS Simulator M1 */
iosSimulatorArm64 {
binaries.framework {
baseName = "shared"
xcf.add(this)
}
}
/* Apple Silicon macOS Devices */
macosArm64 {
binaries.framework {
baseName = "shared"
xcf.add(this)
}
}
val commonMain by sourceSets.getting {
sourceSets["commonMain"].kotlin.srcDir(file("build/generated/source/commonMain/"))
dependencies {
// ...
}
}
val commonTest by sourceSets.getting {
dependencies {
// ...
}
}
val iosArm64Main by sourceSets.getting
val iosArm64Test by sourceSets.getting
val iosSimulatorArm64Main by sourceSets.getting
val iosSimulatorArm64Test by sourceSets.getting
val macosArm64Main by sourceSets.getting
val macosArm64Test by sourceSets.getting
val appleMain by sourceSets.creating {
iosArm64Main.dependsOn(this)
iosSimulatorArm64Main.dependsOn(this)
macosArm64Main.dependsOn(this)
dependencies {
// ...
}
}
val appleTest by sourceSets.creating {
iosArm64Test.dependsOn(this)
iosSimulatorArm64Test.dependsOn(this)
macosArm64Test.dependsOn(this)
}
Osman Saral
09/16/2021, 12:51 PMStefan Oltmann
09/16/2021, 12:52 PMOsman Saral
09/16/2021, 12:53 PMStefan Oltmann
09/16/2021, 12:54 PMOsman Saral
09/16/2021, 12:56 PMStefan Oltmann
09/16/2021, 12:58 PMOsman Saral
09/16/2021, 1:15 PMStefan Oltmann
09/16/2021, 1:18 PMOsman Saral
09/16/2021, 2:06 PMStefan Oltmann
09/16/2021, 2:07 PMOsman Saral
09/16/2021, 2:07 PMStefan Oltmann
09/16/2021, 2:08 PMOsman Saral
09/16/2021, 2:08 PMStefan Oltmann
09/16/2021, 2:09 PMOsman Saral
09/16/2021, 2:09 PMStefan Oltmann
09/16/2021, 2:10 PMOsman Saral
09/16/2021, 2:11 PMStefan Oltmann
09/16/2021, 2:11 PM/* iOS Simulator Intel */
iosX64 {
binaries.framework {
baseName = "shared"
xcf.add(this)
}
}
Osman Saral
09/16/2021, 8:34 PMappleMain
source sets etc. did you get this error too:
Failed building KotlinMPPGradleModel
org.gradle.internal.resolve.ArtifactNotFoundException: Could not find ktor-client-ios-1.6.3-samplessources.jar (io.ktorktor client ios1.6.3).
I've found this issue https://youtrack.jetbrains.com/issue/KTIJ-10769 how did you resolve this?Stefan Oltmann
09/17/2021, 6:16 AMOsman Saral
09/17/2021, 9:12 AMStefan Oltmann
09/17/2021, 9:14 AMMichal Klimczak
09/17/2021, 9:35 AMsourceSets["commonMain"].kotlin.srcDir(file("build/generated/source/commonMain/"))
- does it mean that we need to manually declare the source sets now?Stefan Oltmann
09/17/2021, 9:37 AMMichal Klimczak
09/17/2021, 9:44 AMiosSimulatorArm64 {
binaries.framework {
baseName = "shared"
xcf.add(this)
}
}
the source roots get messed up.
But when I get rid of it, they are fine again.Stefan Oltmann
09/17/2021, 9:45 AMiosSimulatorArm64Main.dependsOn(this)
stuff?Osman Saral
09/17/2021, 9:46 AMMichal Klimczak
09/17/2021, 9:46 AMkoin
in commonMain
Stefan Oltmann
09/17/2021, 9:47 AMkoin
and doing manual DI there is no problem for me.Michal Klimczak
09/17/2021, 12:00 PMsamplesourcesjar
and indeed it did for my koin example (I completely missed that). The fix is going to be to show an error message which will precisely explain the issue along with telling you which libs are at fault.
You can track it here: https://youtrack.jetbrains.com/issue/KTIJ-10769
As far as I understood, it depends on IDE, not just kotlin plugin, so Android Studio users will have to wait a bit for a proper fix.Stefan Oltmann
09/17/2021, 12:14 PMSebastian Sellmair [JB]
10/06/2021, 10:21 AM