Strip the service/api/client suffix from sdkId (#546)

* Strip the service/api/client suffix from sdkId

See https://github.com/awslabs/smithy/pull/848

* Add Cargo.toml to SDK output dir
This commit is contained in:
Russell Cohen 2021-06-29 17:11:17 -07:00 committed by GitHub
parent 7d140b1e2e
commit 01906c591d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 3 deletions

View File

@ -121,7 +121,12 @@ fun discoverServices(allServices: Boolean): List<AwsService> {
null
} else {
val service = services[0]
val sdkId = service.expectTrait(ServiceTrait::class.java).sdkId.toLowerCase().replace(" ", "")
val sdkId = service.expectTrait(ServiceTrait::class.java).sdkId
.toLowerCase()
.replace(" ", "")
// TODO: the smithy models should not include the suffix "service"
.removeSuffix("service")
.removeSuffix("api")
val testFile = file.parentFile.resolve("$sdkId-tests.smithy")
val extras = if (testFile.exists()) {
logger.warn("Discovered protocol tests for ${file.name}")
@ -275,8 +280,10 @@ fun generateCargoWorkspace(services: List<AwsService>): String {
task("generateCargoWorkspace") {
description = "generate Cargo.toml workspace file"
doFirst {
sdkOutputDir.mkdirs()
sdkOutputDir.resolve("Cargo.toml").writeText(generateCargoWorkspace(awsServices.get()))
}
outputs.file(sdkOutputDir.resolve("Cargo.toml"))
}
task("finalizeSdk") {
@ -286,14 +293,14 @@ task("finalizeSdk") {
"relocateServices",
"relocateRuntime",
"relocateAwsRuntime",
"relocateExamples",
"generateCargoWorkspace"
"relocateExamples"
)
}
tasks["smithyBuildJar"].inputs.file(projectDir.resolve("smithy-build.json"))
tasks["smithyBuildJar"].inputs.dir(projectDir.resolve("aws-models"))
tasks["smithyBuildJar"].dependsOn("generateSmithyBuild")
tasks["smithyBuildJar"].dependsOn("generateCargoWorkspace")
tasks["assemble"].dependsOn("smithyBuildJar")
tasks["assemble"].finalizedBy("finalizeSdk")