From d757a2113c6a516940ae01e03082b34695d08316 Mon Sep 17 00:00:00 2001 From: Dmitry Sulman Date: Sat, 1 Mar 2025 10:59:29 +0200 Subject: [PATCH] Upgrade to Kotlin 2.1.10 - Upgrade kotlinVersion to 2.1.10 - Remove org.jetbrains.kotlin:kotlin-compiler-embeddable from dependencies - Replace deprecated kotlinOptions with compilerOptions - Update KotlinConventions of ConventionsPlugin to set Kotlin apiVersion and languageVersion to 2.1 - Fix redeclaration error with Kotlin compiler on spring-boot-doc - Upgrade PluginClasspathGradleBuild to inject missed Kotlin compiler related jars See spring-projectsgh-38539 Signed-off-by: Dmitry Sulman --- buildSrc/build.gradle | 1 - .../boot/build/ConventionsPlugin.java | 5 ++++- .../boot/build/KotlinConventions.java | 22 ++++++++++--------- gradle.properties | 2 +- .../spring-boot-dependencies/build.gradle | 5 +++-- .../spring-boot-docs/build.gradle | 22 +++++++++++++++++++ .../spring-boot-gradle-plugin/build.gradle | 1 - .../gradle/plugin/KotlinPluginAction.java | 4 ++-- .../KotlinPluginActionIntegrationTests.java | 4 ++-- .../testkit/PluginClasspathGradleBuild.java | 21 ++++++++++++++++++ ...anOverrideDefaultJavaParametersFlag.gradle | 6 ++--- ...TasksUseJavaParametersFlagByDefault.gradle | 4 ++-- 12 files changed, 72 insertions(+), 25 deletions(-) diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index d998c7306783..5e624a776058 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -42,7 +42,6 @@ dependencies { implementation("org.apache.maven:maven-embedder:${mavenVersion}") implementation("org.antora:gradle-antora-plugin:1.0.0") implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}") - implementation("org.jetbrains.kotlin:kotlin-compiler-embeddable:${kotlinVersion}") implementation("org.springframework:spring-context") implementation("org.springframework:spring-core") implementation("org.springframework:spring-web") diff --git a/buildSrc/src/main/java/org/springframework/boot/build/ConventionsPlugin.java b/buildSrc/src/main/java/org/springframework/boot/build/ConventionsPlugin.java index 8bd7f2fb21d1..740d120884a2 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/ConventionsPlugin.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/ConventionsPlugin.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,6 +35,9 @@ * When the {@link AntoraPlugin} is applied, the conventions in {@link AntoraConventions} * are applied. * + * When the {@code org.jetbrains.kotlin.jvm} plugin is applied, the conventions in + * {@link KotlinConventions} are applied. + * * @author Andy Wilkinson * @author Christoph Dreis * @author Mike Smithson diff --git a/buildSrc/src/main/java/org/springframework/boot/build/KotlinConventions.java b/buildSrc/src/main/java/org/springframework/boot/build/KotlinConventions.java index 32b38af396de..3f65957dec14 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/KotlinConventions.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/KotlinConventions.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,9 @@ import org.gradle.api.Project; import org.gradle.api.tasks.SourceSet; import org.gradle.api.tasks.SourceSetContainer; -import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions; +import org.jetbrains.kotlin.gradle.dsl.JvmTarget; +import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompilerOptions; +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion; import org.jetbrains.kotlin.gradle.tasks.KotlinCompile; /** @@ -35,7 +37,7 @@ *