Files
Bitsy 05faaa7f7c feat(coil): vendor the Coil 3 stack for Kotlin/Native desktop
Coil 3.6.2 publishes linux + apple klibs for its core/network/svg modules but
NO mingwX64 anywhere, and NO desktop-native artifact at all for the compose
layer. The sources are target-agnostic, so the port re-declares the targets and
rebuilds them:

  :coil:coil-core            coil3.* core (Skia-based decoding)
  :coil:coil                 the singleton ImageLoader facade
  :coil:coil-compose-core    AsyncImage / rememberAsyncImagePainter internals
  :coil:coil-compose         the public compose entry points
  :coil:coil-svg             SVG decoding via skiko SVGDOM
  :coil:coil-network-core    shared network-fetcher plumbing
  :coil:coil-network-ktor3   Ktor 3 fetcher, on the port's existing ktor pin

Vendored VERBATIM from coil-kt/coil @ 3.6.2 (new COIL_REF pin + manifests);
152 files, zero local edits - all of it compiled unmodified.

SOURCE-SET COLLAPSE: the port has no android, jvm or js target, so upstream's
nonAndroidMain / nonJvmCommonMain / nonJsCommonMain all apply to every target
here. They do NOT merge into nativeMain though: several declare `expect`s whose
`actual`s live in upstream nativeMain, and siblings in one source set is a hard
error. So they keep their own level above it.

TWO PARALLEL SKIKO BRANCHES in coil-core / coil-svg / coil-compose-core:
upstream's non-android code uses org.jetbrains.skia.* directly, so the
INTERMEDIATE source set holding it needs skiko on its own compile classpath (a
shared-metadata compilation is a real compile). macOS/Linux take the official
skiko and mingwX64 takes the bitsycore fork, and the two cannot share an
intermediate - so mingw gets a parallel branch over the same srcDirs, the same
shape :compose:ui:ui-graphics already uses. Kotlin emits no metadata
compilation for the single-target fork branch, so the two never collide.

coil-compose-core declares the whole ui / foundation family DIRECTLY rather
than leaning on foundation's transitives - the granular-metadata trap from
CLAUDE.md's "Common pitfalls": a substituted coord's transitives drop off the
commonMain metadata classpath.

Published as com.bitsycore.coil3:<module>; bridge substitution rules added so
consumers keep declaring the official io.coil-kt.coil3 coordinates.
2026-09-12 00:30:01 +02:00

70 lines
3.1 KiB
Kotlin

// :coil:coil-compose-core - AsyncImage / rememberAsyncImagePainter internals, vendored
// VERBATIM from coil-kt/coil. Upstream publishes NO desktop-native klibs for the
// compose layer at all (neither mingwX64 nor linux), so this whole module exists to
// give the port its targets. Compose coords substitute to the port's project modules
// on every native configuration (root build's commonization bridge).
plugins {
alias(libs.plugins.kotlin.multiplatform)
alias(libs.plugins.kotlin.plugin.compose)
}
val vHostSupportsMingw = rootProject.extra["vHostSupportsMingw"] as Boolean
kotlin {
linuxArm64(); linuxX64(); macosArm64(); if (vHostSupportsMingw) mingwX64()
applyDefaultHierarchyTemplate()
sourceSets {
commonMain {
dependencies {
api(project(":coil:coil-core"))
// Declared DIRECTLY, not leaned on transitively: these coords are
// SUBSTITUTED to the port's project modules on native configurations,
// and KGP's granular-metadata visibility rule then drops the substituted
// module's transitives from the commonMain metadata classpath (CLAUDE.md
// "Common pitfalls"). Every artifact the vendored common code touches
// needs its own declaration + its own bridge rule.
api("org.jetbrains.compose.runtime:runtime:${libs.versions.composeRuntime.get()}")
api("org.jetbrains.compose.ui:ui:${libs.versions.compose.get()}")
api("org.jetbrains.compose.ui:ui-graphics:${libs.versions.compose.get()}")
api("org.jetbrains.compose.ui:ui-text:${libs.versions.compose.get()}")
api("org.jetbrains.compose.ui:ui-unit:${libs.versions.compose.get()}")
api("org.jetbrains.compose.ui:ui-geometry:${libs.versions.compose.get()}")
api("org.jetbrains.compose.ui:ui-util:${libs.versions.compose.get()}")
api("org.jetbrains.compose.foundation:foundation:${libs.versions.compose.get()}")
api("org.jetbrains.compose.foundation:foundation-layout:${libs.versions.compose.get()}")
}
kotlin.srcDir("src/vendor/common/kotlin")
}
// Upstream's nonAndroid compose layer reaches straight into org.jetbrains.skia
// (Canvas / Bitmap.asComposeImageBitmap), so it needs skiko on its own compile
// classpath - official for macOS/Linux, the bitsycore FORK for mingwX64, on two
// PARALLEL branches. See coil/coil-core/build.gradle.kts.
fun nonAndroidBranch(inName: String, inSkiko: Any) = create("${inName}NonAndroidMain") {
dependsOn(commonMain.get())
kotlin.srcDir("src/vendor/nonAndroid/kotlin")
dependencies { implementation(inSkiko) }
}
val vOfficial = nonAndroidBranch("coilComposeOfficial", libs.skiko)
get("macosArm64Main").dependsOn(vOfficial)
get("linuxX64Main").dependsOn(vOfficial)
get("linuxArm64Main").dependsOn(vOfficial)
if (vHostSupportsMingw) {
val vFork = nonAndroidBranch(
"coilComposeFork",
"com.bitsycore.skiko:skiko:${providers.gradleProperty("skikoMingwVersion").getOrElse(libs.versions.skikoMingw.get())}",
)
get("mingwX64Main").dependsOn(vFork)
}
}
compilerOptions {
freeCompilerArgs.addAll(
"-Xexpect-actual-classes",
"-opt-in=coil3.annotation.InternalCoilApi",
"-opt-in=coil3.annotation.ExperimentalCoilApi",
"-opt-in=coil3.annotation.DelicateCoilApi",
)
}
}