-
Notifications
You must be signed in to change notification settings - Fork 207
Description
Bloop should add support for file mapping of resource files (directories and single files) so they are available at custom 'jar' locations at runtime. Essentially be able to do something like make the file at src/main/resources/myfile.txt be available as a jar resource at /custompath/myfilerenamed.txt.
Rationale:
SBT and other Build Tools support this mapping of files to specific and arbitrary places into the jar. SBT does it using the "mapping" field; see https://www.scala-sbt.org/1.x/docs/Mapping-Files.html. If Bloop supported this, then the resources would be available in proper places during bloop run, bloop debug and bloop test.
Adding this functionality will make bloop more comprehensive and correct during bloop run/debug/test.
Suggested implementation:
- In the bloop project.json file schema, add a resourceMapping field that allows you map from source (file or dir) to a jar-relative location.
- Sbt-bloop should be able to read sbt's "mapping" field and put it into the project.json
- At bloop run/test/debug, bloop would probably need to copy the files into the classes directory. (But it should be able to use its change detection to see if the original file changed to reduce copying).
- But, it would only need to do the copy during run/test/debug (not necessarily , and probably ideally not, for every compile)
My main desire is for Bloop to handle single-file arbitrary mapping, which we currently rely on.
Note: This is kind of related to #1631.