Skip to content

Commit c484b2d

Browse files
committed
Fix Gradle task to properly detect Smithy model changes
The generateSmithyBuild task was not correctly declaring Smithy model files as inputs, causing it to not regenerate when models changed. This fixes the path resolution and adds an existence check for the input files.
1 parent 4ac79e6 commit c484b2d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

buildSrc/src/main/kotlin/CodegenTestCommon.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,13 @@ fun Project.registerGenerateSmithyBuildTask(
236236
this.tasks.register("generateSmithyBuild") {
237237
description = "generate smithy-build.json"
238238
outputs.file(project.projectDir.resolve("smithy-build.json"))
239-
// NOTE: This is not working.
240-
allCodegenTests.flatMap { it.imports }.forEach { inputs.file(project.projectDir.resolve(it)) }
239+
// Declare Smithy model files as inputs so task reruns when they change
240+
allCodegenTests.flatMap { it.imports }.forEach {
241+
val resolvedPath = project.projectDir.resolve(it)
242+
if (resolvedPath.exists()) {
243+
inputs.file(resolvedPath)
244+
}
245+
}
241246

242247
doFirst {
243248
project.projectDir.resolve("smithy-build.json")

0 commit comments

Comments
 (0)