Polish KotlinConventions
This commit is contained in:
parent
f8c2bff825
commit
d33d92dfce
|
|
@ -43,17 +43,19 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile;
|
||||||
class KotlinConventions {
|
class KotlinConventions {
|
||||||
|
|
||||||
void apply(Project project) {
|
void apply(Project project) {
|
||||||
project.getPlugins().withId("org.jetbrains.kotlin.jvm", (plugin) -> {
|
project.getPlugins().withId("org.jetbrains.kotlin.jvm",
|
||||||
project.getTasks().withType(KotlinCompile.class, (compile) -> {
|
(plugin) -> project.getTasks().withType(KotlinCompile.class, this::configure));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void configure(KotlinCompile compile) {
|
||||||
KotlinJvmOptions kotlinOptions = compile.getKotlinOptions();
|
KotlinJvmOptions kotlinOptions = compile.getKotlinOptions();
|
||||||
kotlinOptions.setApiVersion("1.6");
|
kotlinOptions.setApiVersion("1.6");
|
||||||
kotlinOptions.setLanguageVersion("1.6");
|
kotlinOptions.setLanguageVersion("1.6");
|
||||||
|
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");
|
||||||
compile.getKotlinOptions().setFreeCompilerArgs(freeCompilerArgs);
|
compile.getKotlinOptions().setFreeCompilerArgs(freeCompilerArgs);
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue