Skip to content

Commit

Permalink
Merge pull request #3719 from Kotlin/version-1.7.0-RC
Browse files Browse the repository at this point in the history
Version 1.7.0-RC
  • Loading branch information
qwwdfsad committed Apr 19, 2023
2 parents 2653cd2 + 1b0022b commit 4bc89e2
Show file tree
Hide file tree
Showing 35 changed files with 456 additions and 137 deletions.
14 changes: 14 additions & 0 deletions CHANGES.md
@@ -1,5 +1,19 @@
# Change log for kotlinx.coroutines

## Version 1.7.0-RC

* Kotlin version is updated to 1.8.20.
* Atomicfu version is updated to 0.20.2.
* `JavaFx` version is updated to 17.0.2 in `kotlinx-coroutines-javafx` (#3671).
* `previous-compilation-data.bin` file is removed from JAR resources (#3668).
* `CoroutineDispatcher.asExecutor()` runs tasks without dispatching if the dispatcher is unconfined (#3683). Thanks @odedniv!
* `SharedFlow.toMutableList` lint overload is undeprecated (#3706).
* `Channel.invokeOnClose` is promoted to stable API (#3358).
* Improved lock contention in `Dispatchers.Default` and `Dispatchers.IO` during the startup phase (#3652).
* Fixed a bug that led to threads oversubscription in `Dispatchers.Default` (#3642).
* Fixed a bug that allowed `limitedParallelism` to perform dispatches even after the underlying dispatcher was closed (#3672).
* Restored binary compatibility of previously experimental `TestScope.runTest(Long)` (#3673).

## Version 1.7.0-Beta

### Core API significant improvements
Expand Down
22 changes: 11 additions & 11 deletions README.md
Expand Up @@ -3,12 +3,12 @@
[![Kotlin Stable](https://kotl.in/badges/stable.svg)](https://kotlinlang.org/docs/components-stability.html)
[![JetBrains official 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://img.shields.io/maven-central/v/org.jetbrains.kotlinx/kotlinx-coroutines-core/1.7.0-Beta)](https://central.sonatype.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core/1.7.0-Beta)
[![Kotlin](https://img.shields.io/badge/kotlin-1.8.10-blue.svg?logo=kotlin)](http://kotlinlang.org)
[![Download](https://img.shields.io/maven-central/v/org.jetbrains.kotlinx/kotlinx-coroutines-core/1.7.0-RC)](https://central.sonatype.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core/1.7.0-RC)
[![Kotlin](https://img.shields.io/badge/kotlin-1.8.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 the Kotlin `1.8.10` release.
This is a companion version for the Kotlin `1.8.20` release.

```kotlin
suspend fun main() = coroutineScope {
Expand Down Expand Up @@ -85,15 +85,15 @@ Add dependencies (you can also add other modules that you need):
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-coroutines-core</artifactId>
<version>1.7.0-Beta</version>
<version>1.7.0-RC</version>
</dependency>
```

And make sure that you use the latest Kotlin version:

```xml
<properties>
<kotlin.version>1.8.10</kotlin.version>
<kotlin.version>1.8.20</kotlin.version>
</properties>
```

Expand All @@ -103,7 +103,7 @@ Add dependencies (you can also add other modules that you need):

```kotlin
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.0-Beta")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.0-RC")
}
```

Expand All @@ -112,10 +112,10 @@ And make sure that you use the latest Kotlin version:
```kotlin
plugins {
// For build.gradle.kts (Kotlin DSL)
kotlin("jvm") version "1.8.10"
kotlin("jvm") version "1.8.20"

// For build.gradle (Groovy DSL)
id "org.jetbrains.kotlin.jvm" version "1.8.10"
id "org.jetbrains.kotlin.jvm" version "1.8.20"
}
```

Expand All @@ -133,7 +133,7 @@ Add [`kotlinx-coroutines-android`](ui/kotlinx-coroutines-android)
module as a dependency when using `kotlinx.coroutines` on Android:

```kotlin
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.0-Beta")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.0-RC")
```

This gives you access to the Android [Dispatchers.Main]
Expand Down Expand Up @@ -168,7 +168,7 @@ In common code that should get compiled for different platforms, you can add a d
```kotlin
commonMain {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.0-Beta")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.0-RC")
}
}
```
Expand All @@ -180,7 +180,7 @@ Platform-specific dependencies are recommended to be used only for non-multiplat
#### JS

Kotlin/JS version of `kotlinx.coroutines` is published as
[`kotlinx-coroutines-core-js`](https://central.sonatype.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-js/1.7.0-Beta)
[`kotlinx-coroutines-core-js`](https://central.sonatype.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-js/1.7.0-RC)
(follow the link to get the dependency declaration snippet) and as [`kotlinx-coroutines-core`](https://www.npmjs.com/package/kotlinx-coroutines-core) NPM package.

#### Native
Expand Down
17 changes: 16 additions & 1 deletion build.gradle
Expand Up @@ -5,7 +5,10 @@

import org.jetbrains.kotlin.config.KotlinCompilerVersion
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
import org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlugin
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension
import org.jetbrains.kotlin.konan.target.HostManager
import org.jetbrains.dokka.gradle.DokkaTaskPartial

Expand Down Expand Up @@ -361,3 +364,15 @@ allprojects { subProject ->
tasks.named("dokkaHtmlMultiModule") {
pluginsMapConfiguration.set(["org.jetbrains.dokka.base.DokkaBase": """{ "templatesDir": "${projectDir.toString().replace('\\', '/')}/dokka-templates" }"""])
}

if (CacheRedirector.enabled) {
def yarnRootExtension = rootProject.extensions.findByType(YarnRootExtension.class)
if (yarnRootExtension != null) {
yarnRootExtension.downloadBaseUrl = CacheRedirector.maybeRedirect(yarnRootExtension.downloadBaseUrl)
}

def nodeJsExtension = rootProject.extensions.findByType(NodeJsRootExtension.class)
if (nodeJsExtension != null) {
nodeJsExtension.nodeDownloadBaseUrl = CacheRedirector.maybeRedirect(nodeJsExtension.nodeDownloadBaseUrl)
}
}
21 changes: 16 additions & 5 deletions buildSrc/src/main/kotlin/CacheRedirector.kt
Expand Up @@ -26,31 +26,33 @@ private val mirroredUrls = listOf(
"https://dl.google.com/dl/android/studio/ide-zips",
"https://dl.google.com/go",
"https://download.jetbrains.com",
"https://github.com/yarnpkg/yarn/releases/download",
"https://jitpack.io",
"https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev",
"https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap",
"https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev",
"https://maven.pkg.jetbrains.space/kotlin/p/kotlin/eap",
"https://nodejs.org/dist",
"https://oss.sonatype.org/content/repositories/releases",
"https://oss.sonatype.org/content/repositories/snapshots",
"https://oss.sonatype.org/content/repositories/staging",
"https://packages.confluent.io/maven/",
"https://plugins.gradle.org/m2",
"https://plugins.jetbrains.com/maven",
"https://repo1.maven.org/maven2",
"https://repo.grails.org/grails/core",
"https://repo.jenkins-ci.org/releases",
"https://repo.maven.apache.org/maven2",
"https://repo.spring.io/milestone",
"https://repo.typesafe.com/typesafe/ivy-releases",
"https://repo1.maven.org/maven2",
"https://services.gradle.org",
"https://www.exasol.com/artifactory/exasol-releases",
"https://www.jetbrains.com/intellij-repository/nightly",
"https://www.jetbrains.com/intellij-repository/releases",
"https://www.jetbrains.com/intellij-repository/snapshots",
"https://www.myget.org/F/intellij-go-snapshots/maven",
"https://www.myget.org/F/rd-model-snapshots/maven",
"https://www.myget.org/F/rd-snapshots/maven",
"https://www.python.org/ftp",
"https://www.jetbrains.com/intellij-repository/nightly",
"https://www.jetbrains.com/intellij-repository/releases",
"https://www.jetbrains.com/intellij-repository/snapshots"
)

private val aliases = mapOf(
Expand Down Expand Up @@ -115,4 +117,13 @@ object CacheRedirector {
fun Project.configure() {
checkRedirect(repositories, displayName)
}

@JvmStatic
fun maybeRedirect(url: String): String {
if (!cacheRedirectorEnabled) return url
return URI(url).maybeRedirect()?.toString() ?: url
}

@JvmStatic
val isEnabled get() = cacheRedirectorEnabled
}
2 changes: 2 additions & 0 deletions buildSrc/src/main/kotlin/Java9Modularity.kt
Expand Up @@ -143,6 +143,8 @@ object Java9Modularity {
attributes("Multi-Release" to true)
}
from(compileJavaModuleInfo) {
// Include **only** file we are interested in as JavaCompile output also contains some tmp files
include("module-info.class")
into("META-INF/versions/9/")
}
}
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Expand Up @@ -3,14 +3,14 @@
#

# Kotlin
version=1.7.0-Beta-SNAPSHOT
version=1.7.0-RC-SNAPSHOT
group=org.jetbrains.kotlinx
kotlin_version=1.8.10
kotlin_version=1.8.20

# Dependencies
junit_version=4.12
junit5_version=5.7.0
atomicfu_version=0.20.0
atomicfu_version=0.20.2
knit_version=0.4.0
html_version=0.7.2
lincheck_version=2.16
Expand All @@ -20,7 +20,7 @@ reactor_version=3.4.1
reactive_streams_version=1.0.3
rxjava2_version=2.2.8
rxjava3_version=3.0.2
javafx_version=11.0.2
javafx_version=17.0.2
javafx_plugin_version=0.0.8
binary_compatibility_validator_version=0.12.0
kover_version=0.6.1
Expand All @@ -30,7 +30,7 @@ jna_version=5.9.0
# Android versions
android_version=4.1.1.4
androidx_annotation_version=1.1.0
robolectric_version=4.4
robolectric_version=4.9
baksmali_version=2.2.7

# JS
Expand Down
4 changes: 2 additions & 2 deletions integration-testing/gradle.properties
@@ -1,5 +1,5 @@
kotlin_version=1.8.10
coroutines_version=1.7.0-Beta-SNAPSHOT
kotlin_version=1.8.20
coroutines_version=1.7.0-RC-SNAPSHOT
asm_version=9.3

kotlin.code.style=official
Expand Down
@@ -0,0 +1,70 @@
/*
* Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

package kotlinx.coroutines.validator

import org.junit.Test
import org.objectweb.asm.*
import org.objectweb.asm.ClassReader.*
import org.objectweb.asm.ClassWriter.*
import org.objectweb.asm.Opcodes.*
import java.util.jar.*
import kotlin.test.*

class MavenPublicationMetaInfValidator {

@Test
fun testMetaInfCoreStructure() {
val clazz = Class.forName("kotlinx.coroutines.Job")
JarFile(clazz.protectionDomain.codeSource.location.file).checkMetaInfStructure(
setOf(
"MANIFEST.MF",
"kotlinx-coroutines-core.kotlin_module",
"com.android.tools/proguard/coroutines.pro",
"com.android.tools/r8/coroutines.pro",
"proguard/coroutines.pro",
"versions/9/module-info.class",
"kotlinx_coroutines_core.version"
)
)
}

@Test
fun testMetaInfAndroidStructure() {
val clazz = Class.forName("kotlinx.coroutines.android.HandlerDispatcher")
JarFile(clazz.protectionDomain.codeSource.location.file).checkMetaInfStructure(
setOf(
"MANIFEST.MF",
"kotlinx-coroutines-android.kotlin_module",
"services/kotlinx.coroutines.CoroutineExceptionHandler",
"services/kotlinx.coroutines.internal.MainDispatcherFactory",
"com.android.tools/r8-from-1.6.0/coroutines.pro",
"com.android.tools/r8-upto-3.0.0/coroutines.pro",
"com.android.tools/proguard/coroutines.pro",
"proguard/coroutines.pro",
"versions/9/module-info.class",
"kotlinx_coroutines_android.version"
)
)
}

private fun JarFile.checkMetaInfStructure(expected: Set<String>) {
val actual = HashSet<String>()
for (e in entries()) {
if (e.isDirectory() || !e.realName.contains("META-INF")) {
continue
}
val partialName = e.realName.substringAfter("META-INF/")
actual.add(partialName)
}

if (actual != expected) {
val intersection = actual.intersect(expected)
val mismatch = actual.subtract(intersection) + expected.subtract(intersection)
fail("Mismatched files: " + mismatch)
}

close()
}
}
9 changes: 3 additions & 6 deletions kotlinx-coroutines-core/build.gradle
Expand Up @@ -312,12 +312,6 @@ static void configureJvmForLincheck(task, additional = false) {
task moreTest(dependsOn: [jvmStressTest, jvmLincheckTest, jvmLincheckTestAdditional])
check.dependsOn moreTest

tasks.jvmLincheckTest {
kover {
enabled = false // Always disabled, lincheck doesn't really support coverage
}
}

def commonKoverExcludes =
["kotlinx.coroutines.debug.*", // Tested by debug module
"kotlinx.coroutines.channels.ChannelsKt__DeprecatedKt.*", // Deprecated
Expand All @@ -326,6 +320,9 @@ def commonKoverExcludes =
]

kover {
instrumentation {
excludeTasks.add("jvmLincheckTest") // Always disabled, lincheck doesn't really support coverage
}
filters {
classes {
excludes.addAll(commonKoverExcludes)
Expand Down
2 changes: 1 addition & 1 deletion kotlinx-coroutines-core/common/src/JobSupport.kt
Expand Up @@ -208,7 +208,7 @@ public open class JobSupport constructor(active: Boolean) : Job, ChildJob, Paren
assert { state.isCompleting } // consistency check -- must be marked as completing
val proposedException = (proposedUpdate as? CompletedExceptionally)?.cause
// Create the final exception and seal the state so that no more exceptions can be added
var wasCancelling = false // KLUDGE: we cannot have contract for our own expect fun synchronized
val wasCancelling: Boolean
val finalException = synchronized(state) {
wasCancelling = state.isCancelling
val exceptions = state.sealLocked(proposedException)
Expand Down

0 comments on commit 4bc89e2

Please sign in to comment.