Skip to content

Commit 556f07a

Browse files
qwwdfsadstasjas
andauthored
Update to Kotlin 1.4.20 (#2424)
* Rework publish-mpp-root-module-in-platform.gradle * Update stackwalking tests Co-authored-by: anastasiia.spaseeva <[email protected]>
1 parent a9c6159 commit 556f07a

File tree

9 files changed

+62
-34
lines changed

9 files changed

+62
-34
lines changed

Diff for: README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
[![official JetBrains project](https://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
44
[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0)
55
[![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)
6-
[![Kotlin](https://img.shields.io/badge/kotlin-1.4.0-blue.svg?logo=kotlin)](http://kotlinlang.org)
6+
[![Kotlin](https://img.shields.io/badge/kotlin-1.4.20-blue.svg?logo=kotlin)](http://kotlinlang.org)
77
[![Slack channel](https://img.shields.io/badge/chat-slack-green.svg?logo=slack)](https://kotlinlang.slack.com/messages/coroutines/)
88

99
Library support for Kotlin coroutines with [multiplatform](#multiplatform) support.
10-
This is a companion version for Kotlin `1.4.0` release.
10+
This is a companion version for Kotlin `1.4.20` release.
1111

1212
```kotlin
1313
suspend fun main() = coroutineScope {
@@ -94,7 +94,7 @@ And make sure that you use the latest Kotlin version:
9494

9595
```xml
9696
<properties>
97-
<kotlin.version>1.4.0</kotlin.version>
97+
<kotlin.version>1.4.20</kotlin.version>
9898
</properties>
9999
```
100100

@@ -112,7 +112,7 @@ And make sure that you use the latest Kotlin version:
112112

113113
```groovy
114114
buildscript {
115-
ext.kotlin_version = '1.4.0'
115+
ext.kotlin_version = '1.4.20'
116116
}
117117
```
118118

@@ -138,7 +138,7 @@ And make sure that you use the latest Kotlin version:
138138

139139
```groovy
140140
plugins {
141-
kotlin("jvm") version "1.4.0"
141+
kotlin("jvm") version "1.4.20"
142142
}
143143
```
144144

Diff for: build.gradle

+3-1
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ configure(subprojects.findAll { !sourceless.contains(it.name) }) {
203203
kotlinOptions.freeCompilerArgs += experimentalAnnotations.collect { "-Xuse-experimental=" + it }
204204
kotlinOptions.freeCompilerArgs += "-progressive"
205205
kotlinOptions.freeCompilerArgs += "-XXLanguage:+InlineClasses"
206+
// Disable KT-36770 for RxJava2 integration
207+
kotlinOptions.freeCompilerArgs += "-XXLanguage:-ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated"
206208
// Remove null assertions to get smaller bytecode on Android
207209
kotlinOptions.freeCompilerArgs += ["-Xno-param-assertions", "-Xno-receiver-assertions", "-Xno-call-assertions"]
208210
}
@@ -335,4 +337,4 @@ if (jvm_ir_enabled) {
335337
enabled = enabled && jvm_ir_api_check_enabled
336338
}
337339
}
338-
}
340+
}

Diff for: gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Kotlin
66
version=1.4.2-SNAPSHOT
77
group=org.jetbrains.kotlinx
8-
kotlin_version=1.4.0
8+
kotlin_version=1.4.20
99

1010
# Dependencies
1111
junit_version=4.12

Diff for: gradle/publish-mpp-root-module-in-platform.gradle

+28-25
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,40 @@
33
*/
44

55

6-
/*
7-
* Publish the platform JAR and POM so that consumers who depend on this module and can't read Gradle module metadata
8-
* can still get the platform artifact and transitive dependencies from the POM.
9-
*
10-
* See the full rationale here https://youtrack.jetbrains.com/issue/KMM-237#focus=streamItem-27-4115233.0-0
11-
*/
12-
project.ext.publishPlatformArtifactsInRootModule = { platformPublication ->
13-
def platformPomBuilder = null
6+
/** Publish the platform JAR and POM so that consumers who depend on this module and can't read Gradle module
7+
metadata can still get the platform artifact and transitive dependencies from the POM: */
8+
project.ext.publishPlatformArtifactsInRootModule = { MavenPublication platformPublication ->
149

15-
platformPublication.pom.withXml { platformPomBuilder = asString() }
10+
XmlProvider platformXml = null
1611

17-
publishing.publications.kotlinMultiplatform {
18-
platformPublication.artifacts.forEach {
19-
artifact(it)
20-
}
12+
platformPublication.pom.withXml { platformXml = it }
2113

14+
publishing.publications.kotlinMultiplatform {
2215
pom.withXml {
23-
def pomStringBuilder = asString()
24-
pomStringBuilder.setLength(0)
25-
// The platform POM needs its artifact ID replaced with the artifact ID of the root module:
26-
def platformPomString = platformPomBuilder.toString()
27-
platformPomString.eachLine { line ->
28-
if (!line.contains("<!--")) { // Remove the Gradle module metadata marker as it will be added anew
29-
pomStringBuilder.append(line.replace(platformPublication.artifactId, artifactId))
30-
pomStringBuilder.append("\n")
31-
}
32-
}
16+
Node root = asNode()
17+
// Remove the original content and add the content from the platform POM:
18+
root.children().toList().each { root.remove(it as Node) }
19+
platformXml.asNode().children().each { root.append(it as Node) }
20+
21+
// Adjust the self artifact ID, as it should match the root module's coordinates:
22+
((root.get("artifactId") as NodeList).get(0) as Node).setValue(artifactId)
23+
24+
// Set packaging to POM to indicate that there's no artifact:
25+
root.appendNode("packaging", "pom")
26+
27+
// Remove the original platform dependencies and add a single dependency on the platform module:
28+
Node dependencies = (root.get("dependencies") as NodeList).get(0) as Node
29+
dependencies.children().toList().each { dependencies.remove(it as Node) }
30+
Node singleDependency = dependencies.appendNode("dependency")
31+
singleDependency.appendNode("groupId", platformPublication.groupId)
32+
singleDependency.appendNode("artifactId", platformPublication.artifactId)
33+
singleDependency.appendNode("version", platformPublication.version)
34+
singleDependency.appendNode("scope", "compile")
3335
}
3436
}
3537

36-
tasks.matching { it.name == "generatePomFileForKotlinMultiplatformPublication"}.configureEach {
38+
tasks.matching { it.name == "generatePomFileForKotlinMultiplatformPublication" }.configureEach {
3739
dependsOn(tasks["generatePomFileFor${platformPublication.name.capitalize()}Publication"])
3840
}
39-
}
41+
42+
}

Diff for: integration-testing/src/debugAgentTest/kotlin/PrecompiledDebugProbesTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ class PrecompiledDebugProbesTest {
3636
"ensure that classfile has major version equal to 50 (Java 6 compliance)")
3737
}
3838
}
39-
}
39+
}

Diff for: js/example-frontend-js/build.gradle

+21
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,24 @@ project.kotlin {
3131
}
3232
}
3333
}
34+
35+
36+
// Workaround for bug in 1.4.20 that will be fixed in 1.4.21, KT-43668
37+
tasks.withType(org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinPackageJsonTask) {
38+
doFirst {
39+
def producerField = it.class.superclass.getDeclaredMethod("getProducer")
40+
producerField.setAccessible(true);
41+
def producer = producerField.invoke(it)
42+
def items = producer.fileCollectionDependencies
43+
def list2 = new HashSet<FileCollectionDependency>()
44+
for (FileCollectionDependency item : items) {
45+
for (File file : item.files) {
46+
if (!file.isFile()) {
47+
list2.add(item)
48+
break
49+
}
50+
}
51+
}
52+
items.removeAll(list2)
53+
}
54+
}
0 Bytes
Binary file not shown.

Diff for: kotlinx-coroutines-debug/test/DebugProbesTest.kt

+2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class DebugProbesTest : DebugTestBase() {
4545
"\tat kotlinx.coroutines.DeferredCoroutine.await\$suspendImpl(Builders.common.kt)\n" +
4646
"\tat kotlinx.coroutines.debug.DebugProbesTest.oneMoreNestedMethod(DebugProbesTest.kt)\n" +
4747
"\tat kotlinx.coroutines.debug.DebugProbesTest.nestedMethod(DebugProbesTest.kt)\n" +
48+
"\tat kotlinx.coroutines.debug.DebugProbesTest\$testAsyncWithProbes\$1\$1.invokeSuspend(DebugProbesTest.kt:62)\n" +
4849
"\t(Coroutine creation stacktrace)\n" +
4950
"\tat kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt.createCoroutineUnintercepted(IntrinsicsJvm.kt)\n" +
5051
"\tat kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt)\n" +
@@ -76,6 +77,7 @@ class DebugProbesTest : DebugTestBase() {
7677
"\tat kotlinx.coroutines.DeferredCoroutine.await\$suspendImpl(Builders.common.kt)\n" +
7778
"\tat kotlinx.coroutines.debug.DebugProbesTest.oneMoreNestedMethod(DebugProbesTest.kt:71)\n" +
7879
"\tat kotlinx.coroutines.debug.DebugProbesTest.nestedMethod(DebugProbesTest.kt:66)\n" +
80+
"\tat kotlinx.coroutines.debug.DebugProbesTest\$testAsyncWithSanitizedProbes\$1\$1.invokeSuspend(DebugProbesTest.kt:87)\n" +
7981
"\t(Coroutine creation stacktrace)\n" +
8082
"\tat kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt.createCoroutineUnintercepted(IntrinsicsJvm.kt:116)\n" +
8183
"\tat kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:23)\n" +

Diff for: kotlinx-coroutines-debug/test/SanitizedProbesTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class SanitizedProbesTest : DebugTestBase() {
8787
"\tat kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt.createCoroutineUnintercepted(IntrinsicsJvm.kt:116)",
8888

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

0 commit comments

Comments
 (0)