mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Configure Kotlin compilation JVM target by convention
Closes gh-29952
This commit is contained in:
parent
49337f30da
commit
1e8d29f7aa
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2021 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -31,6 +31,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile;
|
|||||||
* <li>{@link KotlinCompile} tasks are configured to:
|
* <li>{@link KotlinCompile} tasks are configured to:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>Use {@code apiVersion} and {@code languageVersion} 1.3.
|
* <li>Use {@code apiVersion} and {@code languageVersion} 1.3.
|
||||||
|
* <li>Use {@code jvmTarget} 1.8.
|
||||||
* <li>Treat all warnings as errors
|
* <li>Treat all warnings as errors
|
||||||
* <li>Suppress version warnings
|
* <li>Suppress version warnings
|
||||||
* </ul>
|
* </ul>
|
||||||
@ -48,6 +49,7 @@ class KotlinConventions {
|
|||||||
KotlinJvmOptions kotlinOptions = compile.getKotlinOptions();
|
KotlinJvmOptions kotlinOptions = compile.getKotlinOptions();
|
||||||
kotlinOptions.setApiVersion("1.3");
|
kotlinOptions.setApiVersion("1.3");
|
||||||
kotlinOptions.setLanguageVersion("1.3");
|
kotlinOptions.setLanguageVersion("1.3");
|
||||||
|
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());
|
||||||
freeCompilerArgs.add("-Xsuppress-version-warnings");
|
freeCompilerArgs.add("-Xsuppress-version-warnings");
|
||||||
|
@ -161,18 +161,6 @@ sourceSets {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compileKotlin {
|
|
||||||
kotlinOptions {
|
|
||||||
jvmTarget = 1.8
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
compileTestKotlin {
|
|
||||||
kotlinOptions {
|
|
||||||
jvmTarget = 1.8
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
toolchain {
|
toolchain {
|
||||||
testJvmArgs.add("--add-opens=java.base/java.net=ALL-UNNAMED")
|
testJvmArgs.add("--add-opens=java.base/java.net=ALL-UNNAMED")
|
||||||
}
|
}
|
||||||
|
@ -6,18 +6,6 @@ plugins {
|
|||||||
|
|
||||||
description = "Spring Boot WebFlux coroutines smoke test"
|
description = "Spring Boot WebFlux coroutines smoke test"
|
||||||
|
|
||||||
compileKotlin {
|
|
||||||
kotlinOptions {
|
|
||||||
jvmTarget = "1.8"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
compileTestKotlin {
|
|
||||||
kotlinOptions {
|
|
||||||
jvmTarget = "1.8"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-webflux"))
|
implementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-webflux"))
|
||||||
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
|
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
|
||||||
|
Loading…
Reference in New Issue
Block a user