Skip to content

Commit cf0a2fb

Browse files
authored
feat: Kotlin 2.1.20-RC release (#4707)
1 parent 196f733 commit cf0a2fb

File tree

6 files changed

+213
-40
lines changed

6 files changed

+213
-40
lines changed

docs/kr.tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
</toc-element>
2525
<toc-element toc-title="What's new in Kotlin">
2626
<toc-element toc-title="Kotlin 2.1.0" accepts-web-file-names="whatsnew.html" topic="whatsnew21.md"/>
27-
<toc-element toc-title="Kotlin 2.1.20-Beta2" topic="whatsnew-eap.md"/>
27+
<toc-element toc-title="Kotlin 2.1.20-RC" topic="whatsnew-eap.md"/>
2828
<toc-element toc-title="Earlier versions">
2929
<toc-element toc-title="Kotlin 2.0.20" topic="whatsnew2020.md"/>
3030
<toc-element toc-title="Kotlin 2.0.0" topic="whatsnew20.md"/>

docs/labels.list

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<primary-label id="alpha" name="Alpha" short-name="α" href="components-stability.html#stability-levels-explained" color="strawberry">The feature is in Alpha. It may change incompatibly and require manual migration in the future.</primary-label>
99
<primary-label id="beta" name="Beta" short-name="β" href="components-stability.html#stability-levels-explained" color="tangerine">The feature is in Beta. It is almost stable, but migration steps may be required in the future. We'll do our best to minimize any changes you have to make.</primary-label>
1010
<primary-label id="advanced" name="Advanced" short-name="" color="purple"></primary-label>
11+
<primary-label id="eap" name="EAP" short-name="EAP" color="red">This functionality is available only in the latest EAP version.</primary-label>
1112

12-
<secondary-label id="eap" name="EAP">This functionality is available only in the latest EAP version.</secondary-label>
13+
<secondary-label id="eap" name="EAP" color="red">This functionality is available only in the latest EAP version.</secondary-label>
1314
</labels>

docs/topics/eap.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ In this channel, you can also get notifications about new EAP builds.
4343
<th>Build highlights</th>
4444
</tr>
4545
<tr>
46-
<td><strong>2.1.20-Beta2</strong>
47-
<p>Released: <strong>January 29, 2025</strong></p>
48-
<p><a href="https://github.com/JetBrains/kotlin/releases/tag/v2.1.20-Beta2" target="_blank">Release on GitHub</a></p>
46+
<td><strong>2.1.20-RC</strong>
47+
<p>Released: <strong>February 19, 2025</strong></p>
48+
<p><a href="https://github.com/JetBrains/kotlin/releases/tag/v2.1.20-RC" target="_blank">Release on GitHub</a></p>
4949
</td>
5050
<td>
5151
<p>A tooling release with K2 kapt enabled by default.</p>
52-
<p>For more details, please refer to the <a href="https://github.com/JetBrains/kotlin/releases/tag/v2.1.20-Beta2">changelog</a> or <a href="whatsnew-eap.md">What's new in Kotlin 2.1.20-Beta2</a>.</p>
52+
<p>For more details, please refer to the <a href="https://github.com/JetBrains/kotlin/releases/tag/v2.1.20-RC">changelog</a> or <a href="whatsnew-eap.md">What's new in Kotlin 2.1.20-RC</a>.</p>
5353
</td>
5454
</tr>
5555
</table>

docs/topics/multiplatform/multiplatform-compatibility-guide.md

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,56 @@ When configuring your project, check the compatibility of a particular version o
3737

3838
This section covers incompatible changes that end their deprecation cycle and come into effect in Kotlin 2.0.0−%kotlinVersion%.
3939

40+
<anchor name="java-source-set-created-by-default"/>
41+
### Java source sets created by default
42+
<primary-label ref="eap"/>
43+
44+
**What's changed?**
45+
46+
To align Kotlin Multiplatform with upcoming changes in Gradle, we are phasing out the `withJava()` function. The `withJava()`
47+
function enabled integration with Gradle's Java plugins by creating the necessary Java source sets. From Kotlin %kotlinEapVersion%,
48+
these Java source sets are created by default.
49+
50+
**What's the best practice now?**
51+
52+
Previously, you had to explicitly use the `withJava()` function to create `src/jvmMain/java` and `src/jvmTest/java` source sets:
53+
54+
```kotlin
55+
kotlin {
56+
jvm {
57+
withJava()
58+
}
59+
}
60+
```
61+
62+
From Kotlin %kotlinEapVersion%, you can remove the `withJava()` function from your build script.
63+
64+
In addition, Gradle now only runs Java compile tasks if Java sources are present, triggering a JVM validation
65+
diagnostic that previously didn't run before. This diagnostic fails if you explicitly configure an incompatible JVM target
66+
for `KotlinJvmCompile` tasks or inside `compilerOptions`. For guidance on ensuring JVM target compatibility, see
67+
[Check for JVM target compatibility of related compile tasks](gradle-configure-project.md#check-for-jvm-target-compatibility-of-related-compile-tasks).
68+
69+
If your project uses Gradle versions higher than 8.7 and doesn't rely on Gradle Java plugins, like [Java](https://docs.gradle.org/current/userguide/java_plugin.html),
70+
[Java Library](https://docs.gradle.org/current/userguide/java_library_plugin.html), or [Application](https://docs.gradle.org/current/userguide/application_plugin.html),
71+
or a third party Gradle plugin that has a dependency on a Gradle Java plugin, you can remove the `withJava()` function.
72+
73+
If your project uses the [Application](https://docs.gradle.org/current/userguide/application_plugin.html) Gradle Java plugin,
74+
we recommend migrating to the [new Experimental DSL](whatsnew-eap.md#kotlin-multiplatform-new-dsl-to-replace-gradle-s-application-plugin).
75+
Starting with Gradle 8.7, the Application plugin will no longer work with the Kotlin Multiplatform Gradle plugin.
76+
77+
If you want to use both the Kotlin Multiplatform Gradle plugin and other Gradle plugins for
78+
Java in your multiplatform project, see [Deprecated compatibility with Kotlin Multiplatform Gradle plugin and Java plugins](multiplatform-compatibility-guide.md#deprecated-compatibility-with-kotlin-multiplatform-gradle-plugin-and-gradle-java-plugins).
79+
80+
If you run into any issues, report them in our [issue tracker](https://kotl.in/issue) or ask for help in our [public Slack channel](https://kotlinlang.slack.com/archives/C19FD9681).
81+
82+
**When do the changes take effect?**
83+
84+
Here's the planned deprecation cycle:
85+
86+
* Gradle >8.6: introduce a deprecation warning for any previous version of Kotlin in multiplatform projects using the `withJava()` function.
87+
* Gradle 9.0: raise this warning to an error.
88+
* %kotlinEapVersion%: introduce a deprecation warning when using the `withJava()` function with any version of Gradle.
89+
4090
<anchor name="android-target-rename"/>
4191
### Rename of `android` target to `androidTarget`
4292

@@ -633,7 +683,7 @@ Here's the planned deprecation cycle:
633683

634684
* 1.3.40: introduce a warning when `targetPresets.jvmWithJava` is used
635685
* 1.9.20: raise this warning to an error
636-
* &gt;1.9.20: remove `targetPresets.jvmWithJava` API; attempts to use it lead to the buildscript compilation failure
686+
* >1.9.20: remove `targetPresets.jvmWithJava` API; attempts to use it lead to the buildscript compilation failure
637687

638688
> Even though the whole `targetPresets` API is deprecated, the `jvmWithJava` preset has a different deprecation timeline.
639689
>
@@ -764,6 +814,7 @@ declarations. Also, it's now only possible to import forward declarations by usi
764814

765815
This section covers incompatible changes that end their deprecation cycle and come into effect in Kotlin 1.7.01.8.22.
766816

817+
<anchor name="deprecated-compatibility-with-kmp-gradle-plugin-and-gradle-java-plugins"/>
767818
### Deprecated compatibility with Kotlin Multiplatform Gradle plugin and Gradle Java plugins {initial-collapse-state="collapsed" collapsible="true"}
768819

769820
**What's changed?**
@@ -805,7 +856,7 @@ If you see this deprecation warning in your multiplatform project, we recommend
805856
Otherwise, if you want to use both the Kotlin Multiplatform Gradle plugin and these Gradle plugins for Java in your multiplatform
806857
project, we recommend that you:
807858

808-
1. Create a separate subproject in your multiplatform project.
859+
1. Create a separate subproject in your Gradle project.
809860
2. In the separate subproject, apply the Gradle plugin for Java.
810861
3. In the separate subproject, add a dependency on your parent multiplatform project.
811862

@@ -814,7 +865,7 @@ project, we recommend that you:
814865
{style="warning"}
815866

816867
For example, you have a multiplatform project called `my-main-project` and you want
817-
to use the [Application](https://docs.gradle.org/current/userguide/application_plugin.html) Gradle plugin to run a JVM application.
868+
to use the [Java Library](https://docs.gradle.org/current/userguide/java_library_plugin.html) Gradle plugin.
818869

819870
Once you've created a subproject, let's call it `subproject-A`, your parent project structure should look like this:
820871

@@ -828,14 +879,14 @@ Once you've created a subproject, let's call it `subproject-A`, your parent proj
828879
└── Main.java
829880
```
830881

831-
In your subproject's `build.gradle.kts` file, apply the Application plugin in the `plugins {}` block:
882+
In your subproject's `build.gradle.kts` file, apply the Java Library plugin in the `plugins {}` block:
832883
833884
<tabs group="build-script">
834885
<tab title="Kotlin" group-key="kotlin">
835886
836887
```kotlin
837888
plugins {
838-
id("application")
889+
id("java-library")
839890
}
840891
```
841892
@@ -844,7 +895,7 @@ plugins {
844895
845896
```groovy
846897
plugins {
847-
id('application')
898+
id('java-library')
848899
}
849900
```
850901

0 commit comments

Comments
 (0)