diff --git a/.brazil.json b/.brazil.json index 39e8cfcb97..84f32a7403 100644 --- a/.brazil.json +++ b/.brazil.json @@ -11,19 +11,31 @@ "aws.sdk.kotlin.crt:aws-crt-kotlin:0.9.*": "AwsCrtKotlin-0.9.x", "aws.sdk.kotlin.crt:aws-crt-kotlin:0.8.*": "AwsCrtKotlin-0.8.x", "com.squareup.okhttp3:okhttp:4.*": "OkHttp3-4.x", - "org.jetbrains.kotlinx:kotlinx-datetime-jvm:0.*": "KotlinxDatetimeJvm-0.x" + "org.jetbrains.kotlinx:kotlinx-datetime-jvm:0.*": "KotlinxDatetimeJvm-0.x", + + "software.amazon.smithy:smithy-aws-traits:1.*": "Maven-software-amazon-smithy_smithy-aws-traits-1.x", + "software.amazon.smithy:smithy-aws-iam-traits:1.*": "Maven-software-amazon-smithy_smithy-aws-iam-traits-1.x", + "software.amazon.smithy:smithy-aws-cloudformation-traits:1.*": "Maven-software-amazon-smithy_smithy-aws-cloudformation-traits-1.x", + "software.amazon.smithy:smithy-protocol-test-traits:1.*": "Maven-software-amazon-smithy_smithy-protocol-test-traits-1.x", + "software.amazon.smithy:smithy-protocol-traits:1.*": "Maven-software-amazon-smithy_smithy-protocol-traits-1.x", + "software.amazon.smithy:smithy-aws-endpoints:1.*": "Maven-software-amazon-smithy_smithy-aws-endpoints-1.x", + "software.amazon.smithy:smithy-codegen-core:1.*": "Maven-software-amazon-smithy_smithy-codegen-core-1.x", + "software.amazon.smithy:smithy-waiters:1.*": "Maven-software-amazon-smithy_smithy-waiters-1.x", + "software.amazon.smithy:smithy-rules-engine:1.*": "Maven-software-amazon-smithy_smithy-rules-engine-1.x", + "software.amazon.smithy:smithy-smoke-test-traits:1.*": "Maven-software-amazon-smithy_smithy-smoke-test-traits-1.x", + "org.jsoup:jsoup:1.19.*": "Maven-jsoup-1.19.x" }, "packageHandlingRules": { "versioning": { "defaultVersionLayout": "{MAJOR}.0.x", "overrides": { - "software.amazon.smithy.kotlin:smithy-kotlin-codegen": "{MAJOR}.{MINOR}.x", - "software.amazon.smithy.kotlin:smithy-kotlin-codegen-testutils": "{MAJOR}.{MINOR}.x" + "software.amazon.smithy.kotlin:smithy-aws-kotlin-codegen": "{MAJOR}.x", + "software.amazon.smithy.kotlin:smithy-kotlin-codegen": "{MAJOR}.x" } }, "rename": { - "software.amazon.smithy.kotlin:smithy-kotlin-codegen": "SmithyKotlinCodegen", - "software.amazon.smithy.kotlin:smithy-kotlin-codegen-testutils": "SmithyKotlinCodegenTestUtils" + "software.amazon.smithy.kotlin:smithy-aws-kotlin-codegen": "AwsSmithyAwsKotlinCodegen", + "software.amazon.smithy.kotlin:smithy-kotlin-codegen": "AwsSmithyKotlinCodegen" }, "ignore": [ "aws.smithy.kotlin:http-test", @@ -31,7 +43,8 @@ "aws.smithy.kotlin:telemetry-provider-micrometer", "aws.smithy.kotlin:testing", "aws.smithy.kotlin:bom", - "aws.smithy.kotlin:version-catalog" + "aws.smithy.kotlin:version-catalog", + "software.amazon.smithy.kotlin:smithy-kotlin-codegen-testutils" ], "resolvesConflictDependencies": { "org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.*": [ diff --git a/.github/workflows/artifact-size-metrics.yml b/.github/workflows/artifact-size-metrics.yml index fb0be57b67..9e6cfe1dba 100644 --- a/.github/workflows/artifact-size-metrics.yml +++ b/.github/workflows/artifact-size-metrics.yml @@ -65,55 +65,7 @@ jobs: run: ./gradlew analyzeArtifactSizeMetrics - name: Show Results - uses: actions/github-script@v7 - with: - script: | - const getComments = - `query { - repository(owner:"${context.repo.owner}", name:"${context.repo.repo}"){ - pullRequest(number: ${context.issue.number}) { - id - comments(last:100) { - nodes { - id - body - author { - login - } - isMinimized - } - } - } - } - }` - - const response = await github.graphql(getComments) - const comments = response.repository.pullRequest.comments.nodes - - const mutations = comments - .filter(comment => comment.author.login == 'github-actions' && !comment.isMinimized && comment.body.startsWith('Affected Artifacts')) - .map(comment => - github.graphql( - `mutation { - minimizeComment(input:{subjectId:"${comment.id}", classifier:OUTDATED}){ - clientMutationId - } - }` - ) - ) - await Promise.all(mutations) - - const fs = require('node:fs') - const comment = fs.readFileSync('build/reports/metrics/artifact-analysis.md', 'utf8') - - const writeComment = - `mutation { - addComment(input:{body:"""${comment}""", subjectId:"${response.repository.pullRequest.id}"}){ - clientMutationId - } - }` - - await github.graphql(writeComment) + uses: awslabs/aws-kotlin-repo-tools/.github/actions/artifact-size-metrics/show-results@main - name: Evaluate if: ${{ !contains(github.event.pull_request.labels.*.name, 'acknowledge-artifact-size-increase') }} diff --git a/.github/workflows/merge-main.yml b/.github/workflows/merge-main.yml index 560876bdf3..1b354b2ad7 100644 --- a/.github/workflows/merge-main.yml +++ b/.github/workflows/merge-main.yml @@ -1,11 +1,11 @@ name: Merge main on: - schedule: - - cron: "0 7 * * 1-5" # At 07:00 UTC (00:00 PST, 03:00 EST), Monday through Friday + push: + branches: [ main ] workflow_dispatch: jobs: - test: + merge: runs-on: ubuntu-latest steps: - name: Merge main diff --git a/.github/workflows/sync-mirror.yml b/.github/workflows/sync-mirror.yml new file mode 100644 index 0000000000..edc80ce30c --- /dev/null +++ b/.github/workflows/sync-mirror.yml @@ -0,0 +1,20 @@ +name: Sync Mirror + +on: + push: + branches: [ main ] + workflow_dispatch: + +jobs: + git-sync: + # Only sync when pushing to source repo + if: github.repository == 'smithy-lang/smithy-kotlin' + runs-on: ubuntu-latest + steps: + - name: git-sync + uses: wei/git-sync@v3 + with: + source_repo: "https://aws-sdk-kotlin-ci:${{ secrets.CI_USER_PAT }}@github.com/smithy-lang/smithy-kotlin.git" + source_branch: "main" + destination_repo: "https://aws-sdk-kotlin-ci:${{ secrets.CI_USER_PAT }}@github.com/smithy-lang/private-smithy-kotlin-staging.git" + destination_branch: "main" \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index cbcfddf75f..f44b2726cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [1.4.13] - 04/10/2025 + +## [1.4.12] - 04/04/2025 + ## [1.4.11] - 03/14/2025 ## [1.4.10] - 03/06/2025 diff --git a/codegen/smithy-aws-kotlin-codegen/build.gradle.kts b/codegen/smithy-aws-kotlin-codegen/build.gradle.kts index 96a7442a5c..d2fdef82f4 100644 --- a/codegen/smithy-aws-kotlin-codegen/build.gradle.kts +++ b/codegen/smithy-aws-kotlin-codegen/build.gradle.kts @@ -13,15 +13,11 @@ plugins { } val codegenVersion: String by project -description = "Codegen support for AWS protocols" +description = "Smithy codegen support for AWS protocols" group = "software.amazon.smithy.kotlin" version = codegenVersion -val sdkVersion: String by project - dependencies { - - implementation(libs.kotlin.stdlib.jdk8) api(project(":codegen:smithy-kotlin-codegen")) api(libs.smithy.aws.traits) diff --git a/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/core/RuntimeTypes.kt b/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/core/RuntimeTypes.kt index b6341e0443..3d59c8d1e9 100644 --- a/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/core/RuntimeTypes.kt +++ b/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/core/RuntimeTypes.kt @@ -115,6 +115,7 @@ object RuntimeTypes { } object SmokeTests : RuntimeTypePackage(KotlinDependency.CORE, "smoketests") { + val DefaultPrinter = symbol("DefaultPrinter") val exitProcess = symbol("exitProcess") val printExceptionStackTrace = symbol("printExceptionStackTrace") val SmokeTestsException = symbol("SmokeTestsException") diff --git a/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/lang/KotlinTypes.kt b/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/lang/KotlinTypes.kt index 242ba4d0da..6d2384584e 100644 --- a/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/lang/KotlinTypes.kt +++ b/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/lang/KotlinTypes.kt @@ -109,6 +109,7 @@ object KotlinTypes { } object Text : RuntimeTypePackage(KotlinDependency.KOTLIN_STDLIB, "text") { + val Appendable = stdlibSymbol("Appendable") val encodeToByteArray = stdlibSymbol("encodeToByteArray") } diff --git a/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/smoketests/SmokeTestsRunnerGenerator.kt b/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/smoketests/SmokeTestsRunnerGenerator.kt index df8eeda53e..a3124d7bff 100644 --- a/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/smoketests/SmokeTestsRunnerGenerator.kt +++ b/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/smoketests/SmokeTestsRunnerGenerator.kt @@ -4,6 +4,7 @@ import software.amazon.smithy.codegen.core.Symbol import software.amazon.smithy.kotlin.codegen.core.* import software.amazon.smithy.kotlin.codegen.integration.SectionId import software.amazon.smithy.kotlin.codegen.integration.SectionKey +import software.amazon.smithy.kotlin.codegen.lang.KotlinTypes import software.amazon.smithy.kotlin.codegen.model.getTrait import software.amazon.smithy.kotlin.codegen.model.hasTrait import software.amazon.smithy.kotlin.codegen.rendering.ShapeValueGenerator @@ -17,8 +18,8 @@ import software.amazon.smithy.kotlin.codegen.rendering.util.format import software.amazon.smithy.kotlin.codegen.utils.dq import software.amazon.smithy.kotlin.codegen.utils.toCamelCase import software.amazon.smithy.kotlin.codegen.utils.topDownOperations -import software.amazon.smithy.model.node.* -import software.amazon.smithy.model.shapes.* +import software.amazon.smithy.model.node.Node +import software.amazon.smithy.model.shapes.OperationShape import software.amazon.smithy.smoketests.traits.SmokeTestCase import software.amazon.smithy.smoketests.traits.SmokeTestsTrait import kotlin.jvm.optionals.getOrNull @@ -61,25 +62,47 @@ class SmokeTestsRunnerGenerator( ) { internal fun render() { writer.declareSection(SmokeTestSectionIds.SmokeTestsFile) { - writer.write("private var exitCode = 0") + write("") + + withBlock("public suspend fun main() {", "}") { + write("val success = SmokeTestRunner().runAllTests()") + withBlock("if (!success) {", "}") { + write("#T(1)", RuntimeTypes.Core.SmokeTests.exitProcess) + } + } + write("") + renderRunnerClass() + } + } + + private fun renderRunnerClass() { + writer.withBlock( + "public class SmokeTestRunner(private val platform: #1T = #1T.System, private val printer: #2T = #3T) {", + "}", + RuntimeTypes.Core.Utils.PlatformProvider, + KotlinTypes.Text.Appendable, + RuntimeTypes.Core.SmokeTests.DefaultPrinter, + ) { renderEnvironmentVariables() - writer.declareSection(SmokeTestSectionIds.AdditionalEnvironmentVariables) - writer.write("") - writer.withBlock("public suspend fun main() {", "}") { - renderFunctionCalls() - write("#T(exitCode)", RuntimeTypes.Core.SmokeTests.exitProcess) + declareSection(SmokeTestSectionIds.AdditionalEnvironmentVariables) + write("") + + withBlock("public suspend fun runAllTests(): Boolean =", "") { + withBlock("listOf Boolean>(", ")") { + renderFunctionReferences() + } + indent() + write(".map { it() }") + write(".all { it }") + dedent() } - writer.write("") renderFunctions() } } private fun renderEnvironmentVariables() { // Skip tags - writer.writeInline( - "private val skipTags = #T.System.getenv(", - RuntimeTypes.Core.Utils.PlatformProvider, - ) + writer.writeInline("private val skipTags = platform.getenv(") writer.declareSection(SmokeTestSectionIds.SkipTags) { writer.writeInline("#S", SKIP_TAGS) } @@ -89,10 +112,7 @@ class SmokeTestsRunnerGenerator( ) // Service filter - writer.writeInline( - "private val serviceFilter = #T.System.getenv(", - RuntimeTypes.Core.Utils.PlatformProvider, - ) + writer.writeInline("private val serviceFilter = platform.getenv(") writer.declareSection(SmokeTestSectionIds.ServiceFilter) { writer.writeInline("#S", SERVICE_FILTER) } @@ -102,10 +122,10 @@ class SmokeTestsRunnerGenerator( ) } - private fun renderFunctionCalls() { + private fun renderFunctionReferences() { operations.forEach { operation -> operation.getTrait()?.testCases?.forEach { testCase -> - writer.write("${testCase.functionName}()") + writer.write("::${testCase.functionName},") } } } @@ -120,7 +140,7 @@ class SmokeTestsRunnerGenerator( } private fun renderFunction(operation: OperationShape, testCase: SmokeTestCase) { - writer.withBlock("private suspend fun ${testCase.functionName}() {", "}") { + writer.withBlock("private suspend fun ${testCase.functionName}(): Boolean {", "}") { write("val tags = setOf(${testCase.tags.joinToString(",") { it.dq()} })") writer.withBlock("if ((serviceFilter.isNotEmpty() && #S !in serviceFilter) || tags.any { it in skipTags }) {", "}", sdkId) { printTestResult( @@ -131,10 +151,10 @@ class SmokeTestsRunnerGenerator( "ok", "# skip", ) - writer.write("return") + writer.write("return true") } write("") - withInlineBlock("try {", "} ") { + withInlineBlock("return try {", "} ") { renderTestCase(operation, testCase) } withBlock("catch (exception: Exception) {", "}") { @@ -149,6 +169,8 @@ class SmokeTestsRunnerGenerator( closeAndOpenBlock("}.#T { client ->", RuntimeTypes.Core.IO.use) renderOperation(operation, testCase) } + writer.write("") + writer.write("error(#S)", "Unexpectedly completed smoke test operation without throwing exception") } private fun renderClientConfig(testCase: SmokeTestCase) { @@ -212,9 +234,11 @@ class SmokeTestsRunnerGenerator( ) writer.withBlock("if (!success) {", "}") { - write("#T(exception)", RuntimeTypes.Core.SmokeTests.printExceptionStackTrace) - write("exitCode = 1") + write("printer.appendLine(exception.stackTraceToString().prependIndent(#S))", "# ") } + + writer.write("") + writer.write("success") } // Helpers @@ -241,7 +265,7 @@ class SmokeTestsRunnerGenerator( val expectation = if (errorExpected) "error expected from service" else "no error expected from service" val status = statusOverride ?: "\$status" val testResult = "$status $service $testCase - $expectation $directive" - writer.write("println(#S)", testResult) + writer.write("printer.appendLine(#S)", testResult) } /** @@ -250,18 +274,6 @@ class SmokeTestsRunnerGenerator( private val SmokeTestCase.functionName: String get() = this.id.toCamelCase() - /** - * Get the operation parameters for a [SmokeTestCase] - */ - private val SmokeTestCase.operationParameters: Map - get() = this.params.get().members - - /** - * Checks if there are operation parameters for a [SmokeTestCase] - */ - private val SmokeTestCase.hasOperationParameters: Boolean - get() = this.params.isPresent - /** * Check if a [SmokeTestCase] is expecting a specific error */ diff --git a/codegen/smithy-kotlin-codegen/src/test/kotlin/software/amazon/smithy/kotlin/codegen/rendering/smoketests/SmokeTestsRunnerGeneratorTest.kt b/codegen/smithy-kotlin-codegen/src/test/kotlin/software/amazon/smithy/kotlin/codegen/rendering/smoketests/SmokeTestsRunnerGeneratorTest.kt index 50291a482f..c9d4b535c1 100644 --- a/codegen/smithy-kotlin-codegen/src/test/kotlin/software/amazon/smithy/kotlin/codegen/rendering/smoketests/SmokeTestsRunnerGeneratorTest.kt +++ b/codegen/smithy-kotlin-codegen/src/test/kotlin/software/amazon/smithy/kotlin/codegen/rendering/smoketests/SmokeTestsRunnerGeneratorTest.kt @@ -74,10 +74,9 @@ class SmokeTestsRunnerGeneratorTest { fun variablesTest() { generatedCode.shouldContainOnlyOnceWithDiff( """ - private var exitCode = 0 - private val skipTags = PlatformProvider.System.getenv("SMOKE_TEST_SKIP_TAGS")?.let { it.split(",").map { it.trim() }.toSet() } ?: emptySet() - private val serviceFilter = PlatformProvider.System.getenv("SMOKE_TEST_SERVICE_IDS")?.let { it.split(",").map { it.trim() }.toSet() } - """.trimIndent(), + private val skipTags = platform.getenv("SMOKE_TEST_SKIP_TAGS")?.let { it.split(",").map { it.trim() }.toSet() } ?: emptySet() + private val serviceFilter = platform.getenv("SMOKE_TEST_SERVICE_IDS")?.let { it.split(",").map { it.trim() }.toSet() } + """.formatForTest(), ) } @@ -86,27 +85,50 @@ class SmokeTestsRunnerGeneratorTest { generatedCode.shouldContainOnlyOnceWithDiff( """ public suspend fun main() { - successTest() - invalidMessageErrorTest() - failureTest() - exitProcess(exitCode) + val success = SmokeTestRunner().runAllTests() + if (!success) { + exitProcess(1) + } } """.trimIndent(), ) } + @Test + fun runnerClassTest() { + generatedCode.shouldContainOnlyOnceWithDiff( + "public class SmokeTestRunner(private val platform: PlatformProvider = PlatformProvider.System, private val printer: Appendable = DefaultPrinter) {", + ) + } + + @Test + fun runAllTestsTest() { + generatedCode.shouldContainOnlyOnceWithDiff( + """ + public suspend fun runAllTests(): Boolean = + listOf Boolean>( + ::successTest, + ::invalidMessageErrorTest, + ::failureTest, + ) + .map { it() } + .all { it } + """.formatForTest(), + ) + } + @Test fun successTest() { generatedCode.shouldContainOnlyOnceWithDiff( """ - private suspend fun successTest() { + private suspend fun successTest(): Boolean { val tags = setOf("success") if ((serviceFilter.isNotEmpty() && "Test" !in serviceFilter) || tags.any { it in skipTags }) { - println("ok Test SuccessTest - no error expected from service # skip") - return + printer.appendLine("ok Test SuccessTest - no error expected from service # skip") + return true } - - try { + + return try { TestClient { interceptors.add(SmokeTestsInterceptor()) region = "eu-central-1" @@ -118,18 +140,21 @@ class SmokeTestsRunnerGeneratorTest { } ) } - + + error("Unexpectedly completed smoke test operation without throwing exception") + } catch (exception: Exception) { val success: Boolean = exception is SmokeTestsSuccessException val status: String = if (success) "ok" else "not ok" - println("${'$'}status Test SuccessTest - no error expected from service ") + printer.appendLine("${'$'}status Test SuccessTest - no error expected from service ") if (!success) { - printExceptionStackTrace(exception) - exitCode = 1 + printer.appendLine(exception.stackTraceToString().prependIndent("# ")) } + + success } } - """.trimIndent(), + """.formatForTest(), ) } @@ -137,14 +162,14 @@ class SmokeTestsRunnerGeneratorTest { fun invalidMessageErrorTest() { generatedCode.shouldContainOnlyOnceWithDiff( """ - private suspend fun invalidMessageErrorTest() { + private suspend fun invalidMessageErrorTest(): Boolean { val tags = setOf() if ((serviceFilter.isNotEmpty() && "Test" !in serviceFilter) || tags.any { it in skipTags }) { - println("ok Test InvalidMessageErrorTest - error expected from service # skip") - return + printer.appendLine("ok Test InvalidMessageErrorTest - error expected from service # skip") + return true } - try { + return try { TestClient { }.use { client -> client.testOperation( @@ -154,17 +179,20 @@ class SmokeTestsRunnerGeneratorTest { ) } + error("Unexpectedly completed smoke test operation without throwing exception") + } catch (exception: Exception) { val success: Boolean = exception is InvalidMessageError val status: String = if (success) "ok" else "not ok" - println("${'$'}status Test InvalidMessageErrorTest - error expected from service ") + printer.appendLine("${'$'}status Test InvalidMessageErrorTest - error expected from service ") if (!success) { - printExceptionStackTrace(exception) - exitCode = 1 + printer.appendLine(exception.stackTraceToString().prependIndent("# ")) } + + success } } - """.trimIndent(), + """.formatForTest(), ) } @@ -172,14 +200,14 @@ class SmokeTestsRunnerGeneratorTest { fun failureTest() { generatedCode.shouldContainOnlyOnceWithDiff( """ - private suspend fun failureTest() { + private suspend fun failureTest(): Boolean { val tags = setOf() if ((serviceFilter.isNotEmpty() && "Test" !in serviceFilter) || tags.any { it in skipTags }) { - println("ok Test FailureTest - error expected from service # skip") - return + printer.appendLine("ok Test FailureTest - error expected from service # skip") + return true } - try { + return try { TestClient { interceptors.add(SmokeTestsInterceptor()) }.use { client -> @@ -190,17 +218,20 @@ class SmokeTestsRunnerGeneratorTest { ) } + error("Unexpectedly completed smoke test operation without throwing exception") + } catch (exception: Exception) { val success: Boolean = exception is SmokeTestsFailureException val status: String = if (success) "ok" else "not ok" - println("${'$'}status Test FailureTest - error expected from service ") + printer.appendLine("${'$'}status Test FailureTest - error expected from service ") if (!success) { - printExceptionStackTrace(exception) - exitCode = 1 + printer.appendLine(exception.stackTraceToString().prependIndent("# ")) } + + success } } - """.trimIndent(), + """.formatForTest(), ) } diff --git a/gradle.properties b/gradle.properties index 0fb1b05582..027c949497 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,7 +14,7 @@ kotlinx.atomicfu.enableNativeIrTransformation=false org.gradle.jvmargs=-Xmx2G -XX:MaxMetaspaceSize=1G # SDK -sdkVersion=1.4.12-SNAPSHOT +sdkVersion=1.4.14-SNAPSHOT # codegen -codegenVersion=0.34.12-SNAPSHOT \ No newline at end of file +codegenVersion=0.34.14-SNAPSHOT \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9c78ac4ba9..44bd104c99 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,7 +2,7 @@ kotlin-version = "2.1.0" dokka-version = "1.9.10" -aws-kotlin-repo-tools-version = "0.4.24-kn" +aws-kotlin-repo-tools-version = "0.4.26-kn" # libs coroutines-version = "1.9.0" @@ -32,7 +32,7 @@ kotlinx-serialization-version = "1.7.3" docker-java-version = "3.4.0" ktor-version = "3.1.1" kaml-version = "0.55.0" -jsoup-version = "1.18.1" +jsoup-version = "1.19.1" [libraries] aws-kotlin-repo-tools-build-support = { module="aws.sdk.kotlin.gradle:build-support", version.ref = "aws-kotlin-repo-tools-version" } diff --git a/runtime/runtime-core/api/runtime-core.api b/runtime/runtime-core/api/runtime-core.api index 625f873deb..0976667a2f 100644 --- a/runtime/runtime-core/api/runtime-core.api +++ b/runtime/runtime-core/api/runtime-core.api @@ -2107,6 +2107,7 @@ public final class aws/smithy/kotlin/runtime/smoketests/SmokeTestsFunctionsJVMKt } public final class aws/smithy/kotlin/runtime/smoketests/SmokeTestsFunctionsKt { + public static final fun getDefaultPrinter ()Ljava/lang/Appendable; public static final fun printExceptionStackTrace (Ljava/lang/Exception;)V } diff --git a/runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/smoketests/SmokeTestsFunctions.kt b/runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/smoketests/SmokeTestsFunctions.kt index 682817193d..3da3bb8c23 100644 --- a/runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/smoketests/SmokeTestsFunctions.kt +++ b/runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/smoketests/SmokeTestsFunctions.kt @@ -15,7 +15,21 @@ public expect fun exitProcess(status: Int): Nothing * # at executors.JavaRunnerExecutor$Companion.main(JavaRunnerExecutor.kt:27) * # at executors.JavaRunnerExecutor.main(JavaRunnerExecutor.kt) */ +@Deprecated( + message = "No longer used, target for removal in 1.5", + replaceWith = ReplaceWith("println(exception.stackTraceToString().prependIndent(\"#\"))"), + level = DeprecationLevel.WARNING, +) public fun printExceptionStackTrace(exception: Exception): Unit = println(exception.stackTraceToString().split("\n").joinToString("\n") { "#$it" }) public class SmokeTestsException(message: String) : Exception(message) + +/** + * An [Appendable] which can be used for printing test results to the console + */ +public val DefaultPrinter: Appendable = object : Appendable { + override fun append(c: Char) = this.also { print(c) } + override fun append(csq: CharSequence?) = this.also { print(csq) } + override fun append(csq: CharSequence?, start: Int, end: Int) = this.also { print(csq?.subSequence(start, end)) } +} diff --git a/settings.gradle.kts b/settings.gradle.kts index 4d9de3eae7..19d2caa85d 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -26,6 +26,7 @@ dependencyResolutionManagement { } } +// TODO This is largely shared with aws-sdk-kotlin, consider commonizing // Set up a sibling directory aws-crt-kotlin as a composite build, if it exists. // Allows overrides via local.properties: // compositeProjects=~/repos/aws-crt-kotlin,/tmp/some/other/thing,../../another/project @@ -45,7 +46,7 @@ val compositeProjectList = try { println("Adding composite build projects from local.properties: ${compositeProjectPaths.joinToString { it.name }}") } } -} catch (e: Throwable) { +} catch (_: Throwable) { logger.error("Could not load composite project paths from local.properties") listOf(file("../aws-crt-kotlin")) }