Skip to content
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

make changes for Kotlin 2.1.0 #462

Merged
merged 1 commit into from
Dec 3, 2024
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
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
Change Log
==========

## 0.20.0 **UNRELEASED**

- Updated to Kotlin 2.1.0
- Enable new Kotlin language features
- [Guard conditions in when with a subject](https://kotlinlang.org/docs/whatsnew21.html#guard-conditions-in-when-with-a-subject) (`-Xwhen-guards`),
- [Non-local break and continue](https://kotlinlang.org/docs/whatsnew21.html#non-local-break-and-continue) (`-Xnon-local-break-continue`)
- [Multi-dollar string interpolation](https://kotlinlang.org/docs/whatsnew21.html#multi-dollar-string-interpolation) (`-Xmulti-dollar-interpolation`)
- New Gradle properties to configure Kotlin compiler daemon:
- enable [`extraWarnings` option](https://kotlinlang.org/docs/whatsnew21.html#extra-compiler-checks) in the
compiler by default, can be disabled by setting `fgp.kotlin.extraWarnings=false`
- replaced the `fgp.kotlin.allowWarnings` property with `fgp.kotlin.warningsAsErrors` (defaults to true)
- allow easily suppressing deprecation warnings by setting `fgp.kotlin.suppressDeprecationWarnings=true`
(defaults to false)


## 0.19.2 *(2024-12-02)*

- Disable progressive mode for kapt stub generation when not using K2.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ public abstract class FreeleticsBasePlugin : Plugin<Project> {
?.let(KotlinVersion::fromVersion) ?: KotlinVersion.DEFAULT
languageVersion.set(version)

allWarningsAsErrors.set(!booleanProperty("fgp.kotlin.allowWarnings", false).get())
extraWarnings.set(booleanProperty("fgp.kotlin.extraWarnings", true))
allWarningsAsErrors.set(booleanProperty("fgp.kotlin.warningsAsErrors", true))
if (booleanProperty("fgp.kotlin.suppressDeprecationWarnings", false).get()) {
freeCompilerArgs.add("-Xsuppress-warning=DEPRECATION")
}

// In this mode, some deprecations and bug-fixes for unstable code take effect immediately.
progressiveMode.set(version >= KotlinVersion.DEFAULT)
Expand All @@ -83,6 +87,9 @@ public abstract class FreeleticsBasePlugin : Plugin<Project> {
// https://kotlinlang.org/docs/whatsnew1530.html#improvements-to-type-inference-for-recursive-generic-types
freeCompilerArgs.add("-Xself-upper-bound-inference")

// Kotlin 2.1 experimental language features
freeCompilerArgs.addAll("-Xwhen-guards", "-Xnon-local-break-continue", "-Xmulti-dollar-interpolation")

if (this is KotlinJvmCompilerOptions) {
jvmTarget.set(project.jvmTarget)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import com.freeletics.gradle.plugin.FreeleticsJvmExtension
import com.freeletics.gradle.plugin.FreeleticsMultiplatformExtension
import org.gradle.api.Project
import org.gradle.api.plugins.JavaPluginExtension
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.HasConfigurableKotlinCompilerOptions
import org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinCommonCompilerOptions
Expand Down Expand Up @@ -42,7 +41,6 @@ internal fun Project.kotlin(action: KotlinProjectExtension.() -> Unit) {
(project.extensions.getByName("kotlin") as KotlinProjectExtension).action()
}

@OptIn(ExperimentalKotlinGradlePluginApi::class)
internal fun KotlinProjectExtension.compilerOptions(configure: KotlinCommonCompilerOptions.() -> Unit) {
when (this) {
is KotlinJvmProjectExtension -> compilerOptions(configure)
Expand Down
Loading