-
The concrete setting: I have two modules, one compiler and one runtime of sorts. I want to test the runtime on some compiled programs. For this I want to have a Task that compiles the test programs from the resource directory before running the tests. So in the runtime module I have the following: def hvmTestFiles = Task.Source(millSourcePath / "resources" / "hvm")
def allHvmTestFiles = T {
os.walk(hvmTestFiles().path).filter(_.ext == "hvm")
} Now I want to have another task than calls the compiler on all the test programs. My first thought was the following: def compileHvmFiles = T {
val files = allHvmTestFiles()
files.map { file => compiler.run(Task.Anon(Args(Seq("--hvm-input", file.toString, "--output-dir", Task.dest.toString))))() }
} This gives an error though as the input argument for the command was generated within the Task itself.:
The only way I see to circumvent this is to not use the compiler's |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Have you seen the options presented on this page? https://mill-build.org/mill/extending/running-jvm-code.html#_running_a_scalamodule_in_a_subprocess I'm not sure if I understand your use case correctly, but it seems to me that it should be satisfied by the linked examples |
Beta Was this translation helpful? Give feedback.
-
Thanks, with that I was able to make it work: def compileHvmFiles = T {
val files = allHvmTestFiles()
files.foreach { file => compiler.runner().run(Map("--hvm-input" -> file, "--output-dir" -> Task.dest)) }
T.dest
} Though I still don't quite get the error I was getting before with |
Beta Was this translation helpful? Give feedback.
Have you seen the options presented on this page?
https://mill-build.org/mill/extending/running-jvm-code.html#_running_a_scalamodule_in_a_subprocess
I'm not sure if I understand your use case correctly, but it seems to me that it should be satisfied by the linked examples