diff options
-rw-r--r-- | docs/pages/1 - Intro to Mill.md | 5 | ||||
-rw-r--r-- | main/src/mill/main/MainModule.scala | 7 | ||||
-rw-r--r-- | main/src/mill/main/Resolve.scala | 13 |
3 files changed, 21 insertions, 4 deletions
diff --git a/docs/pages/1 - Intro to Mill.md b/docs/pages/1 - Intro to Mill.md index b879dd05..bf9ed926 100644 --- a/docs/pages/1 - Intro to Mill.md +++ b/docs/pages/1 - Intro to Mill.md @@ -66,6 +66,11 @@ $ mill foo.jar # bundle the classfiles into a jar $ mill foo.assembly # bundle classfiles and all dependencies into a jar ``` +You can run `mill resolve __` to see a full list of the different tasks that are +available, `mill resolve foo._` to see the tasks within `foo`, `mill describe +foo.compile` to see what an individual task depends on, or `mill show +foo.scalaVersion` to inspect the output of any task. + The most common **tasks** that Mill can run are cached **targets**, such as `compile`, and un-cached **commands** such as `foo.run`. Targets do not re-evaluate unless one of their inputs changes, where-as commands re-run every diff --git a/main/src/mill/main/MainModule.scala b/main/src/mill/main/MainModule.scala index b1068c29..ea4b2cb2 100644 --- a/main/src/mill/main/MainModule.scala +++ b/main/src/mill/main/MainModule.scala @@ -35,9 +35,14 @@ trait MainModule extends mill.Module{ val resolved = RunScript.resolveTasks( mill.main.ResolveMetadata, evaluator, targets, multiSelect = true ) + resolved match{ case Left(err) => Result.Failure(err) - case Right(r) => Result.Success(r.foreach(println)) + case Right(rs) => + for(r <- rs){ + println(r) + } + Result.Success(()) } } diff --git a/main/src/mill/main/Resolve.scala b/main/src/mill/main/Resolve.scala index 95fff5f1..992484bc 100644 --- a/main/src/mill/main/Resolve.scala +++ b/main/src/mill/main/Resolve.scala @@ -24,7 +24,6 @@ object ResolveMetadata extends Resolve[String]{ if (isRootModule) ep._2.name else obj + "." + ep._2.name } - modules ++ targets ++ commands } def endResolve(obj: Module, @@ -35,8 +34,15 @@ object ResolveMetadata extends Resolve[String]{ val direct = singleModuleMeta(obj, discover, revSelectorsSoFar.isEmpty) if (last == "__") { - Right(direct.toList ++ obj.millInternal.modules.flatMap(singleModuleMeta(_, discover, false))) - } else if (last == "_") Right(direct.toList) + Right( + // Filter out our own module in + obj.millInternal.modules + .filter(_ != obj) + .flatMap(m => singleModuleMeta(m, discover, m != obj)) + .toList + ) + } + else if (last == "_") Right(direct.toList) else direct.find(_.split('.').last == last) match{ case None => Left( @@ -47,6 +53,7 @@ object ResolveMetadata extends Resolve[String]{ } } } + object Resolve extends Resolve[NamedTask[Any]]{ def endResolve(obj: Module, revSelectorsSoFar: List[Segment], |