-
- Downloads
Refactor `Instantiator` (#1863)
The `Instantiator` is a rather old part of the codebase that has been accumulating a bit of technical debt. This commit refactors `Instantiator.kt`. * Removes dependency on `CodegenTarget`; the instantiator is now client and server agnostic. `ClientInstantiator` and `ServerInstantiator` instantiate the underlying instantiator with the settings needed by each project. * The test suite has been completely rewritten to make use of the newer testing infrastructure (`TestWorkspace.testProject()`), and coverage around enum generation has been improved. * `Instantiator.Ctx` and its uses have been simplified. * The modified code has been reformatted to adhere to our styling conventions. This commit also renames `StructureGenerator.fallibleBuilder` to `StructureGenerator.hasFallibleBuilder`. This commit also changes usages of `RustWriter::write` to `RustWriter::rust` in `ServerProtocolTestGenerator`, where applicable. All in all this commit will make the diff of #1342 lighter, where deviations among clients and servers regarding structure instantiation substantially increase.
Showing
- codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/ClientInstantiator.kt 25 additions, 0 deletions...st/codegen/client/smithy/generators/ClientInstantiator.kt
- codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/ProtocolTestGenerator.kt 2 additions, 5 deletions...lient/smithy/generators/protocol/ProtocolTestGenerator.kt
- codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/HttpBoundProtocolGenerator.kt 1 addition, 1 deletion...gen/client/smithy/protocols/HttpBoundProtocolGenerator.kt
- codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/ClientInstantiatorTest.kt 87 additions, 0 deletions...odegen/client/smithy/generators/ClientInstantiatorTest.kt
- codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/BuilderGenerator.kt 1 addition, 1 deletion...y/rust/codegen/core/smithy/generators/BuilderGenerator.kt
- codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/Instantiator.kt 76 additions, 84 deletions...mithy/rust/codegen/core/smithy/generators/Instantiator.kt
- codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/StructureGenerator.kt 1 addition, 1 deletion...rust/codegen/core/smithy/generators/StructureGenerator.kt
- codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/JsonParserGenerator.kt 1 addition, 1 deletion...odegen/core/smithy/protocols/parse/JsonParserGenerator.kt
- codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/XmlBindingTraitParserGenerator.kt 1 addition, 1 deletion.../smithy/protocols/parse/XmlBindingTraitParserGenerator.kt
- codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/testutil/TestHelpers.kt 6 additions, 1 deletion...e/amazon/smithy/rust/codegen/core/testutil/TestHelpers.kt
- codegen-core/src/test/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/InstantiatorTest.kt 122 additions, 184 deletions...y/rust/codegen/core/smithy/generators/InstantiatorTest.kt
- codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerInstantiator.kt 34 additions, 0 deletions...st/codegen/server/smithy/generators/ServerInstantiator.kt
- codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/protocol/ServerProtocolTestGenerator.kt 14 additions, 22 deletions...smithy/generators/protocol/ServerProtocolTestGenerator.kt
- codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/ServerHttpBoundProtocolGenerator.kt 1 addition, 1 deletion...rver/smithy/protocols/ServerHttpBoundProtocolGenerator.kt
- codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/testutil/ServerTestHelpers.kt 1 addition, 2 deletions.../rust/codegen/server/smithy/testutil/ServerTestHelpers.kt
- codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerInstantiatorTest.kt 221 additions, 0 deletions...odegen/server/smithy/generators/ServerInstantiatorTest.kt
Loading
Please register or sign in to comment