voize-gmbh / reakt-native-toolkit

Combine React Native with Kotlin Multiplatform (KMP)
Apache License 2.0
134 stars 5 forks source link

Could not find reakt-native-toolkit-iosX64Main-0.16.0.klib #60

Closed charlee-dev closed 4 months ago

charlee-dev commented 5 months ago

Hi. The time for dependency update came and i'm are bumping from 0.5.0... so it's been a while... ;)

When trying to bump to 0.16.0 i get:

:bridge:iosX64Main: Could not find reakt-native-toolkit.klib (de.voize:reakt-native-toolkit-iosx64:0.16.0).
Searched in the following locations:
    https://plugins.gradle.org/m2/de/voize/reakt-native-toolkit-iosx64/0.16.0/reakt-native-toolkit-iosx64-0.16.0.klib

I successfully managed to sync the0.15.0

Legion2 commented 5 months ago

The search paths do not look right, gradle is looking in the plugin repository for the runtime artifact, but the artifacts are only published to maven central

Legion2 commented 5 months ago

because 0.5.0 is a very old version, please read the documentation and follow the setup process again to ensure you have configured everything correctly.

charlee-dev commented 4 months ago

I compared your example app shared module gradle with mine, and it does not seem like much has changed in there since 0.5.0.

here is our setup and cannot see much difference with yours...

plugins {
    kotlin("multiplatform")
    kotlin("plugin.serialization")
    id("com.android.library")
    id("com.google.devtools.ksp")
    id("mobox.internal.publish")
}

group = defaultGroup()
version = getSdkVersion()

val reaktNativeToolkitVersion: String = "0.16.0"
//    libs.versions.rnToolkit.get()

kotlin {
    applyDefaultHierarchyTemplate()
    jvmToolchain(ProjectConfig.Kotlin.jvmTargetInt)

    androidTarget {
        publishLibraryVariants("release")
    }

    val xcf = XCFramework()
    val isLocalArch64Build = isLocalArch64Build()

    listOf(
        iosArm64(),
//        iosX64(),                // Had to comment this out to be able to sync dependencies
        iosSimulatorArm64(),
    ).forEach { target ->
        target.binaries.framework {
            baseName = project.name

            embedBitcode(BitcodeEmbeddingMode.BITCODE)

            if (!isLocalArch64Build || target == iosArm64()) {
                xcf.add(this)
            }

            target.compilations.all {
                val args = arrayOf("-linker-options", "-lsqlite3")
                kotlinOptions.freeCompilerArgs += args
            }
        }
    }

    sourceSets {
        commonMain {
            kotlin.srcDir("build/generated/ksp/metadata/commonMain/kotlin")
            dependencies {                 
                implementation("de.voize:reakt-native-toolkit:$reaktNativeToolkitVersion") {
                    exclude("com.facebook.react", "react-native")
                }
            }
        }
        androidMain {
            dependencies {
                implementation("com.facebook.react:react-native:+")
            }
        }
        iosMain {
            dependencies {
                 // some dependencies 
            }
        }

//        val iosX64Main by getting {                // Had to comment this out to be able to sync dependencies
//            kotlin.srcDir("build/generated/ksp/iosX64/iosX64Main/kotlin")
//        }
        val iosArm64Main by getting {
            kotlin.srcDir("build/generated/ksp/iosArm64/iosArm64Main/kotlin")
        }
        val iosSimulatorArm64Main by getting {
            kotlin.srcDir("build/generated/ksp/iosSimulatorArm64/iosSimulatorArm64Main/kotlin")
        }
    }
}

android {
    namespace = project.group.toString()
    compileSdk = ProjectConfig.Android.compileSdk
    defaultConfig {
        minSdk = ProjectConfig.Android.minSdk
        testInstrumentationRunner = ProjectConfig.Android.testInstrumentationRunner
    }
}

dependencies {
    add("kspCommonMainMetadata", "de.voize:reakt-native-toolkit-ksp:$reaktNativeToolkitVersion")
    add("kspAndroid", "de.voize:reakt-native-toolkit-ksp:$reaktNativeToolkitVersion")
//    add("kspIosX64", "de.voize:reakt-native-toolkit-ksp:$reaktNativeToolkitVersion")                // Had to comment this out to be able to sync dependencies
    add("kspIosArm64", "de.voize:reakt-native-toolkit-ksp:$reaktNativeToolkitVersion")
    add("kspIosSimulatorArm64", "de.voize:reakt-native-toolkit-ksp:$reaktNativeToolkitVersion")

    configurations
        .filter { it.name.startsWith("ksp") && it.name.contains("Test") }
        .forEach {
            add(it.name, libs.test.kotlin.mockativeProcessor)
        }
}

tasks.withType<KotlinCompile<*>>().configureEach {
    if (name != "kspCommonMainKotlinMetadata") {
        dependsOn("kspCommonMainKotlinMetadata")
    }
}

tasks.register("generateCommonAndroidBridge") {
    group = "internaldeployment"
    description =
        "Generate bridge only for commonMain and androidMain. Useful for testing common code."

    layout.buildDirectory.asFile.get().deleteRecursively()
    dependsOn("kspCommonMainKotlinMetadata")
    dependsOn("kspReleaseKotlinAndroid")
}

tasks.register("generateBridge") {
    group = "internaldeployment"
    description = "Generate bridge for all targets."

    dependsOn("generateCommonAndroidBridge")
//    dependsOn("kspKotlinIosX64")                // Had to comment this out to be able to sync dependencies
    dependsOn("kspKotlinIosArm64")
    dependsOn("kspKotlinIosSimulatorArm64")
}

To be able to sync with the 0.16.0 version, I had to comment out the IosX64 related logic, which is weird as I'm on M1 and not had this issue before. Was there any recent change related to Kotlin Multiplatform that would not pull dependencies for unsupported targets? But again RnToolkit is the only dependency my build complains about...

Legion2 commented 4 months ago

Is the sync in the IDE failing or Gradle CLI if called from terminal?

charlee-dev commented 4 months ago

Sync in the Android Studio, which made me try IntelliJ, and the sync worked... so it seems the issue is Android Studio Canary related. Thanks for pointing me in the right direction and closing this.