diff --git a/composeApp/build.gradle.kts b/composeApp/build.gradle.kts index e5e4f631..335ed72d 100644 --- a/composeApp/build.gradle.kts +++ b/composeApp/build.gradle.kts @@ -1,5 +1,6 @@ import org.jetbrains.compose.desktop.application.dsl.TargetFormat import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import javax.inject.Inject plugins { alias(libs.plugins.androidApplication) @@ -88,6 +89,7 @@ kotlin { + implementation(libs.lightning.kmp.app) implementation(libs.lightning.kmp.core) implementation(libs.navigation.compose) @@ -154,7 +156,37 @@ android { } } +// JitPack rewrites the version inside a published .module file, and in doing so drops the classifier +// from every artifact name -- so lightning-kmp-app's apple targets advertise their host-specific +// metadata as `library--.jar` when it is actually served as `...--metadata.jar`. +// The klib and the aar are unaffected (android compiles either way); this only bites the metadata +// compilations, which is what every shared ios source set resolves through. Restore the classifier. +abstract class RestoreJitPackClassifier @Inject constructor( + private val variant: String, +) : ComponentMetadataRule { + override fun execute(context: ComponentMetadataContext) { + val id = context.details.id + context.details.withVariant(variant) { + withFiles { + removeAllFiles() + addFile("${id.name}-${id.version}-metadata.jar") + } + } + } +} + dependencies { + components { + mapOf( + "library-iosarm64" to "iosArm64MetadataElements-published", + "library-iossimulatorarm64" to "iosSimulatorArm64MetadataElements-published", + ).forEach { (module, variant) -> + withModule("com.github.kngako.lightning-kmp-app:$module") { + params(variant) + } + } + } + debugImplementation(libs.compose.uiTooling) // ksp(libs.androidx.room3.compiler) add("kspAndroid", libs.androidx.room3.compiler) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 860979a2..6ba49df2 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -21,6 +21,10 @@ kotlinx-datetime = "0.8.0" kotlinxSerialization = "1.11.0" ksp = "2.3.6" ktor = "3.5.0" +# pinned to a commit, not master-SNAPSHOT: jitpack advertises a unique-snapshot maven-metadata for +# -SNAPSHOT versions but serves the files under their literal -SNAPSHOT names, so gradle looks for +# library--master--1.klib and gets a 404. bump this when the fork moves. +lightningKmpApp = "59cc3e3c15" lightningKmpCore = "1.11.5" material3 = "1.10.0-alpha05" materialIconsCore = "1.7.3" @@ -76,6 +80,7 @@ ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" } ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" } ktor-client-websockets = { module = "io.ktor:ktor-client-websockets", version.ref = "ktor" } ktor-serialization-kotlinx-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" } +lightning-kmp-app = { module = "com.github.kngako.lightning-kmp-app:library", version.ref = "lightningKmpApp" } lightning-kmp-core = { module = "fr.acinq.lightning:lightning-kmp-core", version.ref = "lightningKmpCore" } navigation-compose = { module = "org.jetbrains.androidx.navigation:navigation-compose", version.ref = "navigationCompose" } okhttp-coroutines = { group = "com.squareup.okhttp3", name = "okhttp-coroutines", version.ref = "okhttp" } diff --git a/settings.gradle.kts b/settings.gradle.kts index 6e6e3daf..96532c1c 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -25,6 +25,11 @@ dependencyResolutionManagement { } } mavenCentral() + maven("https://jitpack.io") { + mavenContent { + includeGroupAndSubgroups("com.github.kngako") + } + } } }