Skip to content

Commit b66d595

Browse files
committed
Simplify link logic
1 parent f0aeca4 commit b66d595

File tree

3 files changed

+20
-35
lines changed

3 files changed

+20
-35
lines changed

PowerSyncKotlin/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ kotlin {
1717
macosArm64(),
1818
macosX64(),
1919
watchosDeviceArm64(),
20-
watchosArm32(),
2120
watchosArm64(),
2221
watchosSimulatorArm64(),
2322
watchosX64(),

plugins/build-plugin/src/main/kotlin/SharedBuildPlugin.kt

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -57,42 +57,29 @@ class SharedBuildPlugin : Plugin<Project> {
5757
.targets
5858
.withType<KotlinNativeTarget>()
5959
.configureEach {
60-
if (konanTarget.family == Family.IOS &&
61-
konanTarget.name.contains(
62-
"simulator",
63-
)
64-
) {
65-
binaries
66-
.withType<org.jetbrains.kotlin.gradle.plugin.mpp.TestExecutable>()
67-
.configureEach {
68-
linkTaskProvider.configure { dependsOn(unzipPowersyncFramework) }
69-
linkerOpts("-framework", "powersync-sqlite-core")
60+
val abiName = when(konanTarget.family) {
61+
Family.OSX -> "macos-arm64_x86_64"
62+
// We're testing on simulators
63+
Family.IOS -> "ios-arm64_x86_64-simulator"
64+
Family.WATCHOS -> "watchos-arm64_x86_64-simulator"
65+
else -> return@configureEach
66+
}
7067

71-
val frameworkRoot =
72-
binariesFolder
73-
.map { it.dir("framework/extracted/powersync-sqlite-core.xcframework/ios-arm64_x86_64-simulator") }
74-
.get()
75-
.asFile.path
68+
binaries
69+
.withType<org.jetbrains.kotlin.gradle.plugin.mpp.TestExecutable>()
70+
.configureEach {
71+
linkTaskProvider.configure { dependsOn(unzipPowersyncFramework) }
72+
linkerOpts("-framework", "powersync-sqlite-core")
7673

77-
linkerOpts("-F", frameworkRoot)
78-
linkerOpts("-rpath", frameworkRoot)
79-
}
80-
} else if (konanTarget.family == Family.OSX) {
81-
binaries
82-
.withType<org.jetbrains.kotlin.gradle.plugin.mpp.TestExecutable>()
83-
.configureEach {
84-
linkTaskProvider.configure { dependsOn("unzipPowersyncFramework") }
85-
linkerOpts("-framework", "powersync-sqlite-core")
86-
var frameworkRoot =
87-
binariesFolder
88-
.map { it.dir("framework/extracted/powersync-sqlite-core.xcframework/macos-arm64_x86_64") }
89-
.get()
90-
.asFile.path
74+
val frameworkRoot =
75+
binariesFolder
76+
.map { it.dir("framework/extracted/powersync-sqlite-core.xcframework/$abiName") }
77+
.get()
78+
.asFile.path
9179

92-
linkerOpts("-F", frameworkRoot)
93-
linkerOpts("-rpath", frameworkRoot)
94-
}
95-
}
80+
linkerOpts("-F", frameworkRoot)
81+
linkerOpts("-rpath", frameworkRoot)
82+
}
9683
}
9784
}
9885
}

plugins/sonatype/src/main/kotlin/com/powersync/plugins/utils/KmpUtils.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ public fun KotlinTargetContainerWithPresetFunctions.powersyncTargets(
4141

4242
if (watchOS) {
4343
watchosDeviceArm64() // aarch64-apple-watchos
44-
watchosArm32() // armv7k-apple-watchos
4544
watchosArm64() // arm64_32-apple-watchos
4645

4746
watchosSimulatorArm64() // aarch64-apple-watchos-simulator

0 commit comments

Comments
 (0)