diff --git a/src/main/kotlin/scientifik/ScientifikJSPlugin.kt b/src/main/kotlin/scientifik/ScientifikJSPlugin.kt index ad3e559..12f6b34 100644 --- a/src/main/kotlin/scientifik/ScientifikJSPlugin.kt +++ b/src/main/kotlin/scientifik/ScientifikJSPlugin.kt @@ -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 { override fun apply(project: Project) { @@ -27,35 +27,31 @@ open class ScientifikJSPlugin : Plugin { maven("https://dl.bintray.com/mipt-npm/dev") } - configure{ - target{ + configure { + 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}") - } - } - } } diff --git a/src/main/kotlin/scientifik/ScientifikJVMPlugin.kt b/src/main/kotlin/scientifik/ScientifikJVMPlugin.kt index 6a6aa8b..52ccd93 100644 --- a/src/main/kotlin/scientifik/ScientifikJVMPlugin.kt +++ b/src/main/kotlin/scientifik/ScientifikJVMPlugin.kt @@ -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 { @@ -32,26 +30,26 @@ open class ScientifikJVMPlugin : Plugin { } } - sourceSets["main"].apply { - this as KotlinSourceSet - languageSettings.apply { - progressiveMode = true - enableLanguageFeature("InlineClasses") - useExperimentalAnnotation("ExperimentalUnsignedType") - } - } + configure { + 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}") + } + } } }