Skip to content

Commit 52e4439

Browse files
authored
misc: merge v1.4 into main (#1218)
1 parent 0bba308 commit 52e4439

File tree

19 files changed

+250
-43
lines changed

19 files changed

+250
-43
lines changed

.brazil.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"dependencies": {
3-
"org.jetbrains.kotlin:kotlin-stdlib:2.0.*": "KotlinStdlib-2.x",
3+
"org.jetbrains.kotlin:kotlin-stdlib:2.*": "KotlinStdlib-2.x",
44
"org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.*": "KotlinxCoroutinesCoreJvm-1.x",
55

66
"com.squareup.okhttp3:okhttp-coroutines:5.*": "OkHttp3Coroutines-5.x",
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"id": "0857b6f0-0444-479f-be6b-06ef71d482a0",
3+
"type": "feature",
4+
"description": "⚠️ **IMPORTANT**: Add `retryStrategy` configuration option for waiters",
5+
"issues": [
6+
"https://github.com/awslabs/aws-sdk-kotlin/issues/1431"
7+
],
8+
"requiresMinorVersionBump": true
9+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"id": "1a68d0b7-00e7-45c0-88f6-95e5c39c9c61",
3+
"type": "misc",
4+
"description": "⚠️ **IMPORTANT**: Upgrade to Kotlin 2.1.0",
5+
"requiresMinorVersionBump": true
6+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"id": "3456d00f-1b29-4d88-ab02-045db1b1ebce",
3+
"type": "bugfix",
4+
"description": "Include more information when retry strategy halts early due to token bucket capacity errors",
5+
"issues": [
6+
"awslabs/aws-sdk-kotlin#1321"
7+
]
8+
}

codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/core/KotlinDependency.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ private fun getDefaultRuntimeVersion(): String {
3737
// publishing info
3838
const val RUNTIME_GROUP: String = "aws.smithy.kotlin"
3939
val RUNTIME_VERSION: String = System.getProperty("smithy.kotlin.codegen.clientRuntimeVersion", getDefaultRuntimeVersion())
40-
val KOTLIN_COMPILER_VERSION: String = System.getProperty("smithy.kotlin.codegen.kotlinCompilerVersion", "2.0.10")
40+
val KOTLIN_COMPILER_VERSION: String = System.getProperty("smithy.kotlin.codegen.kotlinCompilerVersion", "2.1.0")
4141

4242
enum class SourceSet {
4343
CommonMain,

codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/waiters/WaiterGenerator.kt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import java.text.DecimalFormatSymbols
1717
* Renders the top-level retry strategy for a waiter.
1818
*/
1919
private fun KotlinWriter.renderRetryStrategy(wi: WaiterInfo, asValName: String) {
20-
withBlock("val #L = #T {", "}", asValName, RuntimeTypes.Core.Retries.StandardRetryStrategy) {
20+
withBlock("val #L = retryStrategy ?: #T {", "}", asValName, RuntimeTypes.Core.Retries.StandardRetryStrategy) {
2121
write("maxAttempts = 20")
2222
write("tokenBucket = #T", RuntimeTypes.Core.Retries.Delay.InfiniteTokenBucket)
2323
withBlock("delayProvider {", "}") {
@@ -35,18 +35,21 @@ private fun KotlinWriter.renderRetryStrategy(wi: WaiterInfo, asValName: String)
3535
internal fun KotlinWriter.renderWaiter(wi: WaiterInfo) {
3636
write("")
3737
wi.waiter.documentation.ifPresent(::dokka)
38-
val inputParameter = if (wi.input.hasAllOptionalMembers) {
39-
format("request: #1T = #1T { }", wi.inputSymbol)
38+
39+
val requestType = if (wi.input.hasAllOptionalMembers) {
40+
format("#1T = #1T { }", wi.inputSymbol)
4041
} else {
41-
format("request: #T", wi.inputSymbol)
42+
format("#T", wi.inputSymbol)
4243
}
44+
4345
withBlock(
44-
"#L suspend fun #T.#L(#L): #T<#T> {",
46+
"#L suspend fun #T.#L(request: #L, retryStrategy: #T? = null): #T<#T> {",
4547
"}",
4648
wi.ctx.settings.api.visibility,
4749
wi.serviceSymbol,
4850
wi.methodName,
49-
inputParameter,
51+
requestType,
52+
RuntimeTypes.Core.Retries.RetryStrategy,
5053
RuntimeTypes.Core.Retries.Outcome,
5154
wi.outputSymbol,
5255
) {

codegen/smithy-kotlin-codegen/src/test/kotlin/software/amazon/smithy/kotlin/codegen/rendering/waiters/ServiceWaitersGeneratorTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class ServiceWaitersGeneratorTest {
4343
/**
4444
* Wait until a foo exists with optional input
4545
*/
46-
public suspend fun TestClient.waitUntilFooOptionalExists(request: DescribeFooOptionalRequest = DescribeFooOptionalRequest { }): Outcome<DescribeFooOptionalResponse> {
46+
public suspend fun TestClient.waitUntilFooOptionalExists(request: DescribeFooOptionalRequest = DescribeFooOptionalRequest { }, retryStrategy: RetryStrategy? = null): Outcome<DescribeFooOptionalResponse> {
4747
""".trimIndent()
4848
val methodFooter = """
4949
val policy = AcceptorRetryPolicy(request, acceptors)
@@ -59,7 +59,7 @@ class ServiceWaitersGeneratorTest {
5959
/**
6060
* Wait until a foo exists with required input
6161
*/
62-
public suspend fun TestClient.waitUntilFooRequiredExists(request: DescribeFooRequiredRequest): Outcome<DescribeFooRequiredResponse> {
62+
public suspend fun TestClient.waitUntilFooRequiredExists(request: DescribeFooRequiredRequest, retryStrategy: RetryStrategy? = null): Outcome<DescribeFooRequiredResponse> {
6363
""".trimIndent()
6464
listOf(
6565
generateService("simple-service-with-operation-waiter.smithy"),
@@ -105,7 +105,7 @@ class ServiceWaitersGeneratorTest {
105105
@Test
106106
fun testRetryStrategy() {
107107
val expected = """
108-
val strategy = StandardRetryStrategy {
108+
val strategy = retryStrategy ?: StandardRetryStrategy {
109109
maxAttempts = 20
110110
tokenBucket = InfiniteTokenBucket
111111
delayProvider {

codegen/smithy-kotlin-codegen/src/test/kotlin/software/amazon/smithy/kotlin/codegen/rendering/waiters/WaiterGeneratorTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class WaiterGeneratorTest {
2828
@Test
2929
fun testDefaultDelays() {
3030
val expected = """
31-
val strategy = StandardRetryStrategy {
31+
val strategy = retryStrategy ?: StandardRetryStrategy {
3232
maxAttempts = 20
3333
tokenBucket = InfiniteTokenBucket
3434
delayProvider {
@@ -45,7 +45,7 @@ class WaiterGeneratorTest {
4545
@Test
4646
fun testCustomDelays() {
4747
val expected = """
48-
val strategy = StandardRetryStrategy {
48+
val strategy = retryStrategy ?: StandardRetryStrategy {
4949
maxAttempts = 20
5050
tokenBucket = InfiniteTokenBucket
5151
delayProvider {

gradle/libs.versions.toml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
[versions]
2-
kotlin-version = "2.0.21"
2+
kotlin-version = "2.1.0"
33
dokka-version = "1.9.10"
44

5-
aws-kotlin-repo-tools-version = "0.4.16"
5+
aws-kotlin-repo-tools-version = "0.4.17"
66

77
# libs
88
coroutines-version = "1.9.0"
99
atomicfu-version = "0.25.0"
1010
okhttp-version = "5.0.0-alpha.14"
1111
okhttp4-version = "4.12.0"
1212
okio-version = "3.9.1"
13-
otel-version = "1.43.0"
13+
otel-version = "1.45.0"
1414
slf4j-version = "2.0.16"
1515
slf4j-v1x-version = "1.7.36"
16-
crt-kotlin-version = "0.8.10"
17-
micrometer-version = "1.13.6"
16+
crt-kotlin-version = "0.9.0"
17+
micrometer-version = "1.14.2"
18+
binary-compatibility-validator-version = "0.16.3"
1819

1920
# codegen
2021
smithy-version = "1.53.0"
@@ -23,7 +24,7 @@ smithy-gradle-version = "0.9.0"
2324
# testing
2425
junit-version = "5.10.5"
2526
kotest-version = "5.9.1"
26-
kotlin-compile-testing-version = "1.6.0"
27+
kotlin-compile-testing-version = "0.7.0"
2728
kotlinx-benchmark-version = "0.4.12"
2829
kotlinx-serialization-version = "1.7.3"
2930
docker-java-version = "3.4.0"
@@ -80,7 +81,7 @@ smithy-smoke-test-traits = { module = "software.amazon.smithy:smithy-smoke-test-
8081
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-version" }
8182
junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "junit-version" }
8283

83-
kotlin-compile-testing = {module = "com.github.tschuchortdev:kotlin-compile-testing", version.ref = "kotlin-compile-testing-version" }
84+
kotlin-compile-testing = {module = "dev.zacsweers.kctfork:core", version.ref = "kotlin-compile-testing-version" }
8485
kotest-assertions-core = { module = "io.kotest:kotest-assertions-core", version.ref = "kotest-version" }
8586
kotest-assertions-core-jvm = { module = "io.kotest:kotest-assertions-core-jvm", version.ref = "kotest-version" }
8687
kotlinx-benchmark-runtime = { module = "org.jetbrains.kotlinx:kotlinx-benchmark-runtime", version.ref = "kotlinx-benchmark-version" }
@@ -104,7 +105,7 @@ dokka = { id = "org.jetbrains.dokka", version.ref = "dokka-version"}
104105
kotlin-jvm = {id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin-version" }
105106
kotlin-multiplatform = {id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin-version" }
106107
kotlinx-benchmark = { id = "org.jetbrains.kotlinx.benchmark", version.ref = "kotlinx-benchmark-version" }
107-
kotlinx-binary-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version = "0.13.2" }
108+
kotlinx-binary-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binary-compatibility-validator-version" }
108109
kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin-version"}
109110
aws-kotlin-repo-tools-kmp = { id = "aws.sdk.kotlin.gradle.kmp", version.ref = "aws-kotlin-repo-tools-version" }
110111
aws-kotlin-repo-tools-smithybuild = { id = "aws.sdk.kotlin.gradle.smithybuild", version.ref = "aws-kotlin-repo-tools-version" }

runtime/auth/aws-signing-tests/jvm/src/aws/smithy/kotlin/runtime/auth/awssigning/tests/SigningSuiteTestBaseJVM.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import io.ktor.util.*
2828
import io.ktor.utils.io.*
2929
import io.ktor.utils.io.core.*
3030
import kotlinx.coroutines.runBlocking
31+
import kotlinx.io.readByteArray
3132
import kotlinx.serialization.json.*
3233
import org.junit.jupiter.api.Assumptions.assumeTrue
3334
import org.junit.jupiter.api.Test
@@ -383,7 +384,7 @@ public actual abstract class SigningSuiteTestBase : HasSigner {
383384
}
384385

385386
if (hasBody) {
386-
val bytes = runBlocking { chan.readRemaining().readBytes() }
387+
val bytes = runBlocking { chan.readRemaining().readByteArray() }
387388
builder.body = HttpBody.fromBytes(bytes)
388389
}
389390

0 commit comments

Comments
 (0)