-
Notifications
You must be signed in to change notification settings - Fork 196
/
Copy pathbuild.gradle.kts
617 lines (555 loc) · 23.1 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
import aws.sdk.AwsServices
import aws.sdk.Membership
import aws.sdk.discoverServices
import aws.sdk.docsLandingPage
import aws.sdk.parseMembership
extra["displayName"] = "Smithy :: Rust :: AWS-SDK"
extra["moduleName"] = "software.amazon.smithy.rust.awssdk"
tasks["jar"].enabled = false
plugins {
java
id("software.amazon.smithy.gradle.smithy-base")
id("software.amazon.smithy.gradle.smithy-jar")
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
configure<software.amazon.smithy.gradle.SmithyExtension> {
smithyBuildConfigs = files(layout.buildDirectory.file("smithy-build.json"))
allowUnknownTraits = true
}
val smithyVersion: String by project
val properties = PropertyRetriever(rootProject, project)
val crateHasherToolPath = rootProject.projectDir.resolve("tools/ci-build/crate-hasher")
val publisherToolPath = rootProject.projectDir.resolve("tools/ci-build/publisher")
val sdkVersionerToolPath = rootProject.projectDir.resolve("tools/ci-build/sdk-versioner")
val awsConfigPath = rootProject.projectDir.resolve("aws/rust-runtime/aws-config")
val rustRuntimePath = rootProject.projectDir.resolve("rust-runtime")
val awsRustRuntimePath = rootProject.projectDir.resolve("aws/rust-runtime")
val awsSdkPath = rootProject.projectDir.resolve("aws/sdk")
val outputDir = layout.buildDirectory.dir("aws-sdk").get()
val sdkOutputDir = outputDir.dir("sdk")
val examplesOutputDir = outputDir.dir("examples")
val checkedInSdkLockfile = rootProject.projectDir.resolve("aws/sdk/Cargo.lock")
val generatedSdkLockfile = outputDir.file("Cargo.lock")
dependencies {
implementation(project(":aws:sdk-codegen"))
implementation("software.amazon.smithy:smithy-protocol-test-traits:$smithyVersion")
implementation("software.amazon.smithy:smithy-aws-traits:$smithyVersion")
implementation("software.amazon.smithy:smithy-aws-iam-traits:$smithyVersion")
implementation("software.amazon.smithy:smithy-aws-cloudformation-traits:$smithyVersion")
}
// Class and functions for service and protocol membership for SDK generation
val awsServices: AwsServices by lazy {
discoverServices(properties.get("aws.sdk.models.path"), loadServiceMembership())
}
val eventStreamAllowList: Set<String> by lazy { eventStreamAllowList() }
val crateVersioner by lazy { aws.sdk.CrateVersioner.defaultFor(rootProject, properties) }
fun getRustMSRV(): String = properties.get("rust.msrv") ?: throw Exception("Rust MSRV missing")
fun getPreviousReleaseVersionManifestPath(): String? = properties.get("aws.sdk.previous.release.versions.manifest")
fun getNullabilityCheckMode(): String = properties.get("nullability.check.mode") ?: "CLIENT_CAREFUL"
fun loadServiceMembership(): Membership {
val membershipOverride = properties.get("aws.services")?.let { parseMembership(it) }
println(membershipOverride)
val fullSdk =
parseMembership(properties.get("aws.services") ?: throw Exception("aws.services list missing"))
return membershipOverride ?: fullSdk
}
fun eventStreamAllowList(): Set<String> {
val list = properties.get("aws.services.eventstream.allowlist") ?: ""
return list.split(",").map { it.trim() }.toSet()
}
fun generateSmithyBuild(services: AwsServices): String {
val awsConfigVersion = properties.get(CrateSet.STABLE_VERSION_PROP_NAME)
?: throw IllegalStateException("missing ${CrateSet.STABLE_VERSION_PROP_NAME} for aws-config version")
val debugMode = properties.get("debugMode").toBoolean()
val serviceProjections = services.services.map { service ->
val files = service.modelFiles().map { extraFile ->
software.amazon.smithy.utils.StringUtils.escapeJavaString(
extraFile.absolutePath,
"",
)
}
val moduleName = "aws-sdk-${service.module}"
val eventStreamAllowListMembers = eventStreamAllowList.joinToString(", ") { "\"$it\"" }
val defaultConfigPath =
services.defaultConfigPath.let { software.amazon.smithy.utils.StringUtils.escapeJavaString(it, "") }
val partitionsConfigPath =
services.partitionsConfigPath.let { software.amazon.smithy.utils.StringUtils.escapeJavaString(it, "") }
val integrationTestPath = project.projectDir.resolve("integration-tests")
.let { software.amazon.smithy.utils.StringUtils.escapeJavaString(it, "") }
"""
"${service.module}": {
"imports": [${files.joinToString()}],
"plugins": {
"rust-client-codegen": {
"runtimeConfig": {
"relativePath": "../"
},
"codegen": {
"includeFluentClient": false,
"includeEndpointUrlConfig": false,
"renameErrors": false,
"debugMode": $debugMode,
"eventStreamAllowList": [$eventStreamAllowListMembers],
"enableUserConfigurableRuntimePlugins": false,
"nullabilityCheckMode": "${getNullabilityCheckMode()}"
},
"service": "${service.service}",
"module": "$moduleName",
"moduleVersion": "${crateVersioner.decideCrateVersion(moduleName, service)}",
"moduleAuthors": ["AWS Rust SDK Team <aws-sdk-rust@amazon.com>", "Russell Cohen <rcoh@amazon.com>"],
"moduleDescription": "${service.moduleDescription}",
${service.examplesUri(project)?.let { """"examples": "$it",""" } ?: ""}
"moduleRepository": "https://github.com/awslabs/aws-sdk-rust",
"license": "Apache-2.0",
"minimumSupportedRustVersion": "${getRustMSRV()}",
"customizationConfig": {
"awsSdk": {
"awsSdkBuild": true,
"awsConfigVersion": "$awsConfigVersion",
"defaultConfigPath": $defaultConfigPath,
"partitionsConfigPath": $partitionsConfigPath,
"integrationTestPath": $integrationTestPath
}
}
${service.extraConfig ?: ""}
}
}
}
""".trimIndent()
}
val projections = serviceProjections.joinToString(",\n")
return """
{
"version": "1.0",
"projections": { $projections }
}
"""
}
/**
* Task to generate smithyBuild.json dynamically
*/
tasks.register("generateSmithyBuild") {
description = "generate smithy-build.json"
inputs.property("servicelist", awsServices.services.toString())
inputs.property("eventStreamAllowList", eventStreamAllowList)
inputs.dir(projectDir.resolve("aws-models"))
outputs.file(layout.buildDirectory.file("smithy-build.json"))
doFirst {
layout.buildDirectory.file("smithy-build.json").get().asFile.writeText(generateSmithyBuild(awsServices))
}
// TODO(https://github.com/smithy-lang/smithy-rs/issues/3599)
outputs.upToDateWhen { false }
}
tasks.register("generateIndexMd") {
dependsOn("jar")
inputs.property("servicelist", awsServices.services.toString())
val indexMd = outputDir.file("index.md").asFile
outputs.file(indexMd)
doLast {
project.docsLandingPage(awsServices, indexMd)
}
}
tasks.register("relocateServices") {
description = "relocate AWS services to their final destination"
dependsOn("jar")
doLast {
awsServices.services.forEach {
logger.info("Relocating ${it.module}...")
copy {
from(layout.buildDirectory.dir("smithyprojections/sdk/${it.module}/rust-client-codegen"))
into(sdkOutputDir.dir(it.module))
}
copy {
from(projectDir.resolve("integration-tests/${it.module}/tests"))
into(sdkOutputDir.dir(it.module).dir("tests"))
}
copy {
from(projectDir.resolve("integration-tests/${it.module}/benches"))
into(sdkOutputDir.dir(it.module).dir("benches"))
}
}
}
inputs.dir(layout.buildDirectory.dir("smithyprojections/sdk"))
outputs.dir(sdkOutputDir)
}
tasks.register("relocateExamples") {
description = "relocate the examples folder & rewrite path dependencies"
dependsOn("jar")
doLast {
if (awsServices.examples.isNotEmpty()) {
copy {
from(projectDir)
awsServices.examples.forEach { example ->
include("$example/**")
}
into(outputDir)
exclude("**/target")
exclude("**/rust-toolchain.toml")
filter { line -> line.replace("build/aws-sdk/sdk/", "sdk/") }
}
}
}
if (awsServices.examples.isNotEmpty()) {
inputs.dir(projectDir.resolve("examples"))
}
outputs.dir(outputDir)
}
tasks.register("relocateTests") {
description = "relocate the root integration tests and rewrite path dependencies"
dependsOn("jar")
doLast {
if (awsServices.rootTests.isNotEmpty()) {
copy {
val testDir = projectDir.resolve("integration-tests")
from(testDir)
awsServices.rootTests.forEach { test ->
include(test.path.toRelativeString(testDir) + "/**")
}
into(outputDir.dir("tests"))
exclude("**/target")
filter { line -> line.replace("build/aws-sdk/sdk/", "sdk/") }
}
}
}
for (test in awsServices.rootTests) {
inputs.dir(test.path)
}
outputs.dir(outputDir)
}
tasks.register<ExecRustBuildTool>("fixExampleManifests") {
description = "Adds dependency path and corrects version number of examples after relocation"
enabled = awsServices.examples.isNotEmpty()
dependsOn("relocateExamples")
toolPath = sdkVersionerToolPath
binaryName = "sdk-versioner"
arguments = listOf(
"use-path-and-version-dependencies",
"--sdk-path", sdkOutputDir.asFile.absolutePath,
"--versions-toml", outputDir.file("versions.toml").asFile.absolutePath,
outputDir.dir("examples").asFile.absolutePath,
)
outputs.dir(outputDir)
dependsOn("relocateExamples", "generateVersionManifest")
}
/**
* The aws/rust-runtime crates depend on local versions of the Smithy core runtime enabling local compilation. However,
* those paths need to be replaced in the final build. We should probably fix this with some symlinking.
*/
fun rewritePathDependency(line: String): String {
// some runtime crates are actually dependent on the generated bindings:
return line.replace("../sdk/build/aws-sdk/sdk/", "")
// others use relative dependencies::
.replace("../../rust-runtime/", "")
}
tasks.register<Copy>("copyAllRuntimes") {
dependsOn("jar")
from("$rootDir/aws/rust-runtime") {
CrateSet.AWS_SDK_RUNTIME.forEach { include("${it.name}/**") }
}
from("$rootDir/rust-runtime") {
CrateSet.AWS_SDK_SMITHY_RUNTIME.forEach { include("${it.name}/**") }
}
exclude("**/target")
exclude("**/Cargo.lock")
exclude("**/node_modules")
into(sdkOutputDir)
}
tasks.register("relocateAwsRuntime") {
dependsOn("copyAllRuntimes")
doLast {
// Patch the Cargo.toml files
CrateSet.AWS_SDK_RUNTIME.forEach { module ->
patchFile(sdkOutputDir.file("${module.name}/Cargo.toml").asFile) { line ->
rewriteRuntimeCrateVersion(
properties.get(module.versionPropertyName)!!,
line.let(::rewritePathDependency),
)
}
}
}
}
tasks.register("relocateRuntime") {
dependsOn("copyAllRuntimes")
doLast {
// Patch the Cargo.toml files
CrateSet.AWS_SDK_SMITHY_RUNTIME.forEach { module ->
patchFile(sdkOutputDir.file("${module.name}/Cargo.toml").asFile) { line ->
rewriteRuntimeCrateVersion(properties.get(module.versionPropertyName)!!, line)
}
}
}
}
tasks.register<Copy>("relocateChangelog") {
dependsOn("jar")
from("$rootDir/aws")
include("SDK_CHANGELOG.md")
into(outputDir)
rename("SDK_CHANGELOG.md", "CHANGELOG.md")
}
fun generateCargoWorkspace(services: AwsServices): String {
return """
|[workspace]
|resolver = "2"
|exclude = [${"\n"}${services.excludedFromWorkspace().joinToString(",\n") { "| \"$it\"" }}
|]
|members = [${"\n"}${services.includedInWorkspace().joinToString(",\n") { "| \"$it\"" }}
|]
""".trimMargin()
}
tasks.register("generateCargoWorkspace") {
description = "generate Cargo.toml workspace file"
doFirst {
outputDir.asFile.mkdirs()
outputDir.file("Cargo.toml").asFile.writeText(generateCargoWorkspace(awsServices))
rootProject.rootDir.resolve("clippy-root.toml").copyTo(outputDir.file("clippy.toml").asFile, overwrite = true)
}
inputs.property("servicelist", awsServices.moduleNames.toString())
if (awsServices.examples.isNotEmpty()) {
inputs.dir(projectDir.resolve("examples"))
}
for (test in awsServices.rootTests) {
inputs.dir(test.path)
}
outputs.file(outputDir.file("Cargo.toml"))
outputs.file(outputDir.file("clippy.toml"))
outputs.upToDateWhen { false }
}
tasks.register<ExecRustBuildTool>("fixManifests") {
description = "Run the publisher tool's `fix-manifests` sub-command on the generated services"
dependsOn("relocateServices")
dependsOn("relocateRuntime")
dependsOn("relocateAwsRuntime")
dependsOn("relocateExamples")
dependsOn("relocateTests")
inputs.dir(publisherToolPath)
outputs.dir(outputDir)
toolPath = publisherToolPath
binaryName = "publisher"
arguments = mutableListOf("fix-manifests", "--location", outputDir.asFile.absolutePath)
}
tasks.register<ExecRustBuildTool>("hydrateReadme") {
description = "Run the publisher tool's `hydrate-readme` sub-command to create the final AWS Rust SDK README file"
dependsOn("generateVersionManifest")
inputs.dir(publisherToolPath)
inputs.file(rootProject.projectDir.resolve("aws/SDK_README.md.hb"))
outputs.file(outputDir.file("README.md").asFile.absolutePath)
toolPath = publisherToolPath
binaryName = "publisher"
arguments = listOf(
"hydrate-readme",
"--versions-manifest", outputDir.file("versions.toml").toString(),
"--msrv", getRustMSRV(),
"--input", rootProject.projectDir.resolve("aws/SDK_README.md.hb").toString(),
"--output", outputDir.file("README.md").asFile.absolutePath,
)
}
tasks.register<RequireRustBuildTool>("requireCrateHasher") {
description = "Ensures the crate-hasher tool is available"
inputs.dir(crateHasherToolPath)
toolPath = crateHasherToolPath
}
tasks.register<ExecRustBuildTool>("generateVersionManifest") {
description = "Generate the SDK version.toml file"
dependsOn("requireCrateHasher")
dependsOn("fixManifests")
inputs.dir(publisherToolPath)
toolPath = publisherToolPath
binaryName = "publisher"
arguments = mutableListOf(
"generate-version-manifest",
"--input-location",
sdkOutputDir.asFile.absolutePath,
"--output-location",
outputDir.asFile.absolutePath,
"--smithy-build",
layout.buildDirectory.file("smithy-build.json").get().asFile.normalize().absolutePath,
"--examples-revision",
properties.get("aws.sdk.examples.revision") ?: "missing",
).apply {
getPreviousReleaseVersionManifestPath()?.let { manifestPath ->
add("--previous-release-versions")
add(manifestPath)
}
}
}
tasks["smithyBuild"].apply {
inputs.file(layout.buildDirectory.file("smithy-build.json"))
inputs.dir(projectDir.resolve("aws-models"))
dependsOn("generateSmithyBuild")
dependsOn("generateCargoWorkspace")
outputs.upToDateWhen { false }
}
tasks["assemble"].apply {
dependsOn(
"deleteSdk",
"jar",
"relocateServices",
"relocateRuntime",
"relocateAwsRuntime",
"relocateExamples",
"relocateTests",
"generateIndexMd",
"fixManifests",
"generateVersionManifest",
"fixExampleManifests",
"hydrateReadme",
"relocateChangelog",
)
finalizedBy("copyCheckedInSdkLockfile")
outputs.upToDateWhen { false }
}
tasks.register<Copy>("copyCheckedInSdkLockfile") {
description = "Copy the checked-in SDK lockfile to the build directory"
this.outputs.upToDateWhen { false }
from(checkedInSdkLockfile)
into(outputDir)
}
tasks.register<Copy>("replaceCheckedInSdkLockfile") {
description = "Replace the checked-in SDK lockfile by copying the one in the build directory back to `aws/sdk`"
dependsOn("copyCheckedInSdkLockfile")
dependsOn("downgradeAwsSdkLockfile")
this.outputs.upToDateWhen { false }
from(generatedSdkLockfile)
into(awsSdkPath)
}
project.registerCargoCommandsTasks(outputDir.asFile)
project.registerGenerateCargoConfigTomlTask(outputDir.asFile)
// The task name "test" is already registered by one of our plugins
tasks.register("sdkTest") {
description = "Run Cargo clippy/test/docs against the generated SDK."
dependsOn("assemble")
finalizedBy(Cargo.CLIPPY.toString, Cargo.TEST.toString, Cargo.DOCS.toString)
}
/**
* Generate tasks for pinning broken dependencies to bypass compatibility issues
*
* Some dependencies may have compatibility issues that prevent updating to the latest versions.
* In such cases, we pin these dependencies to the last known working versions.
*
* To update broken dependencies (maybe for CI/CD with the latest versions), run a task with the flag, e.g.,
* `./gradlew -Paws.sdk.force.update.broken.dependencies aws:sdk:cargoUpdateAllLockfiles`
*/
fun Project.registerDowngradeFor(
dir: File,
name: String,
): TaskProvider<Exec> {
return tasks.register<Exec>("downgrade${name}Lockfile") {
onlyIf {
properties["aws.sdk.force.update.broken.dependencies"] == null
}
executable = "sh" // noop to avoid execCommand == null
doLast {
//TODO(MSRV): remove idna and url pinned versions when ugrading MSRV to (or past) 1.81
val crateNameToLastKnownWorkingVersions =
mapOf("minicbor" to "0.24.2", "idna" to "0.5.0", "url" to "2.5.2")
crateNameToLastKnownWorkingVersions.forEach { (crate, version) ->
// doesn't matter even if the specified crate does not exist in the lockfile
exec {
workingDir(dir)
commandLine("sh", "-c", "cargo update $crate --precise $version || true")
}
}
}
}
}
val downgradeAwsConfigLockfile = registerDowngradeFor(awsConfigPath, "AwsConfig")
val downgradeAwsRuntimeLockfile = registerDowngradeFor(awsRustRuntimePath, "AwsRustRuntime")
val downgradeSmithyRuntimeLockfile = registerDowngradeFor(rustRuntimePath, "RustRuntime")
val downgradeAwsSdkLockfile = registerDowngradeFor(outputDir.asFile, "AwsSdk")
// Tasks for updating individual Cargo.lock files
fun Project.registerCargoUpdateFor(
dir: File,
name: String,
dependsOn: List<String> = emptyList(),
): TaskProvider<Exec> {
return tasks.register<Exec>("cargoUpdate${name}Lockfile") {
dependsOn(dependsOn)
workingDir(dir)
environment("RUSTFLAGS", "--cfg aws_sdk_unstable")
commandLine("cargo", "update")
finalizedBy("downgrade${name}Lockfile")
}
}
val cargoUpdateAwsConfigLockfile = registerCargoUpdateFor(awsConfigPath, "AwsConfig", listOf("assemble"))
val cargoUpdateAwsRuntimeLockfile = registerCargoUpdateFor(awsRustRuntimePath, "AwsRustRuntime")
val cargoUpdateSmithyRuntimeLockfile = registerCargoUpdateFor(rustRuntimePath, "RustRuntime")
/**
* Updates the lockfile located in the `aws/sdk` directory.
*
* Previously, we would run `cargo generate-lockfile` in the `aws-sdk-rust` repository and then copy the resulting
* `Cargo.lock` into the `smithy-rs` repository. This approach introduced a delay, as new dependencies added to runtime
* crates would not be reflected in the SDK lockfile until the runtime crates were released to the `aws-sdk-rust`
* repository.
*
* We now generate a lockfile directly in `aws/sdk/build/aws-sdk`, which suffices for our CI/CD purposes, as it covers
* the crate dependencies used by the SDK:
* - Smithy runtime crates and inlineables
* - Smithy codegen decorators
* - Aws runtime crates and inlineables
* - Aws SDK codegen decorators
* - Service customizations (as long as we have their models in `aws/sdk/aws-models`)
*/
val cargoUpdateAwsSdkLockfile = tasks.register<Exec>("cargoUpdateAwsSdkLockfile") {
dependsOn("assemble")
workingDir(outputDir)
environment("RUSTFLAGS", "--cfg aws_sdk_unstable")
commandLine("cargo", "update")
finalizedBy(
"downgradeAwsSdkLockfile",
"replaceCheckedInSdkLockfile",
)
}
tasks.register<Exec>("syncAwsSdkLockfile") {
description = """
Synchronize the SDK lockfile to ensure that it includes all dependencies specified in runtime lockfiles.
"""
dependsOn("assemble")
workingDir(outputDir)
environment("RUSTFLAGS", "--cfg aws_sdk_unstable")
// Using `cargo generate-lockfile` or `cargo update` is not suitable here, as they update dependencies to their
// latest versions. Instead, we need to preserve the existing dependencies in the SDK lockfile while incorporating
// new dependencies introduced by runtime crates. This can be achieved by running `cargo check` with the lockfile
// copied to the `aws/sdk/build/aws-sdk` directory.
commandLine("cargo", "check", "--all-features")
doLast {
// We avoid using `replaceCheckedInSdkLockfile` in favor of `copy` to prevent dependency on
// `downgradeAwsSdkLockfile`. Downgrading dependencies is unnecessary when synchronizing the SDK lockfile with
// runtime lockfiles.
copy {
from(generatedSdkLockfile)
into(awsSdkPath)
}
}
}
// Parent task to update all the Cargo.lock files
tasks.register("cargoUpdateAllLockfiles") {
description = """
Update Cargo.lock files for aws-config, aws/rust-runtime, rust-runtime, and the workspace created by the
assemble task.
"""
finalizedBy(
cargoUpdateAwsSdkLockfile,
cargoUpdateAwsConfigLockfile,
cargoUpdateAwsRuntimeLockfile,
cargoUpdateSmithyRuntimeLockfile,
)
}
tasks.register<Delete>("deleteSdk") {
delete(
fileTree(outputDir) {
// Delete files but keep directories so that terminals don't get messed up in local development
include("**/*.*")
},
)
}
tasks["clean"].dependsOn("deleteSdk")
tasks["clean"].doFirst {
delete(layout.buildDirectory.file("smithy-build.json"))
}