badoo / Reaktive

Kotlin multi-platform implementation of Reactive Extensions
Apache License 2.0
1.17k stars 58 forks source link

Setting 2.0.0 version in coroutines-interop fails to find utils #765

Closed rickytribbia closed 1 month ago

rickytribbia commented 10 months ago

Hello everyone,

we've just tried to put 2.0.0 version to all reaktive dependencies and we've just found that there aren't problems running Android app, but launching iOS app appears this error (during :kspKotlinIosArm64):

Could not find "com.badoo.reaktive:utils" in [/Users/[...]/Pods, /Users/[...]/.konan/klib, /Users/[...]/.konan/kotlin-native-prebuilt-macos-aarch64-1.9.20/klib/common, /Users/[...]/.konan/kotlin-native-prebuilt-macos-aarch64-1.9.20/klib/platform/ios_arm64]

Reverting all reaktive dependencies to 1.3.0 version and 1.3.0-nmtc for coroutines-interop the error disappears.

arkivanov commented 10 months ago

Thanks for the question. The utils module was renamed to utils-internal and is no longer part of the public API. If you are using atomics from that module, you can try kotlinx-atomicfu library, which became available since the introduction of the utils module. Alternatively, you can copy whatever you need to your project from the old utils module.

rickytribbia commented 10 months ago

We're not using anything directly from utils package, but I think that it's listed as dependency (as utils-internal) in the .pom file of the 2.0.0 coroutines-interop library in maven repo and gradle try to find this package but without success.

arkivanov commented 10 months ago

I have checked the published artifacts and couldn't find any references to the old utils module (see reaktive-2.0.0.pom). Reaktive has checks for the published artifacts and they all were resolved at the time of publication.

Where do you see the utils module being listed as dependency? Also could you please provide the full build failure log?

rickytribbia commented 10 months ago

Look at this, for example: reaktive-watchosarm64.pom

arkivanov commented 10 months ago

Thanks. I can only see the following dependency on utils-internal module, not utils module.

<dependency>
  <groupId>com.badoo.reaktive</groupId>
  <artifactId>utils-internal-watchosarm64</artifactId>
  <version>2.0.0</version>
  <scope>compile</scope>
</dependency>

Could you please provide the full build failure log?

CherryPerry commented 10 months ago

@rickytribbia Are you using the following API to export the lib?

iosX64("iosx64").binaries {
    framework {
        export("com.badoo.reaktive:utils:$version")
    }

You might need to update dependency to utils-internal here too.

CherryPerry commented 10 months ago

@arkivanov https://twitter.com/kotlin/status/1727977805424611653 related?

rickytribbia commented 10 months ago

The important things in my build.gradle.kts file:

    cocoapods {
        summary = "ProjectXY Shared Module"
        homepage = "ProjectXY.com"
        ios.deploymentTarget = "13.1"
        podfile = project.file("../ProjectXYiOS/Podfile")
        framework {
            baseName = "shared"
            isStatic = false
            export(libs.kermit.simple)
            when (val target = this.compilation.target.name) {
                "iosX64" -> {
                    export("com.badoo.reaktive:reaktive-iosx64:${libs.versions.reaktive.get()}")
                }

                "iosSimulatorArm64" -> {
                    export("com.badoo.reaktive:reaktive-iossimulatorarm64:${libs.versions.reaktive.get()}")
                }

                "iosArm64" -> {
                    export("com.badoo.reaktive:reaktive-iosarm64:${libs.versions.reaktive.get()}")
                }

                else -> error("Unsupported target: $target")
            }
            embedBitcode(DISABLE)
        }
    }

    sourceSets {
        val commonMain by getting {
            dependencies {
                ...

                api(libs.reaktive)
                implementation(libs.reaktive.annotations)
                implementation(libs.reaktive.coroutines)

                ...
            }
        }
        val commonTest by getting {
            dependencies {
                implementation(kotlin("test"))
                implementation("com.badoo.reaktive:reaktive-testing:${libs.versions.reaktive.get()}")
                ...
            }
        }
        val androidMain by getting {
            dependencies {
                ...
            }
        }
        val androidInstrumentedTest by getting
        val iosX64Main by getting
        val iosArm64Main by getting
        val iosSimulatorArm64Main by getting
        val iosMain by creating {
            dependencies {
                ...
            }
        }
        val iosX64Test by getting
        val iosArm64Test by getting
        val iosSimulatorArm64Test by getting
        val iosTest by creating {
        }

        ...
    }

and the .toml:

[versions]

...

reaktive = "2.0.0"

...

[libraries]
...

reaktive = { module = "com.badoo.reaktive:reaktive", version.ref = "reaktive" }
reaktive-annotations = { module = "com.badoo.reaktive:reaktive-annotations", version.ref = "reaktive" }
reaktive-coroutines = { module = "com.badoo.reaktive:coroutines-interop", version = "2.0.0" }

...

[plugins]
...

[bundles]

and the build failure log is this one attached:

reaktive_build_not_find_utils

arkivanov commented 10 months ago

You might need to update dependency to utils-internal here too.

The utils-internal module shouldn't be used, as it contains only internal API, which is subject to change.

related?

I doubt it. Event there is an issue with generated klibs, there should be no mention of the old utils module. It just doesn't exist anymore. But we can update Kotlin to 1.9.21 anyway, maybe it will fix the issue.

Currently the issue looks like due to a problem with build cache. I recommend to try running the build with --rerun-tasks --no-build-cache flags.

arkivanov commented 10 months ago

Also worth checking transitive dependencies, if there any other dependency that still uses Reaktive v1. E.g. MVIKotlin is still not updated. I'm not sure, but different incompatible versions may cause issues with compiler plugins like KSP.

rickytribbia commented 10 months ago

@arkivanov

 ./gradlew kspKotlinIosArm64 --rerun-tasks --no-build-cache
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details

...

> Task :shared:kspKotlinIosArm64 FAILED
e: Could not find "com.badoo.reaktive:utils" in [/Users/[...]/projectXY, /Users/[...]/.konan/klib, /Users/[...]/.konan/kotlin-native-prebuilt-macos-aarch64-1.9.20/klib/common, /Users/[...]/.konan/kotlin-native-prebuilt-macos-aarch64-1.9.20/klib/platform/ios_arm64]

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':shared:kspKotlinIosArm64'.
> Compilation finished with errors

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 12s
7 actionable tasks: 7 executed
arkivanov commented 10 months ago

Thanks. The issue looks indeed related to https://twitter.com/kotlin/status/1727977805424611653, which refers to KT-62515. Though, I don't understand how the utils module can be mentioned in the error at all, as it doesn't exist anymore.

I will update Kotlin to 1.9.21 and we'll see if it fixes the issue.

CherryPerry commented 10 months ago

Started publishing 2.0.1 release with new Kotlin version, please try tomorrow.