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

chore: upgrade smithy to 1.13 #520

Merged
merged 4 commits into from
Nov 2, 2021
Merged
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
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ktorVersion=1.6.3
atomicFuVersion=0.16.1

# codegen
smithyVersion=1.9.1
smithyVersion=1.13.0
smithyGradleVersion=0.5.3

# testing/utility
Expand Down
2 changes: 2 additions & 0 deletions smithy-kotlin-codegen/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ val generateSdkRuntimeVersion by tasks.registering {
// this keeps us from having to manually change version numbers in multiple places
val resourcesDir = "$buildDir/resources/main/software/amazon/smithy/kotlin/codegen/core"
val versionFile = file("$resourcesDir/sdk-version.txt")
val gradlePropertiesFile = rootProject.file("gradle.properties")
inputs.file(gradlePropertiesFile)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question

This is to determine build dirty-ness or something else?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. When we upgrade the version the generated version is not changing because it is already generated. This generally seems to only affect local development because CI is a fresh build. The fix is to clean and rebuild (or manually delete the file).

outputs.file(versionFile)
sourceSets.main.get().output.dir(resourcesDir)
doLast {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,19 @@ class CodegenVisitor(context: PluginContext) : ShapeVisitor.Default<Unit>() {
.toList()

LOGGER.info("Preprocessing model")
// Model pre-processing:
// 1. Start with the model from the plugin context
// 2. Apply integrations
// 3. Flatten error shapes (see: https://github.com/awslabs/smithy/pull/919)
// 4. Normalize the operations
var resolvedModel = context.model
for (integration in integrations) {
resolvedModel = integration.preprocessModel(resolvedModel, settings)
}

resolvedModel = ModelTransformer.create()
.copyServiceErrorsToOperations(resolvedModel, settings.getService(resolvedModel))

// normalize operations
model = OperationNormalizer.transform(resolvedModel, settings.service)

Expand Down