1+ /*
2+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+ * SPDX-License-Identifier: Apache-2.0
4+ */
5+ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
6+ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
7+
18/*
29 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
310 * SPDX-License-Identifier: Apache-2.0
411 */
512plugins {
6- kotlin( " jvm" )
13+ alias(libs.plugins.kotlin. jvm)
714 jacoco
815}
916
@@ -38,7 +45,7 @@ dependencies {
3845val generateSdkRuntimeVersion by tasks.registering {
3946 // generate the version of the runtime to use as a resource.
4047 // this keeps us from having to manually change version numbers in multiple places
41- val resourcesDir = " $buildDir / resources/main/aws/sdk/kotlin/codegen"
48+ val resourcesDir = layout.buildDirectory.dir( " resources/main/aws/sdk/kotlin/codegen" ).get()
4249 val versionFile = file(" $resourcesDir /sdk-version.txt" )
4350 val gradlePropertiesFile = rootProject.file(" gradle.properties" )
4451 inputs.file(gradlePropertiesFile)
@@ -49,20 +56,16 @@ val generateSdkRuntimeVersion by tasks.registering {
4956 }
5057}
5158
52- val jvmTargetVersion = JavaVersion . VERSION_17 .toString()
53-
54- tasks.compileKotlin {
55- kotlinOptions.jvmTarget = jvmTargetVersion
59+ tasks.withType< KotlinCompile > {
60+ compilerOptions {
61+ jvmTarget.set( JvmTarget . JVM_1_8 )
62+ }
5663 dependsOn(generateSdkRuntimeVersion)
5764}
5865
59- tasks.compileTestKotlin {
60- kotlinOptions.jvmTarget = jvmTargetVersion
61- }
62-
6366tasks.withType<JavaCompile > {
64- sourceCompatibility = jvmTargetVersion
65- targetCompatibility = jvmTargetVersion
67+ sourceCompatibility = JavaVersion . VERSION_1_8 .toString()
68+ targetCompatibility = JavaVersion . VERSION_1_8 .toString()
6669}
6770
6871// Reusable license copySpec
@@ -94,9 +97,9 @@ tasks.test {
9497// Configure jacoco (code coverage) to generate an HTML report
9598tasks.jacocoTestReport {
9699 reports {
97- xml.isEnabled = false
98- csv.isEnabled = false
99- html.destination = file( " $buildDir / reports/jacoco" )
100+ xml.required.set( false )
101+ csv.required.set( false )
102+ html.outputLocation.set(layout.buildDirectory.dir( " reports/jacoco" ) )
100103 }
101104}
102105
0 commit comments