Skip to content

Commit

Permalink
Recursively return all the generated files
Browse files Browse the repository at this point in the history
  • Loading branch information
keynmol committed May 14, 2022
1 parent fb8f87a commit 14eb238
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion modules/codegen-plugin/src/smithy4s/codegen/CodegenPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,19 @@ object Smithy4sCodegenPlugin extends AutoPlugin {
m.root
}
val transforms = (conf / smithy4sModelTransformers).value
val log = streams.value.log

val fileChangesReport = (conf / smithy4sCodegen).inputFileChanges

if (fileChangesReport.hasChanges) {
log.debug("[Smithy4s] file changed, re-running codegen")

import fileChangesReport.*

val filePaths = modified ++ created ++ unmodified

log.debug(s"[Smithy4s] following files were used: $filePaths")

val codegenArgs = CodegenArgs(
filePaths.map(os.Path(_)).toList,
output = os.Path(outputPath),
Expand All @@ -172,6 +176,16 @@ object Smithy4sCodegenPlugin extends AutoPlugin {
.toList

resPaths.map(path => new File(path.toString))
} else (conf / smithy4sOutputDir).value.listFiles().toSeq
} else {
val base = (conf / smithy4sOutputDir).value

val allOutputFiles = (base ** "*").get()
log.debug(
s"[Smithy4s] no file changes, returning all output files: $allOutputFiles"
)

allOutputFiles

}
}
}

0 comments on commit 14eb238

Please sign in to comment.