summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2018-01-12 21:27:41 -0800
committerLi Haoyi <haoyi.sg@gmail.com>2018-01-12 21:27:41 -0800
commitcde65b142ca4c356134350525775d631015799ee (patch)
treecb679755c916e4fad137b684bb86c74dee4ac716 /core/src
parent9cc010127b0b631c838db666200f293d0cf9ac37 (diff)
downloadmill-cde65b142ca4c356134350525775d631015799ee.tar.gz
mill-cde65b142ca4c356134350525775d631015799ee.tar.bz2
mill-cde65b142ca4c356134350525775d631015799ee.zip
Allow `Cross`-builds to themselves be `Module`s so you can nest stuff inside
Also properly propagate `mainClass` into `assembly`
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/scala/mill/define/Cross.scala9
1 files changed, 7 insertions, 2 deletions
diff --git a/core/src/main/scala/mill/define/Cross.scala b/core/src/main/scala/mill/define/Cross.scala
index e7d0d843..8e27c714 100644
--- a/core/src/main/scala/mill/define/Cross.scala
+++ b/core/src/main/scala/mill/define/Cross.scala
@@ -43,8 +43,8 @@ object Cross{
* }
*/
class Cross[T](cases: Any*)
- (implicit ci: Cross.Factory[T],
- val ctx: Module.Ctx){
+ (implicit ci: Cross.Factory[T],
+ ctx: Module.Ctx) extends mill.define.Module()(ctx) {
val items = for(c0 <- cases.toList) yield{
val c = c0 match{
@@ -52,10 +52,15 @@ class Cross[T](cases: Any*)
case v => Tuple1(v)
}
val crossValues = c.productIterator.toList.reverse
+ val relPath = ctx.segment match{
+ case Segment.Label(s) => ammonite.ops.empty / s
+ case Segment.Cross(vs) => ammonite.ops.empty / vs.map(_.toString)
+ }
val sub = ci.make(
c,
ctx.copy(
segments0 = ctx.segments0 ++ Seq(ctx.segment),
+ basePath = ctx.basePath / relPath,
segment = Segment.Cross(crossValues)
)
)