-
-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support type selectors in Resolve (#2997)
This PR add support for new selector pattern `_:Type`. In addition to `_` and `__`, which select arbitrary segments, the `_:MyType` and `__:MyType` patterns can select modules of the specified type. The type is matched by it's name and optionally by it's enclosing types and packages, separated by a `.` sign. Since this is also used to separate target path segments, a type selector segment containing a `.` needs to be enclosed in parenthesis. A full qualified type can be enforced with the `_root_` package. Example: Find all test jars ```sh > mill resolve __:TestModule.jar > mill resolve "(__:scalalib.TestModule).jar" > mill resolve "(__:mill.scalalib.TestModule).jar" > mill resolve "(__:_root_.mill.scalalib.TestModule).jar" ``` If a `^` or `!` is preceding the type pattern, it only matches segments not an instance of that specified type. Please note that in some shells like `bash`, you need to mask the `!` character. Example: Find all jars not in test modules ```sh > mill resolve __:^TestModule.jar ``` You can also provide more than one type pattern, separated with `:`. Example: Find all `JavaModule`s which are not `ScalaModule`s or `TestModule`s: ```sh > mill resolve "__:JavaModule:^ScalaModule:^TestModule.jar" ``` Remarks: * Kudos to @lihaoyi who refactored the resolver in #2511 and made this PR possible. I tried to implement it multiple times before, and ever got bitten by the old gnarly resolver code. * It's currently not possible to match task/target types. It might be possible, but due to `Task` being a parametrized type, it might not be as easy to implement and use. Fix #1550 Pull request: #2997
- Loading branch information
Showing
5 changed files
with
407 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.