Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete files generated from deleted templates? #16

Open
aruediger opened this issue Jul 21, 2015 · 9 comments
Open

Delete files generated from deleted templates? #16

aruediger opened this issue Jul 21, 2015 · 9 comments

Comments

@aruediger
Copy link

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
Copy link
Member

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

@aruediger
Copy link
Author

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
Copy link
Member

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

@aruediger
Copy link
Author

👍 Thx @jrudolph!

@jrudolph
Copy link
Member

jrudolph commented Mar 1, 2016

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
Copy link
Author

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
Copy link
Author

related: sbt/sbt-xjc#15 (comment)

@jrudolph
Copy link
Member

jrudolph commented Mar 1, 2016

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

@jrudolph jrudolph reopened this Mar 1, 2016
@aruediger
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants