Skip to content

Commit 03abd80

Browse files
committed
Resolve deprecation warnings
1 parent c643776 commit 03abd80

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2+
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
13
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
24

35
plugins {
@@ -10,24 +12,24 @@ tasks.named("kotlinSourcesJar") {
1012
}
1113

1214
tasks.withType<KotlinCompile>().configureEach {
13-
kotlinOptions {
14-
apiVersion = "1.6"
15-
languageVersion = "1.6"
15+
compilerOptions {
16+
apiVersion = KotlinVersion.fromVersion("1.6")
17+
languageVersion = apiVersion
1618
allWarningsAsErrors = false
1719
// Compiler arg is required for Kotlin 1.6 and below
1820
// see https://kotlinlang.org/docs/whatsnew17.html#stable-opt-in-requirements
19-
freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
21+
freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn")
2022
}
2123
}
2224

2325
afterEvaluate {
2426
val extension = project.the<JavaLibraryExtension>()
2527
tasks {
2628
withType<KotlinCompile>().configureEach {
27-
kotlinOptions.jvmTarget = extension.mainJavaVersion.toString()
29+
compilerOptions.jvmTarget = JvmTarget.fromTarget(extension.mainJavaVersion.toString())
2830
}
2931
named<KotlinCompile>("compileTestKotlin") {
30-
kotlinOptions.jvmTarget = extension.testJavaVersion.toString()
32+
compilerOptions.jvmTarget = JvmTarget.fromTarget(extension.testJavaVersion.toString())
3133
}
3234
}
3335
}

gradle/plugins/common/src/main/kotlin/junitbuild/java/UpdateJarAction.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package junitbuild.java
22

33
import org.gradle.api.Action
44
import org.gradle.api.Task
5-
import org.gradle.api.internal.file.archive.ZipCopyAction
5+
import org.gradle.api.internal.file.archive.ZipEntryConstants
66
import org.gradle.api.provider.ListProperty
77
import org.gradle.api.provider.Property
88
import org.gradle.jvm.toolchain.JavaLauncher
@@ -19,7 +19,7 @@ abstract class UpdateJarAction @Inject constructor(private val operations: ExecO
1919
// Since ZipCopyAction.CONSTANT_TIME_FOR_ZIP_ENTRIES is in the default time zone (see its Javadoc),
2020
// we're converting it to the same time in UTC here to make the jar reproducible regardless of the
2121
// build's time zone.
22-
private val CONSTANT_TIME_FOR_ZIP_ENTRIES = LocalDateTime.ofInstant(Instant.ofEpochMilli(ZipCopyAction.CONSTANT_TIME_FOR_ZIP_ENTRIES), ZoneId.systemDefault())
22+
private val CONSTANT_TIME_FOR_ZIP_ENTRIES = LocalDateTime.ofInstant(Instant.ofEpochMilli(ZipEntryConstants.CONSTANT_TIME_FOR_ZIP_ENTRIES), ZoneId.systemDefault())
2323
.toInstant(ZoneOffset.UTC)
2424
.toString()
2525
}

0 commit comments

Comments
 (0)