Skip to content

Commit

Permalink
Update to Kotlin 1.4.20 (Kotlin#2424)
Browse files Browse the repository at this point in the history
* Rework publish-mpp-root-module-in-platform.gradle
* Update stackwalking tests

Co-authored-by: anastasiia.spaseeva <[email protected]>
  • Loading branch information
qwwdfsad and stasjas committed Dec 2, 2020
1 parent a9c6159 commit 556f07a
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 34 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)](https://kotlinlang.org)
[![Kotlin](https://img.shields.io/badge/kotlin-1.4.20-blue.svg?logo=kotlin)](https://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 {
Expand Down Expand Up @@ -94,7 +94,7 @@ And make sure that you use the latest Kotlin version:

```xml
<properties>
<kotlin.version>1.4.0</kotlin.version>
<kotlin.version>1.4.20</kotlin.version>
</properties>
```

Expand All @@ -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'
}
```

Expand All @@ -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"
}
```

Expand Down
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
Expand Down Expand Up @@ -335,4 +337,4 @@ if (jvm_ir_enabled) {
enabled = enabled && jvm_ir_api_check_enabled
}
}
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
53 changes: 28 additions & 25 deletions gradle/publish-mpp-root-module-in-platform.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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("<!--")) { // Remove the Gradle module metadata marker as it will be added anew
pomStringBuilder.append(line.replace(platformPublication.artifactId, artifactId))
pomStringBuilder.append("\n")
}
}
Node root = asNode()
// Remove the original content and add the content from the platform POM:
root.children().toList().each { root.remove(it as Node) }
platformXml.asNode().children().each { root.append(it as Node) }

// Adjust the self artifact ID, as it should match the root module's coordinates:
((root.get("artifactId") as NodeList).get(0) as Node).setValue(artifactId)

// Set packaging to POM to indicate that there's no artifact:
root.appendNode("packaging", "pom")

// Remove the original platform dependencies and add a single dependency on the platform module:
Node dependencies = (root.get("dependencies") as NodeList).get(0) as Node
dependencies.children().toList().each { dependencies.remove(it as Node) }
Node singleDependency = dependencies.appendNode("dependency")
singleDependency.appendNode("groupId", platformPublication.groupId)
singleDependency.appendNode("artifactId", platformPublication.artifactId)
singleDependency.appendNode("version", platformPublication.version)
singleDependency.appendNode("scope", "compile")
}
}

tasks.matching { it.name == "generatePomFileForKotlinMultiplatformPublication"}.configureEach {
tasks.matching { it.name == "generatePomFileForKotlinMultiplatformPublication" }.configureEach {
dependsOn(tasks["generatePomFileFor${platformPublication.name.capitalize()}Publication"])
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ class PrecompiledDebugProbesTest {
"ensure that classfile has major version equal to 50 (Java 6 compliance)")
}
}
}
}
21 changes: 21 additions & 0 deletions js/example-frontend-js/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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<FileCollectionDependency>()
for (FileCollectionDependency item : items) {
for (File file : item.files) {
if (!file.isFile()) {
list2.add(item)
break
}
}
}
items.removeAll(list2)
}
}
Binary file modified kotlinx-coroutines-core/jvm/resources/DebugProbesKt.bin
Binary file not shown.
2 changes: 2 additions & 0 deletions kotlinx-coroutines-debug/test/DebugProbesTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class DebugProbesTest : DebugTestBase() {
"\tat kotlinx.coroutines.DeferredCoroutine.await\$suspendImpl(Builders.common.kt)\n" +
"\tat kotlinx.coroutines.debug.DebugProbesTest.oneMoreNestedMethod(DebugProbesTest.kt)\n" +
"\tat kotlinx.coroutines.debug.DebugProbesTest.nestedMethod(DebugProbesTest.kt)\n" +
"\tat kotlinx.coroutines.debug.DebugProbesTest\$testAsyncWithProbes\$1\$1.invokeSuspend(DebugProbesTest.kt:62)\n" +
"\t(Coroutine creation stacktrace)\n" +
"\tat kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt.createCoroutineUnintercepted(IntrinsicsJvm.kt)\n" +
"\tat kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt)\n" +
Expand Down Expand Up @@ -76,6 +77,7 @@ class DebugProbesTest : DebugTestBase() {
"\tat kotlinx.coroutines.DeferredCoroutine.await\$suspendImpl(Builders.common.kt)\n" +
"\tat kotlinx.coroutines.debug.DebugProbesTest.oneMoreNestedMethod(DebugProbesTest.kt:71)\n" +
"\tat kotlinx.coroutines.debug.DebugProbesTest.nestedMethod(DebugProbesTest.kt:66)\n" +
"\tat kotlinx.coroutines.debug.DebugProbesTest\$testAsyncWithSanitizedProbes\$1\$1.invokeSuspend(DebugProbesTest.kt:87)\n" +
"\t(Coroutine creation stacktrace)\n" +
"\tat kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt.createCoroutineUnintercepted(IntrinsicsJvm.kt:116)\n" +
"\tat kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:23)\n" +
Expand Down
2 changes: 1 addition & 1 deletion kotlinx-coroutines-debug/test/SanitizedProbesTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class SanitizedProbesTest : DebugTestBase() {
"\tat kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt.createCoroutineUnintercepted(IntrinsicsJvm.kt:116)",

"Coroutine \"coroutine#2\":StandaloneCoroutine{Active}@1b68b9a4, state: SUSPENDED\n" +
"\tat definitely.not.kotlinx.coroutines.SanitizedProbesTest\$launchSelector\$1.invokeSuspend(SanitizedProbesTest.kt:143)\n" +
"\tat definitely.not.kotlinx.coroutines.SanitizedProbesTest\$launchSelector\$1\$1\$1.invokeSuspend(SanitizedProbesTest.kt)\n" +
"\t(Coroutine creation stacktrace)\n" +
"\tat kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt.createCoroutineUnintercepted(IntrinsicsJvm.kt:116)\n" +
"\tat kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:25)\n" +
Expand Down

0 comments on commit 556f07a

Please sign in to comment.