Open hanrw opened 11 hours ago
The logic that builds the Package.swift
file checks the apple platforms you've defined for spm against the Kotlin target architectures you've defined. If you have an spm platform definition, but your build isn't actually building for that platform, it isn't written to your Package.swift
file.
For example, if your Kotlin gradle config looks like this:
kotlin {
listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64(),
macosArm64()
).forEach {
it.binaries.framework {
isStatic = true
}
}
}
kmmbridge {
gitHubReleaseArtifacts()
spm(swiftToolVersion = "5.8") {
iOS { v("14") }
macOS { v("13") }
}
}
The relevant part of the Package.swift
file will look like this:
let package = Package(
name: packageName,
platforms: [
.iOS(.v14),
.macOS(.v13)
],
products: [
// Etc
If you remove macosArm64()
it'll result in this:
let package = Package(
name: packageName,
platforms: [
.iOS(.v14)
],
products: [
// Etc
It might be confusing, but not an unreasonable solution to the question of what to do in that case. The choices would be:
I don't have a strong feeling either way, TBH. What I don't know is if there are potential downsides for declaring a platform that your framework doesn't actually implement. I don't know if it'll cause build issues, but it is kind of odd to declare it if it isn't supported.
by given:
expect:
but generated