@@ -5,6 +5,7 @@ import org.jetbrains.gradle.ext.copyright
5
5
import org.jetbrains.gradle.ext.settings
6
6
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
7
7
import kotlin.math.min
8
+ import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
8
9
9
10
plugins {
10
11
id(" org.jetbrains.kotlin.jvm" ) version " 1.8.22"
@@ -145,7 +146,6 @@ val e2eTest: SourceSet by sourceSets.creating {
145
146
runtimeClasspath + = sourceSets[" main" ].output
146
147
}
147
148
148
- @Suppress(" UnstableApiUsage" ) // `configurations` container is incubating
149
149
configurations {
150
150
compatTestCompileClasspath {
151
151
extendsFrom(testCompileClasspath.get())
@@ -170,44 +170,28 @@ sourceSets {
170
170
}
171
171
}
172
172
173
- kotlin.target.compilations.configureEach {
174
- // Supporting Gradle 6.2+ needs to use Kotlin 1.3.
175
- // See https://docs.gradle.org/current/userguide/compatibility.html
176
- // For future maintainer: Kotlin 1.9.0 dropped support for Kotlin 1.3, it'll only support 1.4+.
177
- // This means Gradle 7.0 will be the lowest supportable version for plugins .
178
- val usedKotlinVersion = @Suppress( " DEPRECATION " ) KotlinVersion . KOTLIN_1_3
173
+ tasks {
174
+ withType< KotlinJvmCompile >().configureEach {
175
+ compilerOptions {
176
+ // Gradle fully supports running on Java 8: https://docs.gradle.org/current/userguide/compatibility.html,
177
+ // so we should allow users to do that too .
178
+ jvmTarget = JvmTarget . JVM_1_8
179
179
180
- compilerOptions.configure {
181
- // Gradle fully supports running on Java 8: https://docs.gradle.org/current/userguide/compatibility.html,
182
- // so we should allow users to do that too.
183
- jvmTarget = JvmTarget .fromTarget(JavaVersion .VERSION_1_8 .toString())
180
+ // Suppress "Language version 1.3 is deprecated and its support will be removed in a future version of Kotlin".
181
+ freeCompilerArgs.add(" -Xsuppress-version-warnings" )
184
182
185
- // Suppress "Language version 1.3 is deprecated and its support will be removed in a future version of Kotlin".
186
- freeCompilerArgs.add(" -Xsuppress-version-warnings" )
187
- }
188
- compileTaskProvider.configure {
189
- // These two (api & lang) needs to be here instead of in compilations.compilerOptions.configure { },
190
- // to prevent KotlinDslCompilerPlugins overriding to Kotlin 1.8.
191
- compilerOptions.apiVersion = usedKotlinVersion
192
- // Theoretically we could use newer language version here,
193
- // but sadly the @kotlin.Metadata created on the classes would be incompatible with older consumers.
194
- compilerOptions.languageVersion = usedKotlinVersion
183
+ // Supporting Gradle 6.2+ needs to use Kotlin 1.3.
184
+ // See https://docs.gradle.org/current/userguide/compatibility.html
185
+ // For future maintainer: Kotlin 1.9.0 dropped support for Kotlin 1.3, it'll only support 1.4+.
186
+ // This means Gradle 7.0 will be the lowest supportable version for plugins.
187
+ val usedKotlinVersion = @Suppress(" DEPRECATION" ) KotlinVersion .KOTLIN_1_3
195
188
196
- // Validate that we're using the right version.
197
- doFirst {
198
- val api = compilerOptions.apiVersion.get()
199
- val language = compilerOptions.languageVersion.get()
200
- if (api != usedKotlinVersion || language != usedKotlinVersion) {
201
- TODO (
202
- " There's mismatch between configured and actual versions:\n " +
203
- " apiVersion=${api} , languageVersion=${language} , configured=${usedKotlinVersion} ."
204
- )
205
- }
189
+ apiVersion = usedKotlinVersion
190
+ // Theoretically we could use newer language version here,
191
+ // but sadly the @kotlin.Metadata created on the classes would be incompatible with older consumers.
192
+ languageVersion = usedKotlinVersion
206
193
}
207
194
}
208
- }
209
-
210
- tasks {
211
195
shadowJar {
212
196
exclude(" META-INF/maven/**" , " META-INF/proguard/**" , " META-INF/*.kotlin_module" )
213
197
manifest {
0 commit comments