diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2017-12-04 10:17:25 -0800 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2017-12-04 10:17:25 -0800 |
commit | a9ed3b67cc1d0b0a755159013b28766f436e866a (patch) | |
tree | 443b7c785359905983640499df724f75a53aee10 /core/src | |
parent | 7238d7340744a5eda74acb6970c2cbf7bedea0e7 (diff) | |
download | mill-a9ed3b67cc1d0b0a755159013b28766f436e866a.tar.gz mill-a9ed3b67cc1d0b0a755159013b28766f436e866a.tar.bz2 mill-a9ed3b67cc1d0b0a755159013b28766f436e866a.zip |
Flesh out `bridges` pre-compilation in Mill build, getting the cross-minor-version `AcyclicTests` running using the `mill` test runner
Fixed `Discovered` to only pick up public `Target`s, which makes it skip things like the `super$compile` of an overriden `compile` target.
Split up `sources` and `allSources`
TBD how to properly switch the `compilerBridgeJar` between the different output paths of SBT's compile-dir and Mill's compile-dir, and eventually to a maven-central artifact too
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/main/scala/mill/Main.scala | 19 | ||||
-rw-r--r-- | core/src/main/scala/mill/discover/Discovered.scala | 3 | ||||
-rw-r--r-- | core/src/main/scala/mill/discover/Mirror.scala | 9 |
3 files changed, 17 insertions, 14 deletions
diff --git a/core/src/main/scala/mill/Main.scala b/core/src/main/scala/mill/Main.scala index 1dbae4c3..db7a6c1a 100644 --- a/core/src/main/scala/mill/Main.scala +++ b/core/src/main/scala/mill/Main.scala @@ -26,14 +26,7 @@ object Main { query.parse(input) } - def renderSelector(selector: List[Mirror.Segment]) = { - val Mirror.Segment.Label(head) :: rest = selector - val stringSegments = rest.map{ - case Mirror.Segment.Label(s) => "." + s - case Mirror.Segment.Cross(vs) => "[" + vs.mkString(",") + "]" - } - head + stringSegments.mkString - } + def parseArgs(selectorString: String): Either[String, List[Mirror.Segment]] = { import fastparse.all.Parsed @@ -81,7 +74,7 @@ object Main { def command = invokeCommand(hierarchy, last) command orElse target orElse runDefault.headOption.flatten match{ - case None => Left("Cannot resolve task " + renderSelector( + case None => Left("Cannot resolve task " + Mirror.renderSelector( (Mirror.Segment.Label(last) :: revSelectorsSoFar).reverse) ) case Some(either) => either @@ -96,7 +89,7 @@ object Main { case (label, child) if label == singleLabel => child } match{ case Some(child) => resolve(tail, child, obj, rest, remainingCrossSelectors, newRevSelectorsSoFar) - case None => Left("Cannot resolve module " + renderSelector(newRevSelectorsSoFar.reverse)) + case None => Left("Cannot resolve module " + Mirror.renderSelector(newRevSelectorsSoFar.reverse)) } case Mirror.Segment.Cross(cross) => @@ -105,7 +98,7 @@ object Main { if (crossOptions.contains(cross)){ resolve(tail, childMirror, obj, rest, remainingCrossSelectors, newRevSelectorsSoFar) }else{ - Left("Cannot resolve cross " + renderSelector(newRevSelectorsSoFar.reverse)) + Left("Cannot resolve cross " + Mirror.renderSelector(newRevSelectorsSoFar.reverse)) } @@ -119,7 +112,7 @@ object Main { val discovered = implicitly[Discovered[T]] val consistencyErrors = Discovered.consistencyCheck(obj, discovered) if (consistencyErrors.nonEmpty) { - Left(s"Failed Discovered.consistencyCheck: $consistencyErrors") + Left(s"Failed Discovered.consistencyCheck: ${consistencyErrors.map(Mirror.renderSelector)}") } else { Right(discovered) } @@ -138,7 +131,7 @@ object Main { (for((k, fs) <- evaluated.failing.items()) yield { val ks = k match{ case Left(t) => t.toString - case Right(t) => renderSelector(t.segments.toList) + case Right(t) => Mirror.renderSelector(t.segments.toList) } val fss = fs.map{ case Result.Exception(t) => t.toString diff --git a/core/src/main/scala/mill/discover/Discovered.scala b/core/src/main/scala/mill/discover/Discovered.scala index aef5f14f..753ac141 100644 --- a/core/src/main/scala/mill/discover/Discovered.scala +++ b/core/src/main/scala/mill/discover/Discovered.scala @@ -47,7 +47,8 @@ object Discovered { if m.isMethod && m.typeSignature.paramLists.isEmpty && m.typeSignature.resultType <:< c.weakTypeOf[Target[_]] && - !m.name.toString.contains(' ') + !m.name.toString.contains(' ') && + m.isPublic } yield { val x = Ident(TermName(c.freshName())) val t = q"""mill.discover.Mirror.makeTargetPoint( diff --git a/core/src/main/scala/mill/discover/Mirror.scala b/core/src/main/scala/mill/discover/Mirror.scala index 4dfeaa25..6293e599 100644 --- a/core/src/main/scala/mill/discover/Mirror.scala +++ b/core/src/main/scala/mill/discover/Mirror.scala @@ -25,6 +25,15 @@ case class Mirror[-T, V](node: (T, List[List[Any]]) => V, } object Mirror{ + def renderSelector(selector: Seq[Mirror.Segment]) = { + val Mirror.Segment.Label(head) :: rest = selector.toList + val stringSegments = rest.map{ + case Mirror.Segment.Label(s) => "." + s + case Mirror.Segment.Cross(vs) => "[" + vs.mkString(",") + "]" + } + head + stringSegments.mkString + } + sealed trait Segment object Segment{ case class Label(value: String) extends Segment |