summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2018-02-02 23:36:35 -0800
committerLi Haoyi <haoyi.sg@gmail.com>2018-02-02 23:36:35 -0800
commit4c76e9668ab9683dad1966bcd6fb5031a81f8460 (patch)
tree333a31b9f5dc247f94ea7011b108502a0fb1bdf1 /core/src
parent932bc5c53bb380930e04765ae51c5a128f3b35fb (diff)
downloadmill-4c76e9668ab9683dad1966bcd6fb5031a81f8460.tar.gz
mill-4c76e9668ab9683dad1966bcd6fb5031a81f8460.tar.bz2
mill-4c76e9668ab9683dad1966bcd6fb5031a81f8460.zip
- Renamed `Ctx.FooCtx` => `Ctx.Foo`
- Remove un-used `Evaluator#millSourcePath` parameter
Diffstat (limited to 'core/src')
-rw-r--r--core/src/mill/eval/Evaluator.scala6
-rw-r--r--core/src/mill/main/ReplApplyHandler.scala3
-rw-r--r--core/src/mill/main/RunScript.scala2
-rw-r--r--core/src/mill/modules/Jvm.scala6
-rw-r--r--core/src/mill/modules/Util.scala6
-rw-r--r--core/src/mill/util/Ctx.scala29
6 files changed, 18 insertions, 34 deletions
diff --git a/core/src/mill/eval/Evaluator.scala b/core/src/mill/eval/Evaluator.scala
index 4028588b..78317474 100644
--- a/core/src/mill/eval/Evaluator.scala
+++ b/core/src/mill/eval/Evaluator.scala
@@ -25,7 +25,6 @@ case class Labelled[T](task: NamedTask[T],
}
}
class Evaluator[T](val outPath: Path,
- val millSourcePath: Path,
val externalOutPath: Path,
val rootModule: mill.Module,
val discover: Discover[T],
@@ -119,7 +118,6 @@ class Evaluator[T](val outPath: Path,
group,
results,
inputsHash,
- groupBasePath = None,
paths = None,
maybeTargetLabel = None,
counterMsg = counterMsg
@@ -131,7 +129,6 @@ class Evaluator[T](val outPath: Path,
labelledNamedTask.segments
)
- val groupBasePath = millSourcePath / Evaluator.makeSegmentStrings(labelledNamedTask.segments)
mkdir(paths.out)
val cached = for{
json <- scala.util.Try(upickle.json.read(read(paths.meta))).toOption
@@ -166,7 +163,6 @@ class Evaluator[T](val outPath: Path,
group,
results,
inputsHash,
- groupBasePath = Some(groupBasePath),
paths = Some(paths),
maybeTargetLabel = Some(msgParts.mkString),
counterMsg = counterMsg
@@ -206,7 +202,6 @@ class Evaluator[T](val outPath: Path,
def evaluateGroup(group: Agg[Task[_]],
results: collection.Map[Task[_], Result[(Any, Int)]],
inputsHash: Int,
- groupBasePath: Option[Path],
paths: Option[Evaluator.Paths],
maybeTargetLabel: Option[String],
counterMsg: String) = {
@@ -263,7 +258,6 @@ class Evaluator[T](val outPath: Path,
throw new Exception("No `dest` folder available here")
}
},
- groupBasePath.orNull,
multiLogger
)
diff --git a/core/src/mill/main/ReplApplyHandler.scala b/core/src/mill/main/ReplApplyHandler.scala
index 67ff8498..bea68d94 100644
--- a/core/src/mill/main/ReplApplyHandler.scala
+++ b/core/src/mill/main/ReplApplyHandler.scala
@@ -15,10 +15,9 @@ object ReplApplyHandler{
discover: Discover[_]) = {
new ReplApplyHandler(
pprinter0,
- new mill.eval.Evaluator(
+ new Evaluator(
ammonite.ops.pwd,
ammonite.ops.pwd / 'out,
- ammonite.ops.pwd / 'out,
rootModule,
discover,
new mill.util.PrintLogger(
diff --git a/core/src/mill/main/RunScript.scala b/core/src/mill/main/RunScript.scala
index dfe49c57..a38baedd 100644
--- a/core/src/mill/main/RunScript.scala
+++ b/core/src/mill/main/RunScript.scala
@@ -42,7 +42,7 @@ object RunScript{
val eval =
for((mapping, discover) <- evaluateMapping(wd, path, interp))
yield new Evaluator[Any](
- wd / 'out, wd / 'out, wd, mapping, discover, log,
+ wd / 'out, wd, mapping, discover, log,
mapping.getClass.getClassLoader.asInstanceOf[SpecialClassLoader].classpathSignature
)
diff --git a/core/src/mill/modules/Jvm.scala b/core/src/mill/modules/Jvm.scala
index a22f0c77..4ac03a97 100644
--- a/core/src/mill/modules/Jvm.scala
+++ b/core/src/mill/modules/Jvm.scala
@@ -10,7 +10,7 @@ import ammonite.ops._
import mill.define.Task
import mill.eval.PathRef
import mill.util.{Ctx, Loose}
-import mill.util.Ctx.LogCtx
+import mill.util.Ctx.Log
import mill.util.Loose.Agg
import upickle.default.{Reader, Writer}
@@ -161,7 +161,7 @@ object Jvm {
}
def createJar(inputPaths: Agg[Path], mainClass: Option[String] = None)
- (implicit ctx: Ctx.DestCtx): PathRef = {
+ (implicit ctx: Ctx.Dest): PathRef = {
val outputPath = ctx.dest / "out.jar"
rm(outputPath)
@@ -198,7 +198,7 @@ object Jvm {
def createAssembly(inputPaths: Agg[Path],
mainClass: Option[String] = None,
prependShellScript: String = "")
- (implicit ctx: Ctx.DestCtx): PathRef = {
+ (implicit ctx: Ctx.Dest): PathRef = {
val outputPath = ctx.dest / "out.jar"
rm(outputPath)
diff --git a/core/src/mill/modules/Util.scala b/core/src/mill/modules/Util.scala
index ce1203cf..cef11859 100644
--- a/core/src/mill/modules/Util.scala
+++ b/core/src/mill/modules/Util.scala
@@ -6,7 +6,7 @@ import mill.eval.PathRef
import mill.util.Ctx
object Util {
- def download(url: String, dest: RelPath = "download")(implicit ctx: Ctx.DestCtx) = {
+ def download(url: String, dest: RelPath = "download")(implicit ctx: Ctx.Dest) = {
val out = ctx.dest / dest
val website = new java.net.URI(url).toURL
@@ -25,7 +25,7 @@ object Util {
}
def downloadUnpackZip(url: String, dest: RelPath = "unpacked")
- (implicit ctx: Ctx.DestCtx) = {
+ (implicit ctx: Ctx.Dest) = {
val tmpName = if (dest == empty / "tmp.zip") "tmp2.zip" else "tmp.zip"
val downloaded = download(url, tmpName)
@@ -33,7 +33,7 @@ object Util {
}
def unpackZip(src: Path, dest: RelPath = "unpacked")
- (implicit ctx: Ctx.DestCtx) = {
+ (implicit ctx: Ctx.Dest) = {
val byteStream = read.getInputStream(src)
val zipStream = new java.util.zip.ZipInputStream(byteStream)
diff --git a/core/src/mill/util/Ctx.scala b/core/src/mill/util/Ctx.scala
index fb5384ef..55cc05ab 100644
--- a/core/src/mill/util/Ctx.scala
+++ b/core/src/mill/util/Ctx.scala
@@ -2,7 +2,6 @@ package mill.util
import ammonite.ops.Path
import mill.define.Applicative.ImplicitStub
-import mill.util.Ctx.{ArgCtx, BaseCtx, DestCtx, LogCtx}
import scala.annotation.compileTimeOnly
import scala.language.implicitConversions
@@ -12,37 +11,29 @@ object Ctx{
@ImplicitStub
implicit def taskCtx: Ctx = ???
- object DestCtx {
- implicit def pathToCtx(path: Path): DestCtx = new DestCtx { def dest = path }
+ object Dest {
+ implicit def pathToCtx(path: Path): Dest = new Dest { def dest = path }
}
- trait DestCtx{
+ trait Dest{
def dest: Path
}
- trait BaseCtx{
- def base: Path
- }
- object BaseCtx {
- implicit def pathToCtx(path: Path): BaseCtx = new BaseCtx { def base = path }
- }
- trait LogCtx{
+ trait Log{
def log: Logger
}
- object LogCtx{
- implicit def logToCtx(l: Logger): LogCtx = new LogCtx { def log = l }
+ object Log{
+ implicit def logToCtx(l: Logger): Log = new Log { def log = l }
}
- trait ArgCtx{
+ trait Args{
def args: IndexedSeq[_]
}
}
class Ctx(val args: IndexedSeq[_],
dest0: () => Path,
- val base: Path,
val log: Logger)
- extends DestCtx
- with LogCtx
- with ArgCtx
- with BaseCtx{
+ extends Ctx.Dest
+ with Ctx.Log
+ with Ctx.Args{
def dest = dest0()
def length = args.length