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

unmanagedResourceDirectories not available to sbt-scalafix #2137

Closed
taig opened this issue Dec 8, 2024 · 3 comments
Closed

unmanagedResourceDirectories not available to sbt-scalafix #2137

taig opened this issue Dec 8, 2024 · 3 comments

Comments

@taig
Copy link

taig commented Dec 8, 2024

I'm supplying resources in sbt via Compile / unmanagedResourceDirectories. A library then consumes these resources during compile time. That does unfortunately break sbt-scalafix, because it apparently doesn't know about the unmanagedResourceDirectories.

I tried to make unmanagedResourceDirectories available to sbt-scalafix by using different scopes and configurations, but couldn't find a working setup.

A simple reproducer can be found here: https://github.com/taig/sbt-scalafix-unmanaged-resource-directories

@taig
Copy link
Author

taig commented Dec 9, 2024

Explicitly copying the resources fixes the problem:

(Compile / compile) := ((Compile / compile) dependsOn (Compile / copyResources)).value

rolang/dumbo#86 (comment)

@bjaglin bjaglin added the sbt label Dec 23, 2024
@bjaglin
Copy link
Collaborator

bjaglin commented Dec 24, 2024

Thanks for the report @taig !

From what I can see, compile is equally impacted as sbt "run; clean; compile" also fails on https://github.com/taig/sbt-scalafix-unmanaged-resource-directories. Besides, forcing resources to be copied ahead of compile as suggested above does fix both compile and scalafix, so I am not sure how this problem is related to sbt-scalafix or how sbt-scalafix could be changed to fix it?

@taig
Copy link
Author

taig commented Dec 24, 2024

Thanks for digging through this, @bjaglin. While reproducing this issue, I somehow missed that compile is also "affected". But of course it actually makes sense that sbt only provides the resources during run, as they are generally intended to be used during run time, not build time. So the behavior of scalafix is just as correct (-:

@taig taig closed this as completed Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants