From 02cd5318004cd5facf2f81db325e78fdcc311186 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 31 Aug 2020 12:40:13 +0300 Subject: [PATCH] Remove JVM ir --- CHANGELOG.md | 4 ++++ build.gradle.kts | 2 +- .../ru/mipt/npm/gradle/KScienceExtension.kt | 7 +++++- .../ru/mipt/npm/gradle/KScienceJVMPlugin.kt | 2 +- .../ru/mipt/npm/gradle/KScienceMPPlugin.kt | 22 +++++++++++++++---- .../mipt/npm/gradle/KScienceNativePlugin.kt | 14 +++++------- .../ru/mipt/npm/gradle/KScienceVersions.kt | 2 +- src/main/kotlin/ru/mipt/npm/gradle/common.kt | 1 + 8 files changed, 38 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c6ee91..28eb0e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added +- Migrate to kotlin 1.4.0 +- Separate Native (current platform) and nodeJs plugins + ## [0.5.2] ### Added diff --git a/build.gradle.kts b/build.gradle.kts index 51bfc16..489f01c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ plugins { `kotlin-dsl` `maven-publish` id("com.jfrog.bintray") version "1.8.5" - id("org.jetbrains.changelog") version "0.3.2" + id("org.jetbrains.changelog") version "0.4.0" } group = "ru.mipt.npm" diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceExtension.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceExtension.kt index c801afd..e74d3b5 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KScienceExtension.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceExtension.kt @@ -32,8 +32,13 @@ class KScienceExtension(val project: Project) { block: SerializationTargets.() -> Unit = {} ): Unit = project.run { plugins.apply("org.jetbrains.kotlin.plugin.serialization") + val artifactName = if(version.startsWith("0")){ + "kotlinx-serialization-runtime" + } else { + "kotlinx-serialization-core" + } useCommonDependency( - "org.jetbrains.kotlinx:kotlinx-serialization-core:$version", + "org.jetbrains.kotlinx:$artifactName:$version", dependencySourceSet = sourceSet, dependencyConfiguration = configuration ) diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceJVMPlugin.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceJVMPlugin.kt index 697361b..d0940fe 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KScienceJVMPlugin.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceJVMPlugin.kt @@ -26,7 +26,7 @@ open class KScienceJVMPlugin : Plugin { tasks.withType { kotlinOptions { - useIR = true +// useIR = true jvmTarget = KScienceVersions.JVM_TARGET.toString() } } diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceMPPlugin.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceMPPlugin.kt index 87b39db..2a0b2a8 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KScienceMPPlugin.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceMPPlugin.kt @@ -22,7 +22,7 @@ open class KScienceMPPlugin : Plugin { jvm { compilations.all { kotlinOptions { - useIR = true +// useIR = true jvmTarget = KScienceVersions.JVM_TARGET.toString() } } @@ -62,9 +62,11 @@ open class KScienceMPPlugin : Plugin { } } - targets.all { - sourceSets.all { - languageSettings.applySettings() + afterEvaluate { + targets.all { + sourceSets.all { + languageSettings.applySettings() + } } } @@ -73,6 +75,18 @@ open class KScienceMPPlugin : Plugin { val dokkaHtml by tasks.getting(DokkaTask::class) { dokkaSourceSets { + register("commonMain") { + displayName = "common" + platform = "common" + } + register("jvmMain") { + displayName = "jvm" + platform = "jvm" + } + register("jsMain") { + displayName = "js" + platform = "js" + } configureEach { jdkVersion = 11 } diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceNativePlugin.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceNativePlugin.kt index 62be06f..26579e6 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KScienceNativePlugin.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceNativePlugin.kt @@ -3,9 +3,7 @@ package ru.mipt.npm.gradle import org.gradle.api.GradleException import org.gradle.api.Plugin import org.gradle.api.Project -import org.gradle.kotlin.dsl.apply -import org.gradle.kotlin.dsl.configure -import org.gradle.kotlin.dsl.findPlugin +import org.gradle.kotlin.dsl.* import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension class KScienceNativePlugin : Plugin { @@ -23,11 +21,11 @@ class KScienceNativePlugin : Plugin { isMingwX64 -> mingwX64("native") else -> throw GradleException("Host OS is not supported in Kotlin/Native.") } -// -// sourceSets { -// val nativeMain by getting -// val nativeTest by getting -// } + + sourceSets.invoke { + val nativeMain by getting + val nativeTest by getting + } } } } \ No newline at end of file diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt index aef8579..d891755 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt @@ -13,7 +13,7 @@ object KScienceVersions { val JVM_TARGET = JavaVersion.VERSION_11 object Serialization{ - const val xmlVersion = "0.20.0.1" + const val xmlVersion = "0.20.0.10"//to be fixed const val yamlVersion = "0.16.1" const val bsonVersion = "0.2.1" } diff --git a/src/main/kotlin/ru/mipt/npm/gradle/common.kt b/src/main/kotlin/ru/mipt/npm/gradle/common.kt index 1bb9213..c1d719f 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/common.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/common.kt @@ -16,6 +16,7 @@ internal fun LanguageSettingsBuilder.applySettings(): Unit { useExperimentalAnnotation("kotlin.ExperimentalUnsignedTypes") useExperimentalAnnotation("kotlin.ExperimentalStdlibApi") useExperimentalAnnotation("kotlin.time.ExperimentalTime") + useExperimentalAnnotation("kotlin.contracts.ExperimentalContracts") } internal fun RepositoryHandler.applyRepos(): Unit {