Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support smithy-lang/smithy-kotlin as a composite build #1272

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ class S3OperationErrorHandler : KotlinIntegration {
namespace = "${ctx.settings.pkg.name}.internal"
}

writer.write("val payload = call.response.body.#T()", RuntimeTypes.Http.readAll)
.write("val wrappedResponse = call.response.#T(payload)", RuntimeTypes.AwsProtocolCore.withPayload)
writer.write("val wrappedResponse = call.response.#T(payload)", RuntimeTypes.AwsProtocolCore.withPayload)
.write("val wrappedCall = call.copy(response = wrappedResponse)")
.write("")
.write("val errorDetails = try {")
Expand Down Expand Up @@ -97,7 +96,7 @@ class S3OperationErrorHandler : KotlinIntegration {
name = "${errSymbol.name}Deserializer"
namespace = ctx.settings.pkg.serde
}
writer.write("#S -> #T().deserialize(context, wrappedCall)", err.name, errDeserializerSymbol)
writer.write("#S -> #T().deserialize(context, wrappedCall, payload)", err.name, errDeserializerSymbol)
}
write("else -> #T(errorDetails.message)", exceptionBaseSymbol)
}
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ coroutines-version = "1.7.3"
atomicfu-version = "0.23.1"

# smithy-kotlin codegen and runtime are versioned separately
smithy-kotlin-runtime-version = "1.1.1"
smithy-kotlin-codegen-version = "0.31.1"
smithy-kotlin-runtime-version = "1.1.3"
smithy-kotlin-codegen-version = "0.31.3"

# codegen
smithy-version = "1.45.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ChangeResourceRecordSetsUnmarshallingTest {

val exception = assertFailsWith<InvalidChangeBatch> {
runBlocking {
ChangeResourceRecordSetsOperationDeserializer().deserialize(ExecutionContext(), call)
ChangeResourceRecordSetsOperationDeserializer().deserialize(ExecutionContext(), call, bodyText.encodeToByteArray())
}
}
assertEquals(listOf<String>("InvalidChangeBatch message"), exception.messages)
Expand Down Expand Up @@ -70,7 +70,7 @@ class ChangeResourceRecordSetsUnmarshallingTest {

val exception = assertFailsWith<InvalidChangeBatch> {
runBlocking {
ChangeResourceRecordSetsOperationDeserializer().deserialize(ExecutionContext(), call)
ChangeResourceRecordSetsOperationDeserializer().deserialize(ExecutionContext(), call, bodyText.encodeToByteArray())
}
}
assertEquals(listOf<String>("InvalidChangeBatch message 1", "InvalidChangeBatch message 2"), exception.messages)
Expand Down Expand Up @@ -100,7 +100,7 @@ class ChangeResourceRecordSetsUnmarshallingTest {

val exception = assertFailsWith<InvalidChangeBatch> {
runBlocking {
ChangeResourceRecordSetsOperationDeserializer().deserialize(ExecutionContext(), call)
ChangeResourceRecordSetsOperationDeserializer().deserialize(ExecutionContext(), call, bodyText.encodeToByteArray())
}
}
assertEquals(listOf<String>("InvalidChangeBatch message 1", "InvalidChangeBatch message 2"), exception.messages)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class GetBucketLocationOperationDeserializerTest {
val call = HttpCall(HttpRequestBuilder().build(), response, Instant.now(), Instant.now())

val actual = runBlocking {
GetBucketLocationOperationDeserializer().deserialize(ExecutionContext(), call)
GetBucketLocationOperationDeserializer().deserialize(ExecutionContext(), call, responseXML.encodeToByteArray())
}

assertEquals(BucketLocationConstraint.UsWest2, actual.locationConstraint)
Expand All @@ -63,7 +63,7 @@ class GetBucketLocationOperationDeserializerTest {
val call = HttpCall(HttpRequestBuilder().build(), response, Instant.now(), Instant.now())
val exception = assertFailsWith<S3Exception> {
runBlocking {
GetBucketLocationOperationDeserializer().deserialize(ExecutionContext(), call)
GetBucketLocationOperationDeserializer().deserialize(ExecutionContext(), call, responseXML.encodeToByteArray())
}
}

Expand Down
4 changes: 2 additions & 2 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ file("services").listFiles().forEach {
val compositeProjectList = try {
val localProperties = java.util.Properties()
localProperties.load(File(rootProject.projectDir, "local.properties").inputStream())
val propertyVal = localProperties.getProperty("compositeProjects") ?: "../smithy-kotlin"
val propertyVal = localProperties.getProperty("compositeProjects") ?: "../smithy-kotlin,../../smithy-lang/smithy-kotlin"
val filePaths = propertyVal
.splitToSequence(",") // Split comma delimited string into sequence
.map { it.replaceFirst("^~".toRegex(), System.getProperty("user.home")) } // expand user dir
Expand All @@ -85,7 +85,7 @@ val compositeProjectList = try {
if (filePaths.isNotEmpty()) println("Adding ${filePaths.size} composite build directories from local.properties.")
filePaths
} catch (e: java.io.FileNotFoundException) {
listOf(file("../smithy-kotlin")) // Default path, not an error.
listOf(file("../smithy-kotlin"), file("../../smithy-lang/smithy-kotlin")) // Default path, not an error.
} catch (e: Throwable) {
logger.error("Failed to load project paths from local.properties. Assuming defaults.", e)
listOf(file("../smithy-kotlin"))
Expand Down
Loading