Skip to content

Commit 182a378

Browse files
committed
fix: iOS cinterop on all hosts + jsProcessResources wasm deps
Two fixes to unbreak :pdfium:check on Linux. - Drop the Os.isFamily(FAMILY_MAC) guard around iOS cinterop. Kotlin/Native cross-compiles iOS klibs on any host and cinterop only needs the staged PDFium headers; libraryPaths/linkerOpts are only consumed at final link time (macOS). Previously all dev.nucleusframework.pdfium.native.* imports were unresolved on Linux, so compileKotlinIosSimulatorArm64 failed. - Wire installPdfiumWasm + generatePdfiumWasmRuntime as explicit deps of jsProcessResources too, not just wasmJsProcessResources. Both read from src/webMain/resources/pdfium, and Gradle 9 enforces this implicit-dep check strictly.
1 parent 33b5f23 commit 182a378

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

pdfium/build.gradle.kts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -114,17 +114,15 @@ kotlin {
114114
}
115115
}
116116

117-
// iOS targets are always declared so downstream KMP modules can resolve them on any host.
118-
// On non-Mac hosts the actual compilation is disabled via kotlin.native.ignoreDisabledTargets.
117+
// iOS targets are cross-compilable from any host (Kotlin/Native ships the
118+
// necessary toolchain). The cinterop only needs the staged PDFium headers —
119+
// libraryPaths/linkerOpts are consumed at final link time on macOS only.
119120
val iosTargets = listOf(iosArm64(), iosSimulatorArm64())
120-
121-
if (Os.isFamily(Os.FAMILY_MAC)) {
122-
iosTargets.forEach { target ->
123-
target.compilations.getByName("main") {
124-
cinterops.create("pdfium") {
125-
defFile(project.file("src/nativeInterop/cinterop/pdfium.def"))
126-
packageName("dev.nucleusframework.pdfium.native")
127-
}
121+
iosTargets.forEach { target ->
122+
target.compilations.getByName("main") {
123+
cinterops.create("pdfium") {
124+
defFile(project.file("src/nativeInterop/cinterop/pdfium.def"))
125+
packageName("dev.nucleusframework.pdfium.native")
128126
}
129127
}
130128
}
@@ -534,7 +532,10 @@ tasks.named("jvmProcessResources") {
534532
dependsOn(installPdfiumJvmResources, buildJniLinux, buildJniMacOs, buildJniWindows, buildJniWindowsArm)
535533
}
536534

537-
tasks.named("wasmJsProcessResources") {
535+
// Both wasmJs and js source sets read staged pdfium.wasm + runtime glue from
536+
// webMain resources; wire the install/generate tasks as explicit deps of every
537+
// processResources task that copies from that directory.
538+
tasks.matching { it.name == "wasmJsProcessResources" || it.name == "jsProcessResources" }.configureEach {
538539
dependsOn(installPdfiumWasm, generatePdfiumWasmRuntime)
539540
}
540541

0 commit comments

Comments
 (0)