Support `-` to exclude targets from wildcard selection (RFC)
Selecting many targets with wildcard and the braces syntax is very convenient, but if there is need to exclude some targets from the expansion, one needs to enumerate all targets separately (or find clever smaller selection pattern).
As a dual of + to select multiple targets (e.g. mill foo.compile + bar.compile) it would be convenient if we could also support a - to de-select some targets, e.g. to match all compile targets, but not bar.compile we could then write: mill __.compile - bar.compile.
Sounds like a great idea. Seems like we're gradually growing our own version of the Bazel Query syntax 😛 https://docs.bazel.build/versions/main/query-how-to.html
A small update. I started to experiment with it more than once, but this one isn't as easy as the + selector. The issue is, that in case there are wildcards involved, the wildcards are only resolved after we processed the +. To properly handle a -, we need to process it after we resolved all wildcards to tasks and their args. This means, we also handle resolution of commands specially, as they currently can only be resolved if their args are valid, which is probably not what we want if we want to exclude some. (E.g. an command on ten modules which requires tree parameters, but we want to exclude it for two modules.)
With https://github.com/com-lihaoyi/mill/pull/2997, we are now able to select / deselect by module type, so the initially given fictive example
> mill __.compile - bar.compile
could be now achieved with
bash> mill __:^bar.compile
I think, this is good enough, and we can close this issue after #2997 is merged.