-
-
Notifications
You must be signed in to change notification settings - Fork 382
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: RootModule and Cross can be applied to the same module (#4593)
Implements #3693 These seem to be the minimal changes to allow RootModule and Cross to be applied to the same module. it was only necessary to make `Cross` a trait. I did try making `RootModule` also a trait but it proved a little trickier due to it usign the class constructor for `BaseModule` that it extends. The main issue I ran into that caused me to have to remove the implicit parameter on `Cross` was the Ctx implicit was not being filled in properly and i was seeing `Modules and Tasks can only be defined within a mill Module` from the dummy being used. There may have been a way around this in the `CrossMacros`, but I couldn't see it, and this solution appears to work, at least for the examples shown in the integration tests added.
- Loading branch information
1 parent
1be196b
commit fb7ad6d
Showing
6 changed files
with
73 additions
and
34 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
10 changes: 10 additions & 0 deletions
10
integration/feature/root-cross-module/resources/bar/package.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,10 @@ | ||
package build.bar | ||
|
||
import mill._ | ||
import scalalib._ | ||
|
||
object `package` extends RootModule with Cross[FooModule]("3.6.2", "2.13.16") {} | ||
|
||
trait FooModule extends CrossScalaModule { | ||
def foo = Task { true } | ||
} |
12 changes: 12 additions & 0 deletions
12
integration/feature/root-cross-module/resources/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,12 @@ | ||
package build | ||
import $packages._ | ||
|
||
import mill._, scalalib._ | ||
|
||
object `package` extends RootModule with Cross[FooModule]("3.6.2", "2.13.16") { | ||
object baz extends Cross[FooModule]("3.6.2", "2.13.16") {} | ||
} | ||
|
||
trait FooModule extends CrossScalaModule { | ||
def foo = Task { true } | ||
} |
27 changes: 27 additions & 0 deletions
27
integration/feature/root-cross-module/src/RootCrossModuleTests.scala
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 @@ | ||
package mill.integration | ||
|
||
import mill.testkit.UtestIntegrationTestSuite | ||
|
||
import utest._ | ||
|
||
object RootCrossModuleTests extends UtestIntegrationTestSuite { | ||
val tests: Tests = Tests { | ||
test("root") - integrationTest { | ||
tester => | ||
import tester._ | ||
assert(eval("[2.13.16].foo").isSuccess) | ||
} | ||
|
||
test("module") - integrationTest { | ||
tester => | ||
import tester._ | ||
assert(eval("baz[2.13.16].foo").isSuccess) | ||
} | ||
|
||
test("subpackage") - integrationTest { | ||
tester => | ||
import tester._ | ||
assert(eval("bar[2.13.16].foo").isSuccess) | ||
} | ||
} | ||
} |