Skip to content

Commit a73f757

Browse files
authored
chore: upgrade to gradle 8.5 (#1153)
* chore: upgrade to gradle 8.5 * bump plugin version and remove suppression * bump to 1.9.21 and fix warnings * more fixes * fix: use KGP from version catalog * bump atomicfu to 0.23.1
1 parent b75777b commit a73f757

File tree

18 files changed

+113
-80
lines changed

18 files changed

+113
-80
lines changed

aws-runtime/aws-config/build.gradle.kts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ kotlin {
4141
// additional dependencies required by generated sso provider(s)
4242
implementation(libs.smithy.kotlin.aws.json.protocols)
4343

44-
// atomics
45-
implementation(libs.kotlinx.atomicfu)
46-
4744
// coroutines
4845
implementation(libs.kotlinx.coroutines.core)
4946
}
@@ -70,7 +67,7 @@ kotlin {
7067
}
7168

7269
fun awsModelFile(name: String): String =
73-
rootProject.file("codegen/sdk/aws-models/$name").relativeTo(project.buildDir).toString()
70+
rootProject.file("codegen/sdk/aws-models/$name").relativeTo(project.layout.buildDirectory.get().asFile).toString()
7471

7572
codegen {
7673
val basePackage = "aws.sdk.kotlin.runtime.auth.credentials.internal"
@@ -200,13 +197,17 @@ val codegenTask = tasks.named("generateSmithyProjections")
200197
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
201198
dependsOn(codegenTask)
202199

203-
// generated sts/sso credential providers have quite a few warnings
204-
kotlinOptions.allWarningsAsErrors = false
200+
compilerOptions {
201+
// generated sts/sso credential providers have quite a few warnings
202+
allWarningsAsErrors.set(false)
203+
}
205204
}
206205

207206
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile> {
208207
dependsOn(codegenTask)
209-
kotlinOptions.allWarningsAsErrors = false
208+
compilerOptions {
209+
allWarningsAsErrors.set(false)
210+
}
210211
}
211212

212213
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompileCommon> {
@@ -243,6 +244,7 @@ listOf("apiElements", "runtimeElements").forEach {
243244

244245
// suppress internal generated clients
245246
tasks.named<DokkaTaskPartial>("dokkaHtmlPartial") {
247+
dependsOn(codegenTask)
246248
dokkaSourceSets.configureEach {
247249
perPackageOption {
248250
matchingRegex.set(""".*\.internal.*""")

aws-runtime/build.gradle.kts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
*/
55
import aws.sdk.kotlin.gradle.dsl.configurePublishing
66
import aws.sdk.kotlin.gradle.kmp.*
7+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
78

89
description = "AWS client runtime support for generated service clients"
910

10-
@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed
1111
plugins {
1212
alias(libs.plugins.dokka)
1313
alias(libs.plugins.kotlinx.binary.compatibility.validator)
@@ -64,8 +64,14 @@ subprojects {
6464
}
6565

6666
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
67-
kotlinOptions {
68-
jvmTarget = "1.8"
67+
compilerOptions {
68+
jvmTarget.set(JvmTarget.JVM_1_8)
69+
freeCompilerArgs.add("-Xexpect-actual-classes")
70+
}
71+
}
72+
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile> {
73+
compilerOptions {
74+
freeCompilerArgs.add("-Xexpect-actual-classes")
6975
}
7076
}
7177
}

build.gradle.kts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,18 @@ buildscript {
1414
classpath(libs.kotlinx.atomicfu.plugin)
1515
classpath("aws.sdk.kotlin:build-plugins") {
1616
version {
17-
require("0.2.9")
17+
require("0.3.0")
1818
}
1919
}
2020
}
2121
}
2222

2323
plugins {
24-
@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed
2524
alias(libs.plugins.dokka)
25+
// ensure the correct version of KGP ends up on our buildscript classpath
26+
// since build-plugins also has <some> version in its dependency closure
27+
alias(libs.plugins.kotlin.multiplatform) apply false
28+
alias(libs.plugins.kotlin.jvm) apply false
2629
}
2730

2831
// configures (KMP) subprojects with our own KMP conventions and some default dependencies

codegen/aws-sdk-codegen/build.gradle.kts

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
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
*/
512
plugins {
6-
kotlin("jvm")
13+
alias(libs.plugins.kotlin.jvm)
714
jacoco
815
}
916

@@ -38,7 +45,7 @@ dependencies {
3845
val 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-
6366
tasks.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
9598
tasks.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

codegen/aws-sdk-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/GradleGenerator.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ class GradleGenerator : KotlinIntegration {
4545
writer.write("project.ext.set(#S, #S)", "aws.sdk.id", ctx.settings.sdkId)
4646
writer.write("")
4747

48-
writer.write("val kotlinVersion: String by project")
49-
5048
val allDependencies = delegator.dependencies.mapNotNull { it.properties["dependency"] as? KotlinDependency }.distinct()
5149

5250
writer

codegen/smithy-aws-kotlin-codegen/build.gradle.kts

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
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
*/
512
plugins {
6-
kotlin("jvm")
13+
alias(libs.plugins.kotlin.jvm)
714
jacoco
815
}
916

@@ -34,19 +41,15 @@ dependencies {
3441
testImplementation(libs.kotlinx.serialization.json)
3542
}
3643

37-
val jvmTargetVersion = JavaVersion.VERSION_17.toString()
38-
39-
tasks.compileKotlin {
40-
kotlinOptions.jvmTarget = jvmTargetVersion
41-
}
42-
43-
tasks.compileTestKotlin {
44-
kotlinOptions.jvmTarget = jvmTargetVersion
44+
tasks.withType<KotlinCompile> {
45+
compilerOptions {
46+
jvmTarget.set(JvmTarget.JVM_1_8)
47+
}
4548
}
4649

4750
tasks.withType<JavaCompile> {
48-
sourceCompatibility = jvmTargetVersion
49-
targetCompatibility = jvmTargetVersion
51+
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
52+
targetCompatibility = JavaVersion.VERSION_1_8.toString()
5053
}
5154

5255
// Reusable license copySpec
@@ -78,9 +81,9 @@ tasks.test {
7881
// Configure jacoco (code coverage) to generate an HTML report
7982
tasks.jacocoTestReport {
8083
reports {
81-
xml.isEnabled = false
82-
csv.isEnabled = false
83-
html.destination = file("$buildDir/reports/jacoco")
84+
xml.required.set(false)
85+
csv.required.set(false)
86+
html.outputLocation.set(layout.buildDirectory.dir("reports/jacoco"))
8487
}
8588
}
8689

dokka-aws/build.gradle.kts

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
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
*/
512
plugins {
6-
kotlin("jvm")
13+
alias(libs.plugins.kotlin.jvm)
714
}
815

916
description = "Custom Dokka plugin for AWS Kotlin SDK API docs"
@@ -13,9 +20,14 @@ dependencies {
1320
compileOnly(libs.dokka.core)
1421
}
1522

16-
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
17-
kotlinOptions {
18-
jvmTarget = "1.8"
19-
allWarningsAsErrors = false // FIXME Dokka bundles stdlib into the classpath, causing an unfixable warning
23+
tasks.withType<KotlinCompile> {
24+
compilerOptions {
25+
jvmTarget.set(JvmTarget.JVM_1_8)
26+
allWarningsAsErrors.set(false) // FIXME Dokka bundles stdlib into the classpath, causing an unfixable warning
2027
}
2128
}
29+
30+
tasks.withType<JavaCompile> {
31+
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
32+
targetCompatibility = JavaVersion.VERSION_1_8.toString()
33+
}

gradle.properties

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ org.gradle.jvmargs=-Xmx6g -XX:MaxMetaspaceSize=2G
88
# sdk
99
sdkVersion=1.0.20-SNAPSHOT
1010

11-
# kotlin
12-
kotlinVersion=1.9.20
13-
1411
# dokka config (values specified at build-time as needed)
1512
smithyKotlinDocBaseUrl=https://sdk.amazonaws.com/kotlin/api/smithy-kotlin/api/$smithyKotlinRuntimeVersion/
1613

1714
# atomicfu
18-
kotlinx.atomicfu.enableJvmIrTransformation=true
15+
kotlinx.atomicfu.enableJvmIrTransformation=true
16+
# FIXME - https://github.com/Kotlin/kotlinx-atomicfu/issues/274
17+
kotlinx.atomicfu.enableNativeIrTransformation=false

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[versions]
2-
kotlin-version = "1.9.20"
2+
kotlin-version = "1.9.21"
33
dokka-version = "1.9.10"
44

55
# libs
66
coroutines-version = "1.7.3"
7-
atomicfu-version = "0.22.0"
7+
atomicfu-version = "0.23.1"
88

99
# smithy-kotlin codegen and runtime are versioned separately
1010
smithy-kotlin-runtime-version = "1.0.4"

gradle/wrapper/gradle-wrapper.jar

2.04 KB
Binary file not shown.

0 commit comments

Comments
 (0)