-
-
Notifications
You must be signed in to change notification settings - Fork 360
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
Watch mode on multiple commands should only run commands downstream of changed files (1000USD Bounty) #3534
Comments
I'll grab this, as this is a feature I directly need. |
@arturaz go for it. I just updated the PR description with some other ideas in how to implement this |
Possible Approaches:
|
@arturaz I think approach (3) above is the most promising (least edge cases) and easiest to implement (most localized change), so I would suggest try that first |
Could you elaborate more on the 3rd approach?
Where is that located? Are you referring to
How does it know that? |
Yes, mill/main/eval/src/mill/eval/EvaluatorCore.scala Lines 74 to 76 in c1f4793
The thing you probably care about most is
Currently,
Let me know if you have any other questions or things you are unsure about and I can help answer. The internals of the Evaluator are definitely a bit gnarly, but the steps I gave above should work, and I'm happy to help you get them working |
Do by "finding all input tasks" you mean
The
Finding upstream tasks seems that it would give me a
Are you talking about this code block? mill/main/eval/src/mill/eval/GroupEvaluator.scala Lines 80 to 125 in c1f4793
|
I mean
Take the
Yes that's the one! |
Am I right to assume There is this, but it's deprecated: @deprecated("Use mill.define.Target instead.", "Mill after 0.11.0-M8")
type Input[T] = Target[T] |
Thats right, you need to check if it an InputImpl |
Can you elaborate on what do you mean by "joining it"? And by "all the tasks" do you mean I can do something like this: terminals0
.flatMap(_.asLabeled)
.map(t => t -> calculateNamedTaskHashes(t.task, classToTransitiveClasses, allTransitiveClassMethods).sum) But then what should I do with the result? |
Looking up the signature of each task's method in that
|
I discovered a suspicious place. Here, it takes either the mill/main/eval/src/mill/eval/GroupEvaluator.scala Lines 171 to 175 in c1f4793
Where the
Is that intended? |
@arturaz I'm not sure, what's your issue with it? What do you find suspicious about those snippets? |
That one branch is using the inputs hash, whilst the other branch is using the value hash. These two seem unrelated to each other semantically? |
@arturaz good question haha, honestly I'm not sure. Does the blame show anything? Otherwise I suspect just looking things up using the input hash should be enough |
So it looks like we're taking the hash code in that snippet and returning it in I think what's happening is that workers and non-worker cached tasks are cached in different ways:
In theory we should be able to do the worker code path for non-workers as well, with one caveat: the worker logic is probably slightly incorrect, since we also should be including the |
I don't really get how the |
selective execution is enabled for -w by defauly without needing the selective.* commands |
Amazing, great to know |
From the maintainer Li Haoyi: I'm putting a 1000USD bounty on this issue, payable by bank transfer on a merged PR implementing this.
The goal of this is to make
-w
/--watch
only run tasks/commands that are downstream of changedTask.Source
files orTask.Input
, so that if you watch multiple commands (e.g.webserver.runBackground
andwebclient.deploy
), only the tasks relevant to a change get re-run.Background
I think my use case is a pretty common need. I'm developing in full-stack Scala: some JVM modules, some ScalaJS modules, and some shared dependencies of both. I want a fast feedback loop. When code in a JS or shared module changes, it needs to rebundle it, and when code in a JVM or shared module changes, it needs to recompile it and restart the server.
I don't need hot reload of the javascript code (that would be even better but let's get to first base first), but I do need to reload the page after rebundling JS or rebooting the server completes, but I'm accomplishing that outside of the build tool so let's ignore that aspect of things.
In my case, the target to bundle the JS and put it in the right place is
app_js.getScalaJs
, and restarting the backend is done withapp_lrbcol.runBackground
.I've been doing this with two separate Mill processes. tmuxp is useful for this; my config contained
However, at the moment Mill isn't designed for multiple processes like this (see e.g., #3454). #3519 may fix this, but I recently was reminded that Mill supports multiple parallel targets.
The issue
So I tried this command instead:
However this doesn't do what I want. If I make a change to ScalaJS code, even if it doesn't compile, it still causes
runBackground
to run.It would be better IMO if somehow watch mode could apply to each target independently, instead of what it seems to be doing, namely aggregating a single watch list of files and any of them cause the compound target to run.
The text was updated successfully, but these errors were encountered: