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

Usage with kotlin-multiplatform plugin #1

Open
itstheceo opened this issue Jul 21, 2019 · 0 comments
Open

Usage with kotlin-multiplatform plugin #1

itstheceo opened this issue Jul 21, 2019 · 0 comments

Comments

@itstheceo
Copy link

What is the recommended usage for a project using the kotlin-multiplatform plugin? For example taking the template Kotlin multiplatform library project in IntelliJ IDEA (after updating the gradle scripts to use the Kotlin dsl).

I get the following errors

Script compilation errors:

  Line 73:     classFilesSources.compileTasks = listOf(tasks.compileKotlin, tasks.compileJava)
                                                             ^ Unresolved reference: compileKotlin

  Line 73:     classFilesSources.compileTasks = listOf(tasks.compileKotlin, tasks.compileJava)
                                                                                  ^ Unresolved reference: compileJava

2 errors

I believe both references come from kotlin("jvm") version "1.3.31" in your example project however adding this conflicts with the kotlin-multiplatform plugin.

plugins {
    id("kotlin-multiplatform") version "1.3.41"
    id("se.jensim.kt2ts") version "0.11.0"
}

repositories {
    mavenCentral()
}

group = "com.example"
version = "0.0.1"

kotlin {
    js()
    jvm()
    macosX64("macos")
    sourceSets {
        val commonMain by getting {
            dependencies {
                implementation(kotlin("stdlib-common"))
            }
        }
        val commonTest by getting {
            dependencies {
                implementation(kotlin("test-common"))
                implementation(kotlin("test-annotations-common"))
            }
        }
        val jvmMain by getting {
            dependencies {
                implementation(kotlin("stdlib-jdk8"))
            }
        }
        val jvmTest by getting {
            dependencies {
                implementation(kotlin("test"))
                implementation(kotlin("test-junit"))
            }
        }
        val jsMain by getting {
            dependencies {
                implementation(kotlin("stdlib-js"))
            }
        }
        val jsTest by getting {
            dependencies {
                implementation(kotlin("test-js"))
            }
        }
        val macosMain by getting {
            dependencies {
                implementation(kotlin("stdlib-native"))
            }
        }
        val macosTest by getting {

        }
    }
}

kt2ts {
    output {
        annotation = "com.example.ToTypescript"
        outputFile = file("$buildDir/classes/kotlin/js/main/index.d.ts")
    }
    classFilesSources.compileTasks = listOf(tasks.compileKotlin, tasks.compileJava)
}
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