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

Kotlin Multiplatform build Issue #25

Closed
RameshKanuganti opened this issue Aug 7, 2019 · 1 comment
Closed

Kotlin Multiplatform build Issue #25

RameshKanuganti opened this issue Aug 7, 2019 · 1 comment

Comments

@RameshKanuganti
Copy link

RameshKanuganti commented Aug 7, 2019

Hi

While I'm trying to integrate the kgql in Kotlin MPP,
it's throwing the following error

No signature of method: org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeCompilation.outputKinds() is applicable for argument types: (String) values: [FRAMEWORK]

Following is my Shared-Module build.gradle file

apply plugin: "kotlin-multiplatform"
apply plugin: "kotlinx-serialization"
apply plugin: "com.codingfeline.kgql"

kotlin {
    targets {
        fromPreset(presets.jvm, "jvm")

        fromPreset(presets.iosX64, "ios_x86_64")
        fromPreset(presets.iosArm64, "ios_arm64")
        configure([ios_x86_64, ios_arm64]) {
            compilations.main.outputKinds("FRAMEWORK") // Here its throwing error
        }
    }
    
    sourceSets {
        commonMain {
            dependencies {
                implementation "com.jakewharton.timber:timber-common:$timber_version"
                implementation "io.ktor:ktor-client-core:$ktor_version"
                implementation "io.ktor:ktor-client-json:$ktor_version"
                implementation "org.jetbrains.kotlin:kotlin-stdlib"
                implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$coroutines_version"
                implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serialization_version"
                implementation "org.kodein.di:kodein-di-core:$kodein_version"
                implementation "org.kodein.di:kodein-di-erased:$kodein_version"
                compile "org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.11.1"
            }
        }
        jvmMain {
            dependencies {
                implementation "com.jakewharton.timber:timber-jdk:$timber_version"
                implementation "io.ktor:ktor-client-core-jvm:$ktor_version"
                implementation "io.ktor:ktor-client-json-jvm:$ktor_version"
                implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
                implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
                implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serialization_version"
                implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.9.1")
                compile "org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.11.1"
            }
        }
        iosMain {
            dependencies {
                implementation "com.jakewharton.timber:timberNative:$timber_version"
                implementation "io.ktor:ktor-client-core-ios:$ktor_version"
                implementation "io.ktor:ktor-client-ios:$ktor_version"
                implementation "io.ktor:ktor-client-json-ios:$ktor_version"
                implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-native:$coroutines_version"
                implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-native:$serialization_version"
                compile "org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.11.1"

            }
        }
        configure([ios_x86_64Main, ios_arm64Main]) {
            dependsOn iosMain
        }
    }
}

configurations {
    compileClasspath
}

task packForXCode(type: Sync) {
    final File frameworkDir = new File(buildDir, "xcode-frameworks")

    final String configuration = project.findProperty("CONFIGURATION")?.toUpperCase() ?: "DEBUG"
    final String arch = project.findProperty("ARCHS") ?: "x86_64"

    dependsOn kotlin.targets."ios_${arch}".compilations.main.linkTaskName("FRAMEWORK", configuration)

    from { kotlin.targets."ios_${arch}".compilations.main.getBinary("FRAMEWORK", configuration).parentFile }
    into frameworkDir
}

tasks.build.dependsOn packForXCode

// Can i have a link/example of working kgql with graphql on kotlin MPP

@yshrsmz
Copy link
Owner

yshrsmz commented Aug 7, 2019

No signature of method: org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeCompilation.outputKinds() is applicable for argument types: (String) values: [FRAMEWORK]

This is not kgql error, but your configuration.
Check out the document here
https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#building-final-native-binaries

Can i have a link/example of working kgql with graphql on kotlin MPP

Sorry there is no example right now. README is the only source.
I have one outdated repository though.

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

2 participants