@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
/ *
* Copyright 2002 - 2022 the original author or authors .
* Copyright 2002 - 2024 the original author or authors .
*
* Licensed under the Apache License , Version 2 . 0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
@ -16,15 +16,14 @@
@@ -16,15 +16,14 @@
package org.springframework.build ;
import java.util.ArrayList ;
import java.util.List ;
import org.gradle.api.Project ;
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions ;
import org.jetbrains.kotlin.gradle.dsl.JvmTarget ;
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion ;
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile ;
/ * *
* @author Brian Clozel
* @author Sebastien Deleuze
* /
public class KotlinConventions {
@ -34,15 +33,14 @@ public class KotlinConventions {
@@ -34,15 +33,14 @@ public class KotlinConventions {
}
private void configure ( KotlinCompile compile ) {
KotlinJvmOptions kotlinOptions = compile . getKotlinOptions ( ) ;
kotlinOptions . setApiVersion ( "1.7" ) ;
kotlinOptions . setLanguageVersion ( "1.7" ) ;
kotlinOptions . setJvmTarget ( "17" ) ;
kotlinOptions . setJavaParameters ( true ) ;
kotlinOptions . setAllWarningsAsErrors ( true ) ;
List < String > freeCompilerArgs = new ArrayList < > ( compile . getKotlinOptions ( ) . getFreeCompilerArgs ( ) ) ;
freeCompilerArgs . addAll ( List . of ( "-Xsuppress-version-warnings" , "-Xjsr305=strict" , "-opt-in=kotlin.RequiresOptIn" ) ) ;
compile . getKotlinOptions ( ) . setFreeCompilerArgs ( freeCompilerArgs ) ;
compile . compilerOptions ( options - > {
options . getApiVersion ( ) . set ( KotlinVersion . KOTLIN_2_1 ) ;
options . getLanguageVersion ( ) . set ( KotlinVersion . KOTLIN_2_1 ) ;
options . getJvmTarget ( ) . set ( JvmTarget . JVM_17 ) ;
options . getJavaParameters ( ) . set ( true ) ;
options . getAllWarningsAsErrors ( ) . set ( true ) ;
options . getFreeCompilerArgs ( ) . addAll ( "-Xsuppress-version-warnings" , "-Xjsr305=strict" , "-opt-in=kotlin.RequiresOptIn" ) ;
} ) ;
}
}