Polish KotlinConventions

pull/29745/head
Phillip Webb 3 years ago
parent f8c2bff825
commit d33d92dfce

@ -43,17 +43,19 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile;
class KotlinConventions {
void apply(Project project) {
project.getPlugins().withId("org.jetbrains.kotlin.jvm", (plugin) -> {
project.getTasks().withType(KotlinCompile.class, (compile) -> {
project.getPlugins().withId("org.jetbrains.kotlin.jvm",
(plugin) -> project.getTasks().withType(KotlinCompile.class, this::configure));
}
private void configure(KotlinCompile compile) {
KotlinJvmOptions kotlinOptions = compile.getKotlinOptions();
kotlinOptions.setApiVersion("1.6");
kotlinOptions.setLanguageVersion("1.6");
kotlinOptions.setJvmTarget("1.8");
kotlinOptions.setAllWarningsAsErrors(true);
List<String> freeCompilerArgs = new ArrayList<>(compile.getKotlinOptions().getFreeCompilerArgs());
freeCompilerArgs.add("-Xsuppress-version-warnings");
compile.getKotlinOptions().setFreeCompilerArgs(freeCompilerArgs);
});
});
}
}

Loading…
Cancel
Save