Fix JVM/JS library dependency extensions

This commit is contained in:
Alexander Nozik 2019-12-17 20:22:43 +03:00
parent c700515d3f
commit 99fdcfe60d
2 changed files with 9 additions and 10 deletions

View File

@ -7,7 +7,7 @@ plugins {
} }
group = "scientifik" group = "scientifik"
version = "0.3.0" version = "0.3.1"
repositories { repositories {
gradlePluginPortal() gradlePluginPortal()

View File

@ -6,7 +6,6 @@ import org.gradle.api.Project
import org.gradle.kotlin.dsl.findByType import org.gradle.kotlin.dsl.findByType
import org.gradle.kotlin.dsl.invoke import org.gradle.kotlin.dsl.invoke
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
internal fun Project.useDependency(vararg pairs: Pair<String, String>) { internal fun Project.useDependency(vararg pairs: Pair<String, String>) {
pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") { pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
@ -24,11 +23,10 @@ internal fun Project.useDependency(vararg pairs: Pair<String, String>) {
} }
pairs.find { it.first == "jvmMain" }?.let { dep -> pairs.find { it.first == "jvmMain" }?.let { dep ->
pluginManager.withPlugin("org.jetbrains.kotlin.jvm") { pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
sourceSets.findByName("main")?.apply { sourceSets.findByName("main")?.apply {
this as KotlinSourceSet dependencies.apply{
dependencies { add(implementationConfigurationName, dep.second)
implementation(dep) }
}
} }
} }
} }
@ -36,9 +34,10 @@ internal fun Project.useDependency(vararg pairs: Pair<String, String>) {
pairs.find { it.first == "jsMain" }?.let { dep -> pairs.find { it.first == "jsMain" }?.let { dep ->
pluginManager.withPlugin("org.jetbrains.kotlin.js") { pluginManager.withPlugin("org.jetbrains.kotlin.js") {
sourceSets.findByName("main")?.apply { sourceSets.findByName("main")?.apply {
this as KotlinSourceSet sourceSets.findByName("main")?.apply {
dependencies { dependencies.apply{
implementation(dep) add(implementationConfigurationName, dep.second)
}
} }
} }
} }