Unverified Commit c901c0b1 authored by ysaito1001's avatar ysaito1001 Committed by GitHub
Browse files

Exclude examples from the workspace (#2535)

This commit automates the fix made in https://github.com/awslabs/aws-sdk-rust/pull/767

.
When `aws-sdk-rust` is generated, `examples` will be excluded from the
workspace.

Co-authored-by: default avatarYuki Saito <awsaito@amazon.com>
parent 724ada84
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -5,7 +5,6 @@

import aws.sdk.AwsServices
import aws.sdk.Membership
import aws.sdk.RootTest
import aws.sdk.discoverServices
import aws.sdk.docsLandingPage
import aws.sdk.parseMembership
@@ -302,9 +301,9 @@ tasks.register<Copy>("relocateChangelog") {
fun generateCargoWorkspace(services: AwsServices): String {
    return """
    |[workspace]
    |exclude = [${"\n"}${services.rootTests.map(RootTest::manifestName).joinToString(",\n") { "|    \"$it\"" }}
    |exclude = [${"\n"}${services.excludedFromWorkspace().joinToString(",\n") { "|    \"$it\"" }}
    |]
    |members = [${"\n"}${services.allModules.joinToString(",\n") { "|    \"$it\"" }}
    |members = [${"\n"}${services.includedInWorkspace().joinToString(",\n") { "|    \"$it\"" }}
    |]
    """.trimMargin()
}
+13 −3
Original line number Diff line number Diff line
@@ -36,10 +36,10 @@ class AwsServices(
        (
            services.map(AwsService::module).map { "sdk/$it" } +
                CrateSet.AWS_SDK_SMITHY_RUNTIME.map { "sdk/$it" } +
                CrateSet.AWS_SDK_RUNTIME.map { "sdk/$it" } +
                examples
                CrateSet.AWS_SDK_RUNTIME.map { "sdk/$it" }
            // Root tests should not be included since they can't be part of the root Cargo workspace
            // in order to test differences in Cargo features.
            // in order to test differences in Cargo features. Examples should not be included either
            // because each example itself is a workspace.
            ).toSortedSet()
    }

@@ -78,6 +78,16 @@ class AwsServices(
                false
            }
        }

    /**
     * Returns a sorted set of members included in the workspace.
     */
    fun includedInWorkspace() = allModules

    /**
     * Returns a list of crates excluded from the workspace.
     */
    fun excludedFromWorkspace() = examples + rootTests.map(RootTest::manifestName)
}

/**