scala-cli
scala-cli copied to clipboard
Create resource directory on export and copy the files
Is your feature request related to a problem? Please describe.
I just found out that when I export the scala-cli app to sbt, it doesn't create resource directory. Instead, it creates a customResource link to the original directory used in the resourceDir directive.
Describe the solution you'd like
I would prefer an option to automatically copy the resources in the directory mentioned in resourceDir directive to src/main/resources, src/test/resources, and so on.
Additional context Here is a sample code:
//> using scala 3
//> using resourceDir "./input"
//> using option "-deprecation"
import scala.io.Source
object Hello {
def main(args: Array[String]): Unit = {
val inputs = Source.fromResource("input.log").getLines().map(_.toInt).toSeq
println(inputs)
}
}
export using the command scala-cli --power export WithRes.scala --sbt
This creates an sbt project with the build.sbt having the reference:
Compile / unmanagedResourceDirectories ++= Seq(file("/Users/yadu/temp/res/input"))
Expectation is to copy the content of the dir input into src/main/resource so that the whole project can be shared or committed easily. Now, after the export is done, I should copy the resource file manually before sharing it / committing it.
Automatically doing the copy would make it much easier to share the exported projects.