Closed majk-p closed 5 months ago
out of curiosity, what's the motivation for this change ?
out of curiosity, what's the motivation for this change ?
With the extensive use of smithy4s at $work, both my coworkers and myself we have noticed unexpected re-compilation of smithy sources. I'm not sure what caused it yet, I had no luck reproducing it with small projects, but it seems to happen in more complex sbt setups.
A way to debug when and what exactly triggers smithy4s code generation would be a very helpful tool to proceed with the investigation.
This PR introduces a change in Smithy4s sbt codegen plugin that would allow users to see what caused the codegen to re-execute. It is done by replacing
sbt.util.Tracked.inputChanged
with a similar implementation that keeps the entire codegen args serialized in cache, and when codegen needs to be rerun, plugin will print the diff of the values to debug log. The diff is calculated using munit-diff.When running
sbt
withset logLevel := Level.Debug
, user will notice a diff like this when codegen needs to rerun:PR Checklist (not all items are relevant to all PRs)