Skip to content

Update Kotlin to 1.9.0 #3814

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
[![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.2)](https://central.sonatype.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core/1.7.2)
[![Kotlin](https://img.shields.io/badge/kotlin-1.8.20-blue.svg?logo=kotlin)](http://kotlinlang.org)
[![Kotlin](https://img.shields.io/badge/kotlin-1.9.0-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.20` release.
This is a companion version for the Kotlin `1.9.0` release.

```kotlin
suspend fun main() = coroutineScope {
Expand Down Expand Up @@ -93,7 +93,7 @@ And make sure that you use the latest Kotlin version:

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

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.20"
kotlin("jvm") version "1.9.0"

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

Expand Down
4 changes: 1 addition & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ buildscript {
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version"
classpath "org.jetbrains.kotlinx:atomicfu-gradle-plugin:$atomicfu_version"
classpath "org.jetbrains.kotlinx:kotlinx-knit:$knit_version"
classpath "com.github.node-gradle:gradle-node-plugin:$gradle_node_version"
classpath "org.jetbrains.kotlinx:binary-compatibility-validator:$binary_compatibility_validator_version"
classpath "ru.vyarus:gradle-animalsniffer-plugin:1.5.4" // Android API check
classpath "org.jetbrains.kotlin:atomicfu:$kotlin_version"
Expand Down Expand Up @@ -161,7 +160,6 @@ configure(subprojects.findAll { !sourceless.contains(it.name) && it.name != core
}

apply from: rootProject.file("gradle/compile-js-multiplatform.gradle")
apply from: rootProject.file("gradle/publish-npm-js.gradle")
kotlin.sourceSets.commonMain.dependencies {
api project(":$coreModule")
}
Expand Down Expand Up @@ -303,7 +301,7 @@ allprojects {

// --------------- Configure sub-projects that are published ---------------

def publishTasks = getTasksByName("publish", true) + getTasksByName("publishNpm", true)
def publishTasks = getTasksByName("publish", true)

task deploy(dependsOn: publishTasks)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ configure(subprojects) {
}

val KotlinCommonOptions.versionsAreNotOverridden: Boolean
get() = languageVersion == null && apiVersion == null
get() = languageVersion == null && apiVersion == null
3 changes: 2 additions & 1 deletion buildSrc/src/main/kotlin/kotlin-js-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// Platform-specific configuration to compile JS modules

import org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile
import org.jetbrains.kotlin.gradle.targets.js.*

plugins {
kotlin("js")
Expand All @@ -15,7 +16,7 @@ dependencies {
}

kotlin {
js(LEGACY) {
js(IR) {
moduleName = project.name.removeSuffix("-js")
}

Expand Down
14 changes: 1 addition & 13 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Kotlin
version=1.7.2-SNAPSHOT
group=org.jetbrains.kotlinx
kotlin_version=1.8.20
kotlin_version=1.9.0

# Dependencies
junit_version=4.12
Expand Down Expand Up @@ -33,18 +33,6 @@ androidx_annotation_version=1.1.0
robolectric_version=4.9
baksmali_version=2.2.7

# JS
kotlin.js.compiler=both
gradle_node_version=3.1.1
node_version=10.0.0
npm_version=5.7.1
mocha_version=6.2.2
mocha_headless_chrome_version=1.8.2
mocha_teamcity_reporter_version=3.0.0
source_map_support_version=0.5.16
jsdom_version=15.2.1
jsdom_global_version=3.0.2

# Settings
kotlin.incremental.multiplatform=true
kotlin.native.ignoreDisabledTargets=true
Expand Down
67 changes: 3 additions & 64 deletions gradle/compile-js-multiplatform.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,12 @@
* Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

apply from: rootProject.file('gradle/node-js.gradle')

kotlin {
js {
moduleName = project.name

// In 1.4.x it has in `both` and `legacy` mode and js() is of type `KotlinJsTarget`
// `irTarget` is non-null in `both` mode
// and contains appropriate `irTarget` with type `KotlinJsIrTarget`
// `irTarget` is null in `legacy` mode
if (it.irTarget != null) {
irTarget.nodejs()
irTarget.compilations['main']?.dependencies {
api "org.jetbrains.kotlinx:atomicfu-js:$atomicfu_version"
}
nodejs()
compilations['main']?.dependencies {
api "org.jetbrains.kotlinx:atomicfu-js:$atomicfu_version"
}
}

Expand All @@ -26,55 +17,3 @@ kotlin {
}
}
}

// When source sets are configured
apply from: rootProject.file('gradle/test-mocha-js.gradle')

def compileJsLegacy = tasks.hasProperty("compileKotlinJsLegacy")
? compileKotlinJsLegacy
: compileKotlinJs

def compileTestJsLegacy = tasks.hasProperty("compileTestKotlinJsLegacy")
? compileTestKotlinJsLegacy
: compileTestKotlinJs

compileJsLegacy.configure {
kotlinOptions.metaInfo = true
kotlinOptions.sourceMap = true
kotlinOptions.moduleKind = 'umd'

kotlinOptions {
// drop -js suffix from outputFile
def baseName = project.name - "-js"
outputFile = new File(outputFileProperty.get().parent, baseName + ".js")
}
}

compileTestJsLegacy.configure {
kotlinOptions.metaInfo = true
kotlinOptions.sourceMap = true
kotlinOptions.moduleKind = 'umd'
}


task populateNodeModules(type: Copy, dependsOn: compileTestJsLegacy) {
// we must copy output that is transformed by atomicfu
from(kotlin.js().compilations.main.output.allOutputs)
into node.nodeProjectDir.dir("node_modules")

def configuration = configurations.hasProperty("jsLegacyTestRuntimeClasspath")
? configurations.jsLegacyTestRuntimeClasspath
: configurations.jsTestRuntimeClasspath

from(files {
configuration.collect { File file ->
file.name.endsWith(".jar") ?
zipTree(file.absolutePath).matching {
include '*.js'
include '*.js.map'
} : files()
}
}.builtBy(configuration))
}

npmInstall.dependsOn populateNodeModules
40 changes: 0 additions & 40 deletions gradle/node-js.gradle

This file was deleted.

54 changes: 0 additions & 54 deletions gradle/publish-npm-js.gradle

This file was deleted.

105 changes: 0 additions & 105 deletions gradle/test-mocha-js.gradle

This file was deleted.

Loading