Having problem with trying new multiplatform projects feature with 1.2.0-beta-31


#1

I get this strange gradle error

Platform project project ‘:js’ implements non-common project project ‘:shared’ (apply plugin 'kotlin-platform-kotlin')

but there is no ‘kotlin-platform-kotlin’ plugin

:shared has

apply plugin: 'kotlin-platform-common'
dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib-common:${versions.kotlinVersion}"
}

:js has

apply plugin: 'kotlin-platform-js'
dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib-js:${versions.kotlinVersion}"
    implement project(":shared")
}

Is it not ok to have expect/actual multiplat projects at same project level?

Is there helloworld sample for multiplatform projects?


#2

Platform project project ‘:js’ implements non-common project project ‘:shared’ (apply plugin ‘kotlin-platform-kotlin’)

It’s just a typo in the message, should be 'kotlin-platform-common` which you seem have already applied.

There is no official example yet, but you can take a look at this repo: https://github.com/jstuyts/kotlin-multiplatform-recipes.
And this one is already upgraded to Kotlin 1.2-beta: https://github.com/JakeWharton/Reagent


#3

Looks like i have found incompatibility in your plugin check in KotlinPlatformImplementationPluginBase.
It seems mixing ‘apply’ gradle syntax and plugin block does something unexpected to this code.
This will always fail check:

plugins {
    id "com.moowork.node" version "1.0.1"
}
apply plugin: 'kotlin-platform-js'

Note how check fails for common project, but binary plugin/script plugin is applied in js one


#4

I have created a branch that has been switched to the new syntax. Simply replacing header and impl was all it took: syntax-1.2


#5

@Konstantin-Khvan thank you for the investigation. Unfortunately, I wasn’t able to reproduce it by adding this plugins block to a js project.

I’ve opened an issue about that: https://youtrack.jetbrains.com/issue/KT-20634
Could you attach some minimal project that reproduces it there?


#6

I have attached minimal project with reproducible issue. Good luck fixing classpath/classloaders bugs in groovy/gradle :smiley: