From d4db2bee4f51f429a75e3061c0df484a505e0a0a Mon Sep 17 00:00:00 2001 From: Russell Cohen Date: Wed, 13 Dec 2023 16:11:33 -0500 Subject: [PATCH] Fix generation of `aws-config` related code in tests --- .../src/main/kotlin/software/amazon/smithy/rustsdk/AwsDocs.kt | 2 +- .../main/kotlin/software/amazon/smithy/rustsdk/SdkSettings.kt | 2 +- .../src/test/kotlin/software/amazon/smithy/rustsdk/TestUtil.kt | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsDocs.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsDocs.kt index 6263d54497d..80e0706ad44 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsDocs.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsDocs.kt @@ -19,7 +19,7 @@ object AwsDocs { * Also, STS and SSO must NOT reference `aws-config` since that would create a circular dependency. */ fun canRelyOnAwsConfig(codegenContext: ClientCodegenContext): Boolean = - SdkSettings.from(codegenContext.settings).awsConfigVersion != null && + SdkSettings.from(codegenContext.settings).generateReadme && !setOf( ShapeId.from("com.amazonaws.sso#SWBPortalService"), ShapeId.from("com.amazonaws.ssooidc#AWSSSOOIDCService"), diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SdkSettings.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SdkSettings.kt index e523c960ac3..ec5114be6b3 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SdkSettings.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SdkSettings.kt @@ -45,7 +45,7 @@ class SdkSettings private constructor(private val awsSdk: ObjectNode?) { /** Whether to generate a README */ val generateReadme: Boolean - get() = awsSdkBuild + get() = awsSdkBuild && !(awsSdk?.getBooleanMember("suppressReadme")?.orNull()?.value ?: false) val requireEndpointResolver: Boolean get() = awsSdkBuild diff --git a/aws/sdk-codegen/src/test/kotlin/software/amazon/smithy/rustsdk/TestUtil.kt b/aws/sdk-codegen/src/test/kotlin/software/amazon/smithy/rustsdk/TestUtil.kt index e6b61d6397e..3833045313e 100644 --- a/aws/sdk-codegen/src/test/kotlin/software/amazon/smithy/rustsdk/TestUtil.kt +++ b/aws/sdk-codegen/src/test/kotlin/software/amazon/smithy/rustsdk/TestUtil.kt @@ -56,6 +56,7 @@ fun awsIntegrationTestParams() = IntegrationTestParams( "awsSdk", ObjectNode.builder() .withMember("awsSdkBuild", true) + .withMember("suppressReadme", true) .withMember("integrationTestPath", "../sdk/integration-tests") .withMember("partitionsConfigPath", "../sdk/aws-models/sdk-endpoints.json") .withMember("awsConfigVersion", "1")