xsbt-filter icon indicating copy to clipboard operation
xsbt-filter copied to clipboard

Possible problem with triggeredBy method used to perform resources filtering

Open savulchik opened this issue 10 years ago • 6 comments

Hello, @sdb . Please, see the discussion in the following issue sbt/sbt/issues/1187 regarding triggeredBy method usage. Especially this comment. Thank you.

savulchik avatar Apr 08 '14 16:04 savulchik

Hi, I'll look into this issue this weekend and see if we can find a solution to avoid this super dangerous behavior.

I'll contact the sbt developers on this.

Thanks for the report.

sdb avatar Apr 08 '14 18:04 sdb

I managed to reproduce the described problem with race condition in https://github.com/savulchik/xsbt-filter/tree/filterbug by adding Thread.sleep to filterResources task and running new check-jar task in simple test project.

savulchik avatar Apr 09 '14 15:04 savulchik

Hello, @sdb . I'll try to fix the issue and submit a pull request.

savulchik avatar May 06 '14 04:05 savulchik

Eventually I solved my problem with race condition during build using resource generator having default hook in sbt build cycle http://www.scala-sbt.org/0.13.5/docs/Howto/generatefiles.html#resources.

@sdb I couldn't find a solution for the plugin due to lack of sbt experience

savulchik avatar Jun 03 '14 04:06 savulchik

I suspect that this is responsible for the fact that publishM2 and release (from sbt-release) tasks will create jars where the resources are unfiltered. Unfortunately sbt/sbt#1187 doesn't explain how to correct the behavior. Any guidance anyone has for those tasks will be helpful.

christophercurrie avatar Jan 17 '15 04:01 christophercurrie

Following up, it turns out my issues were related to the overlap between this project and sbt-osgi, which looks directly at resourceDirectories in Compile to find the resources to store in the bundle. In order for this project to be compatible, it would need to register the task as a resource generator, and somehow suppress the use of the unmanaged resources.

christophercurrie avatar Jan 18 '15 02:01 christophercurrie