From 2fec7b8562f2ae9350aed1a7eb0e45b640d8c450 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Sat, 5 Feb 2022 09:54:00 +0000 Subject: [PATCH] Only use Kotlin 1.6 API and language versions in docs project To preserve our existing Kotlin 1.3 baseline, we should compile our Kotlin code with Kotlin 1.3 API and language versions. At the same time, we want our documentation to use modern Kotlin. This commit restores the 1.3 convention and overrides it to 1.6 in the docs project. This maintains our Kotlin 1.3 baseline while also allowing the Kotlin code examples to use 1.6 API and language features. Closes gh-29654 --- .../org/springframework/boot/build/KotlinConventions.java | 4 ++-- spring-boot-project/spring-boot-docs/build.gradle | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) 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 cdf7708ca4..6d2a5a13da 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/KotlinConventions.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/KotlinConventions.java @@ -49,8 +49,8 @@ class KotlinConventions { private void configure(KotlinCompile compile) { KotlinJvmOptions kotlinOptions = compile.getKotlinOptions(); - kotlinOptions.setApiVersion("1.6"); - kotlinOptions.setLanguageVersion("1.6"); + kotlinOptions.setApiVersion("1.3"); + kotlinOptions.setLanguageVersion("1.3"); kotlinOptions.setJvmTarget("1.8"); kotlinOptions.setAllWarningsAsErrors(true); List freeCompilerArgs = new ArrayList<>(compile.getKotlinOptions().getFreeCompilerArgs()); diff --git a/spring-boot-project/spring-boot-docs/build.gradle b/spring-boot-project/spring-boot-docs/build.gradle index 71a7c9563e..2a23cb8301 100644 --- a/spring-boot-project/spring-boot-docs/build.gradle +++ b/spring-boot-project/spring-boot-docs/build.gradle @@ -40,6 +40,11 @@ plugins.withType(EclipsePlugin) { } } +tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) { + kotlinOptions.apiVersion = '1.6' + kotlinOptions.languageVersion = '1.6' +} + dependencies { actuatorApiDocumentation(project(path: ":spring-boot-project:spring-boot-actuator-autoconfigure", configuration: "documentation"))