-
-
Notifications
You must be signed in to change notification settings - Fork 390
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Document and test workflow for aliasing external modules (#3760)
Fixes #299 I'm a bit surprised that this just works, but it does! The module's `millSourcePath` and `out/` folder path remain at their original locations as the `mill.define.Ctx` is still provided by the top-level `ExternalModule` constructor, it's just during resolution the added method `def` allows it to get picked up during object graph traversal
- Loading branch information
Showing
3 changed files
with
32 additions
and
0 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
27 changes: 27 additions & 0 deletions
27
example/fundamentals/modules/10-external-module-aliases/build.mill
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Mill allows you to alias external modules via `def`. You can use this to add | ||
// shorthand aliases for external modules that have long names, such as | ||
// `mill.javalib.palantirformat.PalantirFormatModule` below: | ||
|
||
package build | ||
import mill._, javalib._ | ||
|
||
object foo extends JavaModule | ||
|
||
def myAutoformat = mill.javalib.palantirformat.PalantirFormatModule | ||
|
||
/** Usage | ||
|
||
> cat src/foo/Foo.java # starts off unformatted | ||
package foo;public class Foo{ public static void main(String[] args) {System.out.println("Hello World!");}} | ||
|
||
> mill myAutoformat # easier to type than `./mill mill.javalib.palantirformat.PalantirFormatModule/` | ||
|
||
> cat src/foo/Foo.java # code is now formatted | ||
package foo; | ||
public class Foo { | ||
public static void main(String[] args) { | ||
System.out.println("Hello World!"); | ||
} | ||
} | ||
|
||
*/ |
1 change: 1 addition & 0 deletions
1
example/fundamentals/modules/10-external-module-aliases/foo/src/foo/Foo.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package foo;public class Foo{ public static void main(String[] args) {System.out.println("Hello World!");}} |