Kotlin / kotlin-jupyter

Kotlin kernel for Jupyter/IPython
Apache License 2.0
1.1k stars 106 forks source link

Fix Gradle plugin for Multiplatform project #255

Closed ileasile closed 3 years ago

ileasile commented 3 years ago

When applying Gradle plugin in MPP, following message appears:

Single JVM target not found in a multiplatform project

It's because multiplatform targets are not available right after applying Kotlin multiplatform plugin. This may be fixed by running addDependenciesIfNeeded() after all configurations are done and targets are available.

altavir commented 3 years ago

A workaround is to load inactive plugin:

plugins {
    kotlin("multiplatform")
    kotlin("jupyter.api") apply(false)
}

and activate it after kotlin block:


//Applying it after kotlin extension to ensure that JVM target is loaded
//because of https://github.com/Kotlin/kotlin-jupyter/issues/255
plugins.apply(org.jetbrains.kotlinx.jupyter.api.plugin.ApiGradlePlugin::class)