Loading aws/sdk-codegen-test/build.gradle.kts +0 −3 Original line number Diff line number Diff line Loading @@ -41,9 +41,6 @@ fun generateSmithyBuild(tests: List<CodegenTest>): String { "module": "${it.module}", "moduleAuthors": ["protocoltest@example.com"], "moduleVersion": "0.0.1", "build": { "rootProject": true } ${it.extraConfig ?: ""} } } Loading aws/sdk/build.gradle.kts +1 −4 Original line number Diff line number Diff line Loading @@ -73,10 +73,7 @@ fun generateSmithyBuild(tests: List<AwsService>): String { "module": "aws-sdk-${it.module}", "moduleVersion": "0.0.5-alpha", "moduleAuthors": ["AWS Rust SDK Team <aws-sdk-rust@amazon.com>", "Russell Cohen <rcoh@amazon.com>"], "license": "Apache-2.0", "build": { "rootProject": true } "license": "Apache-2.0" ${it.extraConfig ?: ""} } } Loading codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/RustSettings.kt +2 −46 Original line number Diff line number Diff line Loading @@ -7,7 +7,6 @@ package software.amazon.smithy.rust.codegen.smithy import software.amazon.smithy.codegen.core.CodegenException import software.amazon.smithy.model.Model import software.amazon.smithy.model.knowledge.ServiceIndex import software.amazon.smithy.model.node.ObjectNode import software.amazon.smithy.model.node.StringNode import software.amazon.smithy.model.shapes.ServiceShape Loading Loading @@ -54,7 +53,6 @@ class RustSettings( val moduleAuthors: List<String>, val runtimeConfig: RuntimeConfig, val codegenConfig: CodegenConfig, val build: BuildSettings, val license: String?, private val model: Model ) { Loading Loading @@ -105,7 +103,6 @@ class RustSettings( val moduleName = config.expectStringMember(MODULE_NAME).value val version = config.expectStringMember(MODULE_VERSION).value val build = config.getObjectMember(BUILD_SETTINGS) val runtimeConfig = config.getObjectMember(RUNTIME_CONFIG) val codegenSettings = config.getObjectMember(CODEGEN_SETTINGS) val moduleAuthors = config.expectArrayMember(MODULE_AUTHORS).map { it.expectStringNode().value } Loading @@ -117,9 +114,8 @@ class RustSettings( moduleAuthors = moduleAuthors, runtimeConfig = RuntimeConfig.fromNode(runtimeConfig), codegenConfig = CodegenConfig.fromNode(codegenSettings), build = BuildSettings.fromNode(build), model = model, license = license license = license, model = model ) } Loading Loading @@ -151,44 +147,4 @@ class RustSettings( } } } /** * Resolves the highest priority protocol from a service shape that is * supported by the generator. * * @param serviceIndex Service index containing the support * @param service Service to get the protocols from if "protocols" is not set. * @param supportedProtocolTraits The set of protocol traits supported by the generator. * @return Returns the resolved protocol name. * @throws UnresolvableProtocolException if no protocol could be resolved. */ fun resolveServiceProtocol( serviceIndex: ServiceIndex, service: ServiceShape, supportedProtocolTraits: Set<ShapeId> ): ShapeId { val resolvedProtocols: Set<ShapeId> = serviceIndex.getProtocols(service).keys val protocol = resolvedProtocols.firstOrNull(supportedProtocolTraits::contains) return protocol ?: throw UnresolvableProtocolException( "The ${service.id} service supports the following unsupported protocols $resolvedProtocols. " + "The following protocol generators were found on the class path: $supportedProtocolTraits" ) } } data class BuildSettings(val rootProject: Boolean = false) { companion object { private const val ROOT_PROJECT = "rootProject" fun fromNode(node: Optional<ObjectNode>): BuildSettings { return if (node.isPresent) { BuildSettings(node.get().getMember(BuildSettings.ROOT_PROJECT).get().asBooleanNode().get().value) } else { Default() } } fun Default(): BuildSettings = BuildSettings(false) } } class UnresolvableProtocolException(message: String) : CodegenException(message) codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/testutil/Rust.kt +3 −5 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ import software.amazon.smithy.rust.codegen.rustlang.RustDependency import software.amazon.smithy.rust.codegen.rustlang.RustWriter import software.amazon.smithy.rust.codegen.rustlang.raw import software.amazon.smithy.rust.codegen.rustlang.rustBlock import software.amazon.smithy.rust.codegen.smithy.BuildSettings import software.amazon.smithy.rust.codegen.smithy.CodegenConfig import software.amazon.smithy.rust.codegen.smithy.DefaultPublicModules import software.amazon.smithy.rust.codegen.smithy.RuntimeCrateLocation Loading Loading @@ -164,12 +163,11 @@ fun TestWriterDelegator.compileAndTest() { ShapeId.from("fake#Fake"), "test_${baseDir.toFile().nameWithoutExtension}", "0.0.1", moduleAuthors = listOf("test@module.com"), runtimeConfig = TestRuntimeConfig, codegenConfig = CodegenConfig(), build = BuildSettings.Default(), model = stubModel, moduleAuthors = listOf("test@module.com"), license = null license = null, model = stubModel ), libRsCustomizations = listOf(), ) Loading Loading
aws/sdk-codegen-test/build.gradle.kts +0 −3 Original line number Diff line number Diff line Loading @@ -41,9 +41,6 @@ fun generateSmithyBuild(tests: List<CodegenTest>): String { "module": "${it.module}", "moduleAuthors": ["protocoltest@example.com"], "moduleVersion": "0.0.1", "build": { "rootProject": true } ${it.extraConfig ?: ""} } } Loading
aws/sdk/build.gradle.kts +1 −4 Original line number Diff line number Diff line Loading @@ -73,10 +73,7 @@ fun generateSmithyBuild(tests: List<AwsService>): String { "module": "aws-sdk-${it.module}", "moduleVersion": "0.0.5-alpha", "moduleAuthors": ["AWS Rust SDK Team <aws-sdk-rust@amazon.com>", "Russell Cohen <rcoh@amazon.com>"], "license": "Apache-2.0", "build": { "rootProject": true } "license": "Apache-2.0" ${it.extraConfig ?: ""} } } Loading
codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/RustSettings.kt +2 −46 Original line number Diff line number Diff line Loading @@ -7,7 +7,6 @@ package software.amazon.smithy.rust.codegen.smithy import software.amazon.smithy.codegen.core.CodegenException import software.amazon.smithy.model.Model import software.amazon.smithy.model.knowledge.ServiceIndex import software.amazon.smithy.model.node.ObjectNode import software.amazon.smithy.model.node.StringNode import software.amazon.smithy.model.shapes.ServiceShape Loading Loading @@ -54,7 +53,6 @@ class RustSettings( val moduleAuthors: List<String>, val runtimeConfig: RuntimeConfig, val codegenConfig: CodegenConfig, val build: BuildSettings, val license: String?, private val model: Model ) { Loading Loading @@ -105,7 +103,6 @@ class RustSettings( val moduleName = config.expectStringMember(MODULE_NAME).value val version = config.expectStringMember(MODULE_VERSION).value val build = config.getObjectMember(BUILD_SETTINGS) val runtimeConfig = config.getObjectMember(RUNTIME_CONFIG) val codegenSettings = config.getObjectMember(CODEGEN_SETTINGS) val moduleAuthors = config.expectArrayMember(MODULE_AUTHORS).map { it.expectStringNode().value } Loading @@ -117,9 +114,8 @@ class RustSettings( moduleAuthors = moduleAuthors, runtimeConfig = RuntimeConfig.fromNode(runtimeConfig), codegenConfig = CodegenConfig.fromNode(codegenSettings), build = BuildSettings.fromNode(build), model = model, license = license license = license, model = model ) } Loading Loading @@ -151,44 +147,4 @@ class RustSettings( } } } /** * Resolves the highest priority protocol from a service shape that is * supported by the generator. * * @param serviceIndex Service index containing the support * @param service Service to get the protocols from if "protocols" is not set. * @param supportedProtocolTraits The set of protocol traits supported by the generator. * @return Returns the resolved protocol name. * @throws UnresolvableProtocolException if no protocol could be resolved. */ fun resolveServiceProtocol( serviceIndex: ServiceIndex, service: ServiceShape, supportedProtocolTraits: Set<ShapeId> ): ShapeId { val resolvedProtocols: Set<ShapeId> = serviceIndex.getProtocols(service).keys val protocol = resolvedProtocols.firstOrNull(supportedProtocolTraits::contains) return protocol ?: throw UnresolvableProtocolException( "The ${service.id} service supports the following unsupported protocols $resolvedProtocols. " + "The following protocol generators were found on the class path: $supportedProtocolTraits" ) } } data class BuildSettings(val rootProject: Boolean = false) { companion object { private const val ROOT_PROJECT = "rootProject" fun fromNode(node: Optional<ObjectNode>): BuildSettings { return if (node.isPresent) { BuildSettings(node.get().getMember(BuildSettings.ROOT_PROJECT).get().asBooleanNode().get().value) } else { Default() } } fun Default(): BuildSettings = BuildSettings(false) } } class UnresolvableProtocolException(message: String) : CodegenException(message)
codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/testutil/Rust.kt +3 −5 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ import software.amazon.smithy.rust.codegen.rustlang.RustDependency import software.amazon.smithy.rust.codegen.rustlang.RustWriter import software.amazon.smithy.rust.codegen.rustlang.raw import software.amazon.smithy.rust.codegen.rustlang.rustBlock import software.amazon.smithy.rust.codegen.smithy.BuildSettings import software.amazon.smithy.rust.codegen.smithy.CodegenConfig import software.amazon.smithy.rust.codegen.smithy.DefaultPublicModules import software.amazon.smithy.rust.codegen.smithy.RuntimeCrateLocation Loading Loading @@ -164,12 +163,11 @@ fun TestWriterDelegator.compileAndTest() { ShapeId.from("fake#Fake"), "test_${baseDir.toFile().nameWithoutExtension}", "0.0.1", moduleAuthors = listOf("test@module.com"), runtimeConfig = TestRuntimeConfig, codegenConfig = CodegenConfig(), build = BuildSettings.Default(), model = stubModel, moduleAuthors = listOf("test@module.com"), license = null license = null, model = stubModel ), libRsCustomizations = listOf(), ) Loading