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
This commit is contained in:
Andy Wilkinson 2022-02-05 09:54:00 +00:00
parent 4ab858a689
commit 2fec7b8562
2 changed files with 7 additions and 2 deletions

View File

@ -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<String> freeCompilerArgs = new ArrayList<>(compile.getKotlinOptions().getFreeCompilerArgs());

View File

@ -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"))