sbt / sbt-boilerplate

sbt plugin for generating scala.Tuple/Function related boilerplate code
BSD 2-Clause "Simplified" License
109 stars 19 forks source link

Delete files generated from deleted templates? #16

Open aruediger opened 9 years ago

aruediger commented 9 years ago

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!

jrudolph commented 9 years ago

Thanks @2beaucoup, good point. That's something I stumble over regularly and forget that I would be the one to fix it...

aruediger commented 9 years ago

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.

jrudolph commented 8 years ago

I think there are these possible solutions:

aruediger commented 8 years ago

:+1: Thx @jrudolph!

jrudolph commented 8 years ago

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.

aruediger commented 8 years ago

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.

aruediger commented 8 years ago

related: https://github.com/sbt/sbt-xjc/issues/15#issuecomment-138522283

jrudolph commented 8 years ago

Thanks for digging this up, @2beaucoup. Let's reopen this to reconsider it for the next release.

aruediger commented 8 years ago

Thx! And sorry for chiming in a bit late here.