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
pull/29745/head
Andy Wilkinson 3 years ago
parent 4ab858a689
commit 2fec7b8562

@ -49,8 +49,8 @@ class KotlinConventions {
private void configure(KotlinCompile compile) { private void configure(KotlinCompile compile) {
KotlinJvmOptions kotlinOptions = compile.getKotlinOptions(); KotlinJvmOptions kotlinOptions = compile.getKotlinOptions();
kotlinOptions.setApiVersion("1.6"); kotlinOptions.setApiVersion("1.3");
kotlinOptions.setLanguageVersion("1.6"); kotlinOptions.setLanguageVersion("1.3");
kotlinOptions.setJvmTarget("1.8"); kotlinOptions.setJvmTarget("1.8");
kotlinOptions.setAllWarningsAsErrors(true); kotlinOptions.setAllWarningsAsErrors(true);
List<String> freeCompilerArgs = new ArrayList<>(compile.getKotlinOptions().getFreeCompilerArgs()); List<String> freeCompilerArgs = new ArrayList<>(compile.getKotlinOptions().getFreeCompilerArgs());

@ -40,6 +40,11 @@ plugins.withType(EclipsePlugin) {
} }
} }
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
kotlinOptions.apiVersion = '1.6'
kotlinOptions.languageVersion = '1.6'
}
dependencies { dependencies {
actuatorApiDocumentation(project(path: ":spring-boot-project:spring-boot-actuator-autoconfigure", configuration: "documentation")) actuatorApiDocumentation(project(path: ":spring-boot-project:spring-boot-actuator-autoconfigure", configuration: "documentation"))

Loading…
Cancel
Save