Any way to evaluate a cached task programmatically? #6104
-
|
Hello! Currently I'm developing a play-like live reloading plugin, which allows you to run application and then replace a classloader in runtime with updated code when source files change. I've implemented a task, which watches for filesystem changes and calls My task looks like this: trait LiveReloadModule extends JavaModule:
def liveReloadRun(args: Task[Args] = Task.Anon(Args())): Command[Unit] = Task.Command {
// ...
val reloadTrigger = () => {
val result = compile()
result.classes
}
Jvm.withClassLoader(
classPath = runClasspath().map(_.path).toVector
) { classloader =>
// start live-reloaded application, which triggers `reloadTrigger` when necessary
// to compile changes and update the underlying classloader
// ... blocking until some condition
}
}How to do it correctly? I guess I need something like this to be possible: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
If you want to dynamically trigger task evaluation at runtime, the best way is probably to take an evaluator in your command and use that https://mill-build.org/mill/fundamentals/bundled-libraries.html#_evaluator_experimental |
Beta Was this translation helpful? Give feedback.
If you want to dynamically trigger task evaluation at runtime, the best way is probably to take an evaluator in your command and use that https://mill-build.org/mill/fundamentals/bundled-libraries.html#_evaluator_experimental