sbt-boilerplate
sbt-boilerplate copied to clipboard
Delete files generated from deleted templates?
This is rather a question: Should the plugin delete files generated from deleted templates? It currently overwrites files whose templates got updated.
Or is an explicit clean
required here? How do other plugins behave in that regard?
Background: I often get compile errors after switching branches because of leftover generated files which became invalid. Is a clean
recommended after switching branches in general?
Thanks!
Thanks @2beaucoup, good point. That's something I stumble over regularly and forget that I would be the one to fix it...
Haha! What's the best practice here? Simply wiping src_managed
doesn't work as there could be other plugins putting files there. And detecting boilerplate artifacts doesn't work as there are no "markers" in there.
Mmh, really would like to know the standard behaviour. Maybe there is no way around clean
here.
I think there are these possible solutions:
- special file names for the generated files
- read all files in the output directory and look out for a marker
- put the generated files into a dedicated output directory
:+1: Thx @jrudolph!
Let's see how well it works... If there are other source generators it may be slow scanning through all files but may be good enough for most of the simple cases.
The pattern in maven is that generated files are written to target/generated-sources/[generator-id]
so that every generator gets its own folder. Would be a lot easier to maintain generated artifacts that way. Dunno if that would be idiomatic for sbt, though.
related: https://github.com/sbt/sbt-xjc/issues/15#issuecomment-138522283
Thanks for digging this up, @2beaucoup. Let's reopen this to reconsider it for the next release.
Thx! And sorry for chiming in a bit late here.