Skip to content

Commit 7987374

Browse files
authored
Fix registerGenerateCargoWorkspaceTask() to declare the output file. (#3954)
## Motivation and Context When I tried to build the main branch with `./gradlew assemble`, I got the following error. This commit fixes the problem. ``` FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':aws:sdk-adhoc-test:generateCargoWorkspace'. > java.io.FileNotFoundException: /home/deven/git/smithy-rs/aws/sdk-adhoc-test/build/smithyprojections/sdk-adhoc-test/Cargo.toml (No such file or directory) ``` ## Description Fixes `registerGenerateCargoWorkspaceTask()` to declare the output file correctly when creating the `Cargo.toml` file, so Gradle can track the dependencies properly. ## Testing Without this change, `./gradlew clean; ./gradlew assemble` failed every time. With this change, it works. ## Checklist ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._
1 parent 6cc3ed7 commit 7987374

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

buildSrc/src/main/kotlin/CodegenTestCommon.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,10 @@ fun Project.registerGenerateCargoWorkspaceTask(
271271
val properties = PropertyRetriever(rootProject, this)
272272
project.tasks.register("generateCargoWorkspace") {
273273
description = "generate Cargo.toml workspace file"
274+
val path = project.buildDir.resolve("$workingDirUnderBuildDir/Cargo.toml")
275+
outputs.file(path)
274276
doFirst {
275-
project.buildDir.resolve("$workingDirUnderBuildDir/Cargo.toml")
276-
.writeText(generateCargoWorkspace(pluginName, codegenTests(properties, allCodegenTests)))
277+
path.writeText(generateCargoWorkspace(pluginName, codegenTests(properties, allCodegenTests)))
277278
}
278279
}
279280
}

0 commit comments

Comments
 (0)