Fixed single platform plugins

This commit is contained in:
Alexander Nozik 2019-07-21 18:17:40 +03:00
parent 64eaabb443
commit ae7d31bd30
2 changed files with 44 additions and 50 deletions

View File

@ -1,13 +1,13 @@
package scientifik
import Scientifik
import kotlinx.atomicfu.plugin.gradle.sourceSets
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.*
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.maven
import org.gradle.kotlin.dsl.repositories
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
open class ScientifikJSPlugin : Plugin<Project> {
override fun apply(project: Project) {
@ -27,23 +27,18 @@ open class ScientifikJSPlugin : Plugin<Project> {
maven("https://dl.bintray.com/mipt-npm/dev")
}
configure<KotlinJsProjectExtension>{
target{
configure<KotlinJsProjectExtension> {
target {
browser()
}
}
sourceSets["main"].apply {
this as KotlinSourceSet
languageSettings.apply {
progressiveMode = true
enableLanguageFeature("InlineClasses")
useExperimentalAnnotation("ExperimentalUnsignedType")
}
}
dependencies {
this as KotlinDependencyHandler
api(kotlin("stdlib-jdk8"))
if (extension.serialization) {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime:${Scientifik.serializationVersion}")
@ -55,7 +50,8 @@ open class ScientifikJSPlugin : Plugin<Project> {
api("org.jetbrains.kotlinx:kotlinx-io-js:${Scientifik.ioVersion}")
}
}
}
}
}
}

View File

@ -1,12 +1,10 @@
package scientifik
import Scientifik
import kotlinx.atomicfu.plugin.gradle.sourceSets
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.*
import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
open class ScientifikJVMPlugin : Plugin<Project> {
@ -32,17 +30,15 @@ open class ScientifikJVMPlugin : Plugin<Project> {
}
}
configure<KotlinJvmProjectExtension> {
sourceSets["main"].apply {
this as KotlinSourceSet
languageSettings.apply {
progressiveMode = true
enableLanguageFeature("InlineClasses")
useExperimentalAnnotation("ExperimentalUnsignedType")
}
}
dependencies {
this as KotlinDependencyHandler
api(kotlin("stdlib-jdk8"))
if (extension.serialization) {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime:${Scientifik.serializationVersion}")
@ -54,6 +50,8 @@ open class ScientifikJVMPlugin : Plugin<Project> {
api("org.jetbrains.kotlinx:kotlinx-io-jvm:${Scientifik.ioVersion}")
}
}
}
}
}