From 550eb9c89ac4ac14936d5a4c86d19e10b1d00e5c Mon Sep 17 00:00:00 2001 From: Vsevolod Tolstopyatov Date: Tue, 1 Dec 2020 18:15:29 +0300 Subject: [PATCH 1/3] Update to Kotlin 1.4.20 --- README.md | 10 ++++----- build.gradle | 4 +++- gradle.properties | 2 +- .../kotlin/PrecompiledDebugProbesTest.kt | 2 +- js/example-frontend-js/build.gradle | 21 ++++++++++++++++++ .../jvm/resources/DebugProbesKt.bin | Bin 1728 -> 1728 bytes 6 files changed, 31 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 522c70aa30..719c55e7bb 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,11 @@ [![official JetBrains project](https://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub) [![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0) [![Download](https://api.bintray.com/packages/kotlin/kotlinx/kotlinx.coroutines/images/download.svg?version=1.4.2) ](https://bintray.com/kotlin/kotlinx/kotlinx.coroutines/1.4.2) -[![Kotlin](https://img.shields.io/badge/kotlin-1.4.0-blue.svg?logo=kotlin)](http://kotlinlang.org) +[![Kotlin](https://img.shields.io/badge/kotlin-1.4.20-blue.svg?logo=kotlin)](http://kotlinlang.org) [![Slack channel](https://img.shields.io/badge/chat-slack-green.svg?logo=slack)](https://kotlinlang.slack.com/messages/coroutines/) Library support for Kotlin coroutines with [multiplatform](#multiplatform) support. -This is a companion version for Kotlin `1.4.0` release. +This is a companion version for Kotlin `1.4.20` release. ```kotlin suspend fun main() = coroutineScope { @@ -94,7 +94,7 @@ And make sure that you use the latest Kotlin version: ```xml - 1.4.0 + 1.4.20 ``` @@ -112,7 +112,7 @@ And make sure that you use the latest Kotlin version: ```groovy buildscript { - ext.kotlin_version = '1.4.0' + ext.kotlin_version = '1.4.20' } ``` @@ -138,7 +138,7 @@ And make sure that you use the latest Kotlin version: ```groovy plugins { - kotlin("jvm") version "1.4.0" + kotlin("jvm") version "1.4.20" } ``` diff --git a/build.gradle b/build.gradle index 938d42e7a1..e4cacbfb07 100644 --- a/build.gradle +++ b/build.gradle @@ -203,6 +203,8 @@ configure(subprojects.findAll { !sourceless.contains(it.name) }) { kotlinOptions.freeCompilerArgs += experimentalAnnotations.collect { "-Xuse-experimental=" + it } kotlinOptions.freeCompilerArgs += "-progressive" kotlinOptions.freeCompilerArgs += "-XXLanguage:+InlineClasses" + // Disable KT-36770 for RxJava2 integration + kotlinOptions.freeCompilerArgs += "-XXLanguage:-ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated" // Remove null assertions to get smaller bytecode on Android kotlinOptions.freeCompilerArgs += ["-Xno-param-assertions", "-Xno-receiver-assertions", "-Xno-call-assertions"] } @@ -335,4 +337,4 @@ if (jvm_ir_enabled) { enabled = enabled && jvm_ir_api_check_enabled } } -} \ No newline at end of file +} diff --git a/gradle.properties b/gradle.properties index cb039062f8..3c9fed6236 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ # Kotlin version=1.4.2-SNAPSHOT group=org.jetbrains.kotlinx -kotlin_version=1.4.0 +kotlin_version=1.4.20 # Dependencies junit_version=4.12 diff --git a/integration-testing/src/debugAgentTest/kotlin/PrecompiledDebugProbesTest.kt b/integration-testing/src/debugAgentTest/kotlin/PrecompiledDebugProbesTest.kt index 5d799ee02f..2090d45471 100644 --- a/integration-testing/src/debugAgentTest/kotlin/PrecompiledDebugProbesTest.kt +++ b/integration-testing/src/debugAgentTest/kotlin/PrecompiledDebugProbesTest.kt @@ -36,4 +36,4 @@ class PrecompiledDebugProbesTest { "ensure that classfile has major version equal to 50 (Java 6 compliance)") } } -} \ No newline at end of file +} diff --git a/js/example-frontend-js/build.gradle b/js/example-frontend-js/build.gradle index 7abde63964..2bba6022ac 100644 --- a/js/example-frontend-js/build.gradle +++ b/js/example-frontend-js/build.gradle @@ -31,3 +31,24 @@ project.kotlin { } } } + + +// Workaround for bug in 1.4.20 that will be fixed in 1.4.21, KT-43668 +tasks.withType(org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinPackageJsonTask) { + doFirst { + def producerField = it.class.superclass.getDeclaredMethod("getProducer") + producerField.setAccessible(true); + def producer = producerField.invoke(it) + def items = producer.fileCollectionDependencies + def list2 = new HashSet() + for (FileCollectionDependency item : items) { + for (File file : item.files) { + if (!file.isFile()) { + list2.add(item) + break + } + } + } + items.removeAll(list2) + } +} diff --git a/kotlinx-coroutines-core/jvm/resources/DebugProbesKt.bin b/kotlinx-coroutines-core/jvm/resources/DebugProbesKt.bin index 76ee41159dbc84c6de5231dbec11bebf0d37b008..2c44f7ec85a9bd926fc50258007a054a387f4ff5 100644 GIT binary patch delta 40 ucmX@Wdw_Ster7I42BxGkW(FYGe3E%L6OSf?b~FRCCxfOZgU;j$Yz6?&iwQ3P delta 40 ucmX@Wdw_Ster7Ia1|VQ$U`i_6e3E%L6OT57PBa6vCxfOZgZAVJYz6?!d Date: Sun, 11 Oct 2020 18:36:14 +0300 Subject: [PATCH 2/3] Rework publish-mpp-root-module-in-platform.gradle --- ...publish-mpp-root-module-in-platform.gradle | 53 ++++++++++--------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/gradle/publish-mpp-root-module-in-platform.gradle b/gradle/publish-mpp-root-module-in-platform.gradle index 8bc0b502db..28068273c9 100644 --- a/gradle/publish-mpp-root-module-in-platform.gradle +++ b/gradle/publish-mpp-root-module-in-platform.gradle @@ -3,37 +3,40 @@ */ -/* - * Publish the platform JAR and POM so that consumers who depend on this module and can't read Gradle module metadata - * can still get the platform artifact and transitive dependencies from the POM. - * - * See the full rationale here https://youtrack.jetbrains.com/issue/KMM-237#focus=streamItem-27-4115233.0-0 - */ -project.ext.publishPlatformArtifactsInRootModule = { platformPublication -> - def platformPomBuilder = null +/** Publish the platform JAR and POM so that consumers who depend on this module and can't read Gradle module + metadata can still get the platform artifact and transitive dependencies from the POM: */ +project.ext.publishPlatformArtifactsInRootModule = { MavenPublication platformPublication -> - platformPublication.pom.withXml { platformPomBuilder = asString() } + XmlProvider platformXml = null - publishing.publications.kotlinMultiplatform { - platformPublication.artifacts.forEach { - artifact(it) - } + platformPublication.pom.withXml { platformXml = it } + publishing.publications.kotlinMultiplatform { pom.withXml { - def pomStringBuilder = asString() - pomStringBuilder.setLength(0) - // The platform POM needs its artifact ID replaced with the artifact ID of the root module: - def platformPomString = platformPomBuilder.toString() - platformPomString.eachLine { line -> - if (!line.contains("