I'm using KMMbridge to create the Xcode Framework ...
# touchlab-tools
a
I'm using KMMbridge to create the Xcode Framework binary. Everything was working just fine till yesterday but now the pipeline is failing with the below error:
Copy code
> Task :shared:publishKMMBridgeFrameworkPublicationToGitHubPackagesRepository FAILED

FAILURE: Build failed with an exception.


Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
* What went wrong:

Execution failed for task ':shared:publishKMMBridgeFrameworkPublicationToGitHubPackagesRepository'.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
> Failed to publish publication 'KMMBridgeFramework' to repository 'GitHubPackages'

   > Invalid publication 'KMMBridgeFramework': artifact file does not exist: '/Users/runner/work/kite-android/kite-android/shared/build/faktory/zip/frameworkarchive.zip'
r
The
NO_SOURCE
suggest that it can't find your source files. Did you make any changes to your file structure recently?
a
No. I did not make any changes to the file structure.
@russhwolf Is there a way to debug this?
r
I don't have much insight without seeing your code. If you run gradle through the IDE, you can run in debug mode and set breakpoints and try to see what's going on. Can you build successfully when not using KMMBridge?
a
Yes. I can build it without kmmbridge. Even if I run ./gradlew linkPodReleaseFrameworkIosX64 locally in IDE It works just fine
Shall I share the build.gradle of the shared module?
r
Yeah that would help
a
Copy code
plugins {
    kotlin("multiplatform")
    id("com.android.library")
    id("co.touchlab.faktory.kmmbridge") version Dependencies.Common.kmm_bridge
    `maven-publish`
    kotlin("native.cocoapods")
}

version = "0.1"

kotlin {
    android {
        publishAllLibraryVariants()
    }

    ios()
    iosSimulatorArm64()

    sourceSets {
        val commonMain by getting {
            dependencies {
                api(project(":shared:core-analytics"))
                api(project(":shared:core-base"))
                api(project(":shared:core-network"))
                api(project(":shared:core-preferences"))
                api(project(":shared:core-remote-config"))
                api(project(":shared:feature-homepage"))
                api(project(":shared:feature-onboarding"))
                api(project(":shared:feature-one-time-payments"))
                api(project(":shared:feature-one-time-payments-common"))
                api(project(":shared:feature-profile"))
                api(project(":shared:feature-settings"))
            }
        }
        val commonTest by getting {
            dependencies {
                implementation(kotlin("test"))
            }
        }
        val androidMain by getting
        val androidUnitTest by getting

        val iosMain by getting
        val iosTest by getting
        val iosSimulatorArm64Main by getting {
            dependsOn(iosMain)
        }
        val iosSimulatorArm64Test by getting {
            dependsOn(iosTest)
        }
    }

    cocoapods {
        summary = "Kite Shared Binary"
        homepage = "<https://www.google.com/>"
        ios.deploymentTarget = "13.1"

        framework {
            export(project(":shared:core-analytics"))
            export(project(":shared:core-base"))
            export(project(":shared:core-network"))
            export(project(":shared:core-preferences"))
            export(project(":shared:core-remote-config"))
            export(project(":shared:feature-homepage"))
            export(project(":shared:feature-onboarding"))
            export(project(":shared:feature-one-time-payments"))
            export(project(":shared:feature-one-time-payments-common"))
            export(project(":shared:feature-profile"))
            export(project(":shared:feature-settings"))
            export("dev.icerock.moko:resources:${Dependencies.Common.moko_resource}")
            isStatic = true
        }
    }
}

android {
    namespace = "com.kite.app.shared"
    compileSdk = rootProject.extra.get("compileSdk") as Int
    defaultConfig {
        minSdk = rootProject.extra.get("minSdk") as Int
        targetSdk = rootProject.extra.get("targetSdk") as Int
    }
}

addGithubPackagesRepository()
kmmbridge {
    mavenPublishArtifacts()
    githubReleaseVersions()
    spm()
    cocoapods("git@github.com:kiteapp/IosPodspec.git")
    versionPrefix.set("0.1")
}
Here it is
Any idea if there's any issue?
r
Hm. Nothing obvious jumps out at me. What versions of KMMBridge and Kotlin are you using?
a
KmmBridge 0.3.7 Kotlin 1.8.21
r
When you say
./gradlew linkPodReleaseFrameworkIosX64
works, does it still print
NO-SOURCE
? Are you sure it's actually building anything? Are there source files in your top-level module?
a
No. The gradle task runs successfully. It doesn't print
NO_SOURCE
.
r
What happens if you run
linkPodReleaseFrameworkIosX64
and then do
kmmBridgePublish
immediately after?
a
FAILURE: Build failed with an exception. * What went wrong: Task 'kmmBridgePublish' not found in root project.
Are you sure it's actually building anything? Are there source files in your top-level module?
Which folder shall I be searching for?
r
ah. If the task isn't found, then you need to set the gradle property
ENABLE_PUBLISHING
. You can do this by passing
-PENABLE_PUBLISHING=true
to gradle (if you use our github workflow, this should already be happening, but you'll need to pass it manually if you're doing things locally)
a
if you use our github workflow, this should already be happening, but you'll need to pass it manually if you're doing things locally
I'm using the github workflow only. I was trying out to build it locally just to check if there are any errors. Let me try to do above mentioned steps.
Okay. It's weird. Now I'm getting errors while running
/gradlew linkPodReleaseFrameworkIosX64.
Below is the error:
Copy code
> Task :shared:core-base:compileKotlinIosX64 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':shared:core-base:compileKotlinIosX64'.
> You must specify a base url or at least one artifact pattern for the Ivy repository 'Kotlin Native(<https://download.jetbrains.com/kotlin/native/builds)>'.
r
You're probably also missing
GITHUB_PUBLISH_TOKEN
and
GITHUB_REPO
. For the first, you'll need to generate a personal access token with repo and package permissions. For the second, it's of the form
YourOrg/YourRepo
.
Actually, that would fail later. For a failure on compilation I'm not sure what's happening
That looks like it's failing to find kotlin native, but I couldn't say why
a
Okay. I was able to resolve kotlin native build error by removing the below line from settings.gradle file.
Copy code
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
Also, the kmmbridge is working fine now. Actually what happened was: In my project, there is a shared module & within the shared module there are sub-modules. I add the sub-modules as dependencies in the commonMain section of the shared module. But there were no kotlin classes inside my shared module except the Greeting class which gets generated by default. Yesterday I removed that Greeting class from the shared module thinking that it was of no use & the kmmbridge build was failing ever since. It was giving
NO_SOURCE
error for:
Copy code
Task :shared:compileKotlinIosX64 NO-SOURCE
Today I added a dummy class in the commonMain folder of the shared module & the build is working just fine.
Thanks again for the help @russhwolf.
r
ah ok. That should work with just a dummy empty source file. But it's not a kmmbridge issue. You shouldn't get any kotlin native build without source files.