From 19d3030d2071ed53457f5681f63faca80d7c3196 Mon Sep 17 00:00:00 2001 From: Daan Vanden Bosch Date: Mon, 6 Sep 2021 14:17:20 +0200 Subject: [PATCH] Upgraded Kotlin from 1.5.21 to 1.5.30. Also upgraded kotlinx.coroutines and kotlin logging. Now using languageSettings.optIn everywhere instead of compiler options. --- buildSrc/build.gradle.kts | 4 ++-- .../kotlin/world/phantasmal/ExperimentalAnnotations.kt | 3 --- .../src/main/kotlin/world/phantasmal/common.gradle.kts | 4 ++-- .../src/main/kotlin/world/phantasmal/js.gradle.kts | 6 ++---- .../src/main/kotlin/world/phantasmal/jvm.gradle.kts | 10 +++++++--- .../kotlin/world/phantasmal/multiplatform.gradle.kts | 7 ++++--- psolib/build.gradle.kts | 4 ++++ web/assembly-worker/build.gradle.kts | 4 ++++ web/assets-generation/build.gradle.kts | 6 ++++++ web/build.gradle.kts | 3 +++ web/shared/build.gradle.kts | 3 +++ 11 files changed, 37 insertions(+), 17 deletions(-) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index eed7753b..69ec56a0 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -7,6 +7,6 @@ repositories { } dependencies { - implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21") - implementation("org.jetbrains.kotlin:kotlin-serialization:1.5.21") + implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30") + implementation("org.jetbrains.kotlin:kotlin-serialization:1.5.30") } diff --git a/buildSrc/src/main/kotlin/world/phantasmal/ExperimentalAnnotations.kt b/buildSrc/src/main/kotlin/world/phantasmal/ExperimentalAnnotations.kt index f1fef95a..836b7821 100644 --- a/buildSrc/src/main/kotlin/world/phantasmal/ExperimentalAnnotations.kt +++ b/buildSrc/src/main/kotlin/world/phantasmal/ExperimentalAnnotations.kt @@ -6,6 +6,3 @@ val EXPERIMENTAL_ANNOTATIONS: List = listOf( "kotlin.contracts.ExperimentalContracts", "kotlin.time.ExperimentalTime", ) - -val EXPERIMENTAL_ANNOTATION_COMPILER_ARGS: List = - EXPERIMENTAL_ANNOTATIONS.map { "-Xopt-in=$it" } diff --git a/buildSrc/src/main/kotlin/world/phantasmal/common.gradle.kts b/buildSrc/src/main/kotlin/world/phantasmal/common.gradle.kts index 6d5f3bcb..a5ff603f 100644 --- a/buildSrc/src/main/kotlin/world/phantasmal/common.gradle.kts +++ b/buildSrc/src/main/kotlin/world/phantasmal/common.gradle.kts @@ -8,9 +8,9 @@ repositories { mavenCentral() } -project.extra["coroutinesVersion"] = "1.5.1" +project.extra["coroutinesVersion"] = "1.5.2" project.extra["junitVersion"] = "5.7.1" -project.extra["kotlinLoggingVersion"] = "2.0.6" +project.extra["kotlinLoggingVersion"] = "2.0.11" project.extra["ktorVersion"] = "1.6.1" project.extra["log4jVersion"] = "2.14.1" project.extra["serializationVersion"] = "1.2.2" diff --git a/buildSrc/src/main/kotlin/world/phantasmal/js.gradle.kts b/buildSrc/src/main/kotlin/world/phantasmal/js.gradle.kts index fb236aad..e48006d8 100644 --- a/buildSrc/src/main/kotlin/world/phantasmal/js.gradle.kts +++ b/buildSrc/src/main/kotlin/world/phantasmal/js.gradle.kts @@ -8,10 +8,8 @@ plugins { kotlin { js { - compilations.all { - kotlinOptions { - freeCompilerArgs = freeCompilerArgs + EXPERIMENTAL_ANNOTATION_COMPILER_ARGS - } + compilations.configureEach { + EXPERIMENTAL_ANNOTATIONS.forEach(languageSettings::optIn) } browser { testTask { diff --git a/buildSrc/src/main/kotlin/world/phantasmal/jvm.gradle.kts b/buildSrc/src/main/kotlin/world/phantasmal/jvm.gradle.kts index 61047fbc..ba928e15 100644 --- a/buildSrc/src/main/kotlin/world/phantasmal/jvm.gradle.kts +++ b/buildSrc/src/main/kotlin/world/phantasmal/jvm.gradle.kts @@ -10,12 +10,16 @@ plugins { val junitVersion: String by project.extra val log4jVersion: String by project.extra +kotlin { + sourceSets.configureEach { + EXPERIMENTAL_ANNOTATIONS.forEach(languageSettings::optIn) + } +} + tasks.withType().configureEach { kotlinOptions { jvmTarget = "11" - freeCompilerArgs = freeCompilerArgs + - EXPERIMENTAL_ANNOTATION_COMPILER_ARGS + - "-Xjvm-default=all" + freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=all" } } diff --git a/buildSrc/src/main/kotlin/world/phantasmal/multiplatform.gradle.kts b/buildSrc/src/main/kotlin/world/phantasmal/multiplatform.gradle.kts index 5fbcecff..15c693ad 100644 --- a/buildSrc/src/main/kotlin/world/phantasmal/multiplatform.gradle.kts +++ b/buildSrc/src/main/kotlin/world/phantasmal/multiplatform.gradle.kts @@ -23,16 +23,17 @@ kotlin { } jvm { - compilations.all { + compilations.configureEach { kotlinOptions { jvmTarget = "11" + freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=all" } } } sourceSets { - all { - EXPERIMENTAL_ANNOTATIONS.forEach(languageSettings::useExperimentalAnnotation) + configureEach { + EXPERIMENTAL_ANNOTATIONS.forEach(languageSettings::optIn) } commonMain { diff --git a/psolib/build.gradle.kts b/psolib/build.gradle.kts index 483977b3..48c73dac 100644 --- a/psolib/build.gradle.kts +++ b/psolib/build.gradle.kts @@ -21,6 +21,10 @@ val serializationVersion: String by project.extra kotlin { sourceSets { + all { + languageSettings.optIn("kotlinx.serialization.ExperimentalSerializationApi") + } + commonMain { kotlin.setSrcDirs(kotlin.srcDirs + generatedCommonSrc) dependencies { diff --git a/web/assembly-worker/build.gradle.kts b/web/assembly-worker/build.gradle.kts index f48bf67d..ffc66c2b 100644 --- a/web/assembly-worker/build.gradle.kts +++ b/web/assembly-worker/build.gradle.kts @@ -4,6 +4,10 @@ plugins { kotlin { js { + compilations.configureEach { + languageSettings.optIn("kotlinx.serialization.ExperimentalSerializationApi") + } + binaries.executable() } } diff --git a/web/assets-generation/build.gradle.kts b/web/assets-generation/build.gradle.kts index 1d90b730..407ae4ef 100644 --- a/web/assets-generation/build.gradle.kts +++ b/web/assets-generation/build.gradle.kts @@ -2,6 +2,12 @@ plugins { id("world.phantasmal.jvm") } +kotlin { + sourceSets.configureEach { + languageSettings.optIn("kotlinx.serialization.ExperimentalSerializationApi") + } +} + dependencies { implementation(project(":psolib")) implementation(project(":web:shared")) diff --git a/web/build.gradle.kts b/web/build.gradle.kts index 45501266..007108f7 100644 --- a/web/build.gradle.kts +++ b/web/build.gradle.kts @@ -5,6 +5,9 @@ plugins { kotlin { js { + compilations.configureEach { + languageSettings.optIn("kotlinx.serialization.ExperimentalSerializationApi") + } browser { commonWebpackConfig { cssSupport.enabled = true diff --git a/web/shared/build.gradle.kts b/web/shared/build.gradle.kts index 61d97ea2..0cae036b 100644 --- a/web/shared/build.gradle.kts +++ b/web/shared/build.gradle.kts @@ -7,6 +7,9 @@ val serializationVersion: String by project.extra kotlin { sourceSets { + configureEach { + languageSettings.optIn("kotlinx.serialization.ExperimentalSerializationApi") + } commonMain { dependencies { api(project(":psolib"))