Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Middle nativeMain module with specific iosMain and macOSMain fails. #43

Open
checoalejandro opened this issue Jan 28, 2022 · 0 comments

Comments

@checoalejandro
Copy link

Not sure if this is expected, do have a project with a middle nativeMain source set for specific iosMain & macOSMain source set

- commonMain
    - nativeMain
        - iosMain
        - macOSMain

build.gradle.kts

    macosX64("native")
    macosX64("macOS") {
        binaries {
            framework {
                baseName = "shared"
            }
        }
    }
    ios() {
        binaries {
            framework {
                baseName = "shared"
            }
        }
    }

    ...

    val nativeMain by getting {
        dependencies {
            implementation(libs.sqlDelight.native)
            implementation(libs.ktor.client.core)
            implementation(libs.coroutines.core)
            implementation(libs.multiplatformSettings.common)
        }
    }
    val iosMain by getting {
        dependsOn(nativeMain)
        dependencies {
            implementation(libs.ktor.client.ios)
            val coroutineCore = libs.coroutines.core.get()
            implementation("${coroutineCore.module.group}:${coroutineCore.module.name}:${coroutineCore.versionConstraint.displayName}") {
                version {
                    strictly(libs.versions.coroutines.native.get())
                }
            }
        }
    }
    val macOSMain by getting {
        dependsOn(nativeMain)
        dependencies {
            implementation("io.ktor:ktor-client-curl:2.0.0-beta-1")
        }
    }

...

multiplatformSwiftPackage {
    packageName("sharedValkyrie")
    swiftToolsVersion("5.3")
    targetPlatforms {
        iOS { v("13") }
        macOS { v("11") }
    }
}

Inside commonMain I have multiple expect class ... that are defined only in iosMain and macOSMain and not in nativeMain, such as UserAgent strings, platform name, etc. After gradle sync, those expect classes are solved properly without any errors but when running createSwiftPackage gradle task, I receive that there are no expect declarations in nativeMain module:
Expected class 'Platform' has no actual declaration in module <mySharedModule> for Native

Shouldn't just execute compileKotlinIos and compileKotlinMacOS and skip compileKotlinNative?
Is there a workaround to do this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant