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,35 +27,31 @@ open class ScientifikJSPlugin : Plugin<Project> {
maven("https://dl.bintray.com/mipt-npm/dev")
}
configure<KotlinJsProjectExtension>{
target{
configure<KotlinJsProjectExtension> {
target {
browser()
}
}
sourceSets["main"].apply {
languageSettings.apply {
progressiveMode = true
enableLanguageFeature("InlineClasses")
useExperimentalAnnotation("ExperimentalUnsignedType")
}
sourceSets["main"].apply {
this as KotlinSourceSet
languageSettings.apply {
progressiveMode = true
enableLanguageFeature("InlineClasses")
useExperimentalAnnotation("ExperimentalUnsignedType")
dependencies {
api(kotlin("stdlib-jdk8"))
if (extension.serialization) {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime:${Scientifik.serializationVersion}")
}
if (extension.atomicfu) {
implementation("org.jetbrains.kotlinx:atomicfu-js:${Scientifik.atomicfuVersion}")
}
if (extension.io) {
api("org.jetbrains.kotlinx:kotlinx-io-js:${Scientifik.ioVersion}")
}
}
}
}
dependencies {
this as KotlinDependencyHandler
api(kotlin("stdlib-jdk8"))
if (extension.serialization) {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime:${Scientifik.serializationVersion}")
}
if (extension.atomicfu) {
implementation("org.jetbrains.kotlinx:atomicfu-js:${Scientifik.atomicfuVersion}")
}
if (extension.io) {
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,26 +30,26 @@ open class ScientifikJVMPlugin : Plugin<Project> {
}
}
sourceSets["main"].apply {
this as KotlinSourceSet
languageSettings.apply {
progressiveMode = true
enableLanguageFeature("InlineClasses")
useExperimentalAnnotation("ExperimentalUnsignedType")
}
}
configure<KotlinJvmProjectExtension> {
sourceSets["main"].apply {
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}")
}
if (extension.atomicfu) {
implementation("org.jetbrains.kotlinx:atomicfu:${Scientifik.atomicfuVersion}")
}
if (extension.io) {
api("org.jetbrains.kotlinx:kotlinx-io-jvm:${Scientifik.ioVersion}")
dependencies {
api(kotlin("stdlib-jdk8"))
if (extension.serialization) {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime:${Scientifik.serializationVersion}")
}
if (extension.atomicfu) {
implementation("org.jetbrains.kotlinx:atomicfu:${Scientifik.atomicfuVersion}")
}
if (extension.io) {
api("org.jetbrains.kotlinx:kotlinx-io-jvm:${Scientifik.ioVersion}")
}
}
}
}