-
-
Notifications
You must be signed in to change notification settings - Fork 366
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
Enforce that Task.Sources
cannot have upstream task dependencies
#4121
Comments
So how do I add new source dirs (that should be watched) to an inherited sources task then? object Common {
def sources = Task.Sources(millSourcePath / "src" )
}
object foo extends Common {
def sources = Task.Sources {
super.sources() ++ Seq(PathRef(millSourcePath / "src-foo"))
}
} |
Something like this: object Common {
def sources = Task.Sources(millSourcePath / "src" )
}
object foo extends Common {
def newSources = Task.sources(millSourcePath / "src-foo")
def sources = Task { super.sources() ++ newSources() }
} A bit more verbose than the current setup, but not too bad |
That's really inconvenient. Since this change is only motivated by the implementation impact, maybe we can restrict the |
We may be able to make it easier. The fundamental thing here is I want to get rid of the def sources = Task.Sources(super.sources().paths ++ Seq(millSourcePath / "src-foo")) |
I think the whole logic behind dynamic calculation of the source dirs, e.g. Otherwise, users start to switch to use |
The dynamism required for those can still be done with the API above I think. They just require Not sure if there are other use cases that do require task-results to do their computation, but at least those discussed here do not. I'd like to remove the ability of Overall these issues we'll need to sort out during implementation to see if it hits any blockers, but at least for now it still seems feasible |
I'm not convinced crippling Should we really compromise some well working existing capabilities for the sake of a seldomly used complex use case, which could be easily worked around by other means? |
I think there are two possible ways forward:
We don't need to come to a decision yet, just things to think about in the run up to 0.13.0 |
Giving the user the choice to use a more powerful but maybe less performant solution, I think there should be an easy way to add static paths (aka overriding a |
One interesting place I found where we have a source -> source dependency is in mill/scalalib/src/mill/scalalib/JavaModule.scala Lines 54 to 58 in a117b62
|
I think changing the user facing API to always accept |
This would simplify the data model considerably, make things easier to reason about internally, and avoid common mistakes (e.g. #4120). e.g. for watch-and-rerun or selective execution, it would mean we can just inspect the hashes of the input tasks in isolation, rather than running through an entire evaluation workflow to get their values
I wanted to do this a while back, but in the past the fact that
T
andT.sources
were different types meant that you had to overrideT.sources
withT.sources
, so sources needed to support depending on tasks to allow the common override-and-add workflow. Now, we can simply overrideTask.Sources
withTask
, so we no longer needTask.Sources
to support upstream task dependenciesThis is a breaking change and would need to wait for 0.13.0
The text was updated successfully, but these errors were encountered: