summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2018-02-02 21:48:35 -0800
committerLi Haoyi <haoyi.sg@gmail.com>2018-02-02 21:48:35 -0800
commit80c8ad730132145fc33b790657b14669f282d5b0 (patch)
treefa9d39763756cc07a3e9524cf146186cb2979516
parent27273750636acbbff1b37cf53bba76684f0b96bb (diff)
downloadmill-80c8ad730132145fc33b790657b14669f282d5b0.tar.gz
mill-80c8ad730132145fc33b790657b14669f282d5b0.tar.bz2
mill-80c8ad730132145fc33b790657b14669f282d5b0.zip
- Rename `basePath` -> `millSourcePath`
- Make `T.worker`s not flush out their directories between instantiations
-rw-r--r--core/src/mill/define/Cross.scala2
-rw-r--r--core/src/mill/define/Ctx.scala2
-rw-r--r--core/src/mill/define/Module.scala12
-rw-r--r--core/src/mill/define/Task.scala2
-rw-r--r--core/src/mill/eval/Evaluator.scala34
-rw-r--r--core/src/mill/main/RunScript.scala2
-rw-r--r--core/test/resources/examples/javac/build.sc4
-rw-r--r--core/test/src/mill/define/BasePathTests.scala14
-rw-r--r--core/test/src/mill/eval/ModuleTests.scala2
-rw-r--r--core/test/src/mill/util/TestEvaluator.scala14
-rw-r--r--docs/cross.md2
-rw-r--r--docs/modules.md28
-rw-r--r--integration/test/resources/acyclic/build.sc2
-rw-r--r--integration/test/resources/ammonite/build.sc2
-rw-r--r--integration/test/resources/jawn/build.sc4
-rw-r--r--scalajslib/test/src/mill/scalajslib/HelloJSWorldTests.scala12
-rw-r--r--scalalib/src/mill/scalalib/GenIdea.scala2
-rw-r--r--scalalib/src/mill/scalalib/MiscModule.scala26
-rw-r--r--scalalib/src/mill/scalalib/ScalaModule.scala6
-rw-r--r--scalalib/test/src/mill/scalalib/GenIdeaTests.scala34
-rw-r--r--scalalib/test/src/mill/scalalib/HelloWorldTests.scala24
-rw-r--r--scalaworker/src/mill/scalaworker/ScalaWorker.scala1
22 files changed, 119 insertions, 112 deletions
diff --git a/core/src/mill/define/Cross.scala b/core/src/mill/define/Cross.scala
index b51064be..aa730e0d 100644
--- a/core/src/mill/define/Cross.scala
+++ b/core/src/mill/define/Cross.scala
@@ -61,7 +61,7 @@ class Cross[T](cases: Any*)
c,
ctx.copy(
segments = ctx.segments ++ Seq(ctx.segment),
- basePath = ctx.basePath / relPath,
+ millSourcePath = ctx.millSourcePath / relPath,
segment = Segment.Cross(crossValues)
)
)
diff --git a/core/src/mill/define/Ctx.scala b/core/src/mill/define/Ctx.scala
index 6d685521..ddbdca96 100644
--- a/core/src/mill/define/Ctx.scala
+++ b/core/src/mill/define/Ctx.scala
@@ -45,7 +45,7 @@ case class Segments(value: Segment*){
case class Ctx(enclosing: String,
lineNum: Int,
segment: Segment,
- basePath: Path,
+ millSourcePath: Path,
segments: Segments,
overrides: Int){
}
diff --git a/core/src/mill/define/Module.scala b/core/src/mill/define/Module.scala
index 11a98d95..039011d8 100644
--- a/core/src/mill/define/Module.scala
+++ b/core/src/mill/define/Module.scala
@@ -24,8 +24,8 @@ class Module(implicit outerCtx0: mill.define.Ctx) extends mill.moduledefs.Cacher
lazy val millModuleDirectChildren = millInternal.reflectNestedObjects[Module]
def millOuterCtx = outerCtx0
- def basePath: Path = millOuterCtx.basePath / millOuterCtx.segment.pathSegments
- implicit def millModuleBasePath: BasePath = BasePath(basePath)
+ def millSourcePath: Path = millOuterCtx.millSourcePath / millOuterCtx.segment.pathSegments
+ implicit def millModuleBasePath: BasePath = BasePath(millSourcePath)
implicit def millModuleSegments: Segments = {
millOuterCtx.segments ++ Seq(millOuterCtx.segment)
}
@@ -92,19 +92,19 @@ trait TaskModule extends Module {
object BaseModule{
case class Implicit(value: BaseModule)
}
-class BaseModule(basePath0: Path)
+class BaseModule(millSourcePath0: Path)
(implicit millModuleEnclosing0: sourcecode.Enclosing,
millModuleLine0: sourcecode.Line,
millName0: sourcecode.Name)
extends Module()(
- mill.define.Ctx.make(implicitly, implicitly, implicitly, BasePath(basePath0), Segments(), Overrides(0))
+ mill.define.Ctx.make(implicitly, implicitly, implicitly, BasePath(millSourcePath0), Segments(), Overrides(0))
){
// A BaseModule should provide an empty Segments list to it's children, since
// it is the root of the module tree, and thus must not include it's own
// sourcecode.Name as part of the list,
override implicit def millModuleSegments: Segments = Segments()
- override def basePath = millOuterCtx.basePath
- override implicit def millModuleBasePath: BasePath = BasePath(basePath)
+ override def millSourcePath = millOuterCtx.millSourcePath
+ override implicit def millModuleBasePath: BasePath = BasePath(millSourcePath)
implicit def millImplicitBaseModule: BaseModule.Implicit = BaseModule.Implicit(this)
}
diff --git a/core/src/mill/define/Task.scala b/core/src/mill/define/Task.scala
index f74171ec..a94d9703 100644
--- a/core/src/mill/define/Task.scala
+++ b/core/src/mill/define/Task.scala
@@ -289,7 +289,7 @@ class Command[+T](t: Task[T],
}
class Worker[+T](t: Task[T], ctx0: mill.define.Ctx) extends NamedTaskImpl[T](ctx0, t) {
-
+ override def flushDest = false
override def asWorker = Some(this)
}
class Persistent[+T](t: Task[T],
diff --git a/core/src/mill/eval/Evaluator.scala b/core/src/mill/eval/Evaluator.scala
index 31b59865..21e3d3a9 100644
--- a/core/src/mill/eval/Evaluator.scala
+++ b/core/src/mill/eval/Evaluator.scala
@@ -12,21 +12,21 @@ import mill.util.Strict.Agg
import scala.collection.mutable
import scala.util.control.NonFatal
-case class Labelled[T](target: NamedTask[T],
+case class Labelled[T](task: NamedTask[T],
segments: Segments){
- def format = target match{
+ def format = task match{
case t: Target[T] => Some(t.readWrite.asInstanceOf[upickle.default.ReadWriter[T]])
case _ => None
}
- def writer = target match{
+ def writer = task match{
case t: mill.define.Command[T] => Some(t.writer.asInstanceOf[upickle.default.Writer[T]])
case t: Target[T] => Some(t.readWrite.asInstanceOf[upickle.default.ReadWriter[T]])
case _ => None
}
}
-class Evaluator[T](val workspacePath: Path,
- val basePath: Path,
- val externalBasePath: Path,
+class Evaluator[T](val outPath: Path,
+ val millSourcePath: Path,
+ val externalOutPath: Path,
val rootModule: mill.Module,
val discover: Discover[T],
log: Logger,
@@ -35,7 +35,7 @@ class Evaluator[T](val workspacePath: Path,
val workerCache = mutable.Map.empty[Segments, (Int, Any)]
def evaluate(goals: Agg[Task[_]]): Evaluator.Results = {
- mkdir(workspacePath)
+ mkdir(outPath)
val transitive = Graph.transitiveTargets(goals)
val topoSorted = Graph.topoSorted(transitive)
@@ -125,8 +125,13 @@ class Evaluator[T](val workspacePath: Path,
counterMsg = counterMsg
)
case Right(labelledNamedTask) =>
- val paths = Evaluator.resolveDestPaths(workspacePath, labelledNamedTask.segments)
- val groupBasePath = basePath / Evaluator.makeSegmentStrings(labelledNamedTask.segments)
+
+ val paths = if (labelledNamedTask.task.asTarget.exists(rootModule.millInternal.targets.contains)){
+ Evaluator.resolveDestPaths(outPath, labelledNamedTask.segments)
+ }else{
+ Evaluator.resolveDestPaths(externalOutPath, 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
@@ -136,14 +141,14 @@ class Evaluator[T](val workspacePath: Path,
parsed <- reader.read.lift(terminalResult)
} yield parsed
- val workerCached = labelledNamedTask.target.asWorker
+ val workerCached = labelledNamedTask.task.asWorker
.flatMap{w => workerCache.get(w.ctx.segments)}
.collect{case (`inputsHash`, v) => v}
workerCached.map((_, inputsHash)) orElse cached.map(p => (p, p.hashCode())) match{
case Some((v, hashCode)) =>
val newResults = mutable.LinkedHashMap.empty[Task[_], Result[(Any, Int)]]
- newResults(labelledNamedTask.target) = Result.Success((v, hashCode))
+ newResults(labelledNamedTask.task) = Result.Success((v, hashCode))
(newResults, Nil)
@@ -155,7 +160,8 @@ class Evaluator[T](val workspacePath: Path,
case Segment.Cross(s) => "[" + s.mkString(",") + "]"
}
- if (labelledNamedTask.target.flushDest) rm(paths.dest)
+ if (labelledNamedTask.task.flushDest) rm(paths.dest)
+
val (newResults, newEvaluated) = evaluateGroup(
group,
results,
@@ -166,9 +172,9 @@ class Evaluator[T](val workspacePath: Path,
counterMsg = counterMsg
)
- newResults(labelledNamedTask.target) match{
+ newResults(labelledNamedTask.task) match{
case Result.Success((v, hashCode)) =>
- labelledNamedTask.target.asWorker match{
+ labelledNamedTask.task.asWorker match{
case Some(w) =>
workerCache(w.ctx.segments) = (inputsHash, v)
case None =>
diff --git a/core/src/mill/main/RunScript.scala b/core/src/mill/main/RunScript.scala
index f09acf66..dfe49c57 100644
--- a/core/src/mill/main/RunScript.scala
+++ b/core/src/mill/main/RunScript.scala
@@ -185,7 +185,7 @@ object RunScript{
t match {
case t: mill.define.NamedTask[_] =>
val jsonFile = Evaluator
- .resolveDestPaths(evaluator.workspacePath, t.ctx.segments)
+ .resolveDestPaths(evaluator.outPath, t.ctx.segments)
.meta
val metadata = upickle.json.read(jsonFile.toIO)
Some(metadata(1))
diff --git a/core/test/resources/examples/javac/build.sc b/core/test/resources/examples/javac/build.sc
index 4a0882c6..8f250014 100644
--- a/core/test/resources/examples/javac/build.sc
+++ b/core/test/resources/examples/javac/build.sc
@@ -5,8 +5,8 @@ import mill.eval.PathRef
import mill.modules.Jvm
import mill.util.Loose
-def sourceRootPath = basePath / 'src
-def resourceRootPath = basePath / 'resources
+def sourceRootPath = millSourcePath / 'src
+def resourceRootPath = millSourcePath / 'resources
// sourceRoot -> allSources -> classFiles
// |
diff --git a/core/test/src/mill/define/BasePathTests.scala b/core/test/src/mill/define/BasePathTests.scala
index 62f84787..f7a1afa7 100644
--- a/core/test/src/mill/define/BasePathTests.scala
+++ b/core/test/src/mill/define/BasePathTests.scala
@@ -8,7 +8,7 @@ object BasePathTests extends TestSuite{
val testGraphs = new TestGraphs
val tests = Tests{
def check(m: Module, segments: String*) = {
- val remaining = m.basePath.relativeTo(pwd).segments.drop(1)
+ val remaining = m.millSourcePath.relativeTo(pwd).segments.drop(1)
assert(remaining == segments)
}
'singleton - {
@@ -47,18 +47,18 @@ object BasePathTests extends TestSuite{
}
'overriden - {
object overridenBasePath extends TestUtil.BaseModule {
- override def basePath = pwd / 'overridenBasePathRootValue
+ override def millSourcePath = pwd / 'overridenBasePathRootValue
object nested extends Module{
- override def basePath = super.basePath / 'overridenBasePathNested
+ override def millSourcePath = super.millSourcePath / 'overridenBasePathNested
object nested extends Module{
- override def basePath = super.basePath / 'overridenBasePathDoubleNested
+ override def millSourcePath = super.millSourcePath / 'overridenBasePathDoubleNested
}
}
}
assert(
- overridenBasePath.basePath == pwd / 'overridenBasePathRootValue,
- overridenBasePath.nested.basePath == pwd / 'overridenBasePathRootValue / 'nested / 'overridenBasePathNested,
- overridenBasePath.nested.nested.basePath == pwd / 'overridenBasePathRootValue / 'nested / 'overridenBasePathNested / 'nested / 'overridenBasePathDoubleNested
+ overridenBasePath.millSourcePath == pwd / 'overridenBasePathRootValue,
+ overridenBasePath.nested.millSourcePath == pwd / 'overridenBasePathRootValue / 'nested / 'overridenBasePathNested,
+ overridenBasePath.nested.nested.millSourcePath == pwd / 'overridenBasePathRootValue / 'nested / 'overridenBasePathNested / 'nested / 'overridenBasePathDoubleNested
)
}
diff --git a/core/test/src/mill/eval/ModuleTests.scala b/core/test/src/mill/eval/ModuleTests.scala
index 110e8c79..56c1a47b 100644
--- a/core/test/src/mill/eval/ModuleTests.scala
+++ b/core/test/src/mill/eval/ModuleTests.scala
@@ -26,7 +26,7 @@ object ModuleTests extends TestSuite{
)
val Right((30, 1)) = check.apply(Build.z)
- val base = check.evaluator.workspacePath
+ val base = check.evaluator.outPath
assert(
read(base / 'z / "meta.json").contains("30"),
read(base / 'mill / 'eval / 'ModuleTests / 'ExternalModule / 'x / "meta.json").contains("13"),
diff --git a/core/test/src/mill/util/TestEvaluator.scala b/core/test/src/mill/util/TestEvaluator.scala
index 3b34e27d..26577f3e 100644
--- a/core/test/src/mill/util/TestEvaluator.scala
+++ b/core/test/src/mill/util/TestEvaluator.scala
@@ -10,16 +10,16 @@ import utest.assert
import language.experimental.macros
object TestEvaluator{
implicit def implicitDisover[T]: Discover[T] = macro applyImpl[T]
- val externalBasePath = pwd / 'target / 'external
+ val externalOutPath = pwd / 'target / 'external
}
class TestEvaluator[T <: TestUtil.TestBuild](module: T,
workspacePath: Path,
- basePath: Path)
+ millSourcePath: Path)
(implicit discover: Discover[T]){
- val evaluator = new Evaluator(
- workspacePath, basePath, TestEvaluator.externalBasePath, module, discover, DummyLogger
- )
-// val evaluator = new Evaluator(workspacePath, basePath, module, discover, new PrintLogger(true, ammonite.util.Colors.Default, System.out, System.out, System.err))
+ val logger = DummyLogger
+// val logger = new PrintLogger(true, ammonite.util.Colors.Default, System.out, System.out, System.err)
+ val evaluator = new Evaluator(workspacePath, millSourcePath, TestEvaluator.externalOutPath, module, discover, logger)
+
def apply[T](t: Task[T]): Either[Result.Failing, (T, Int)] = {
val evaluated = evaluator.evaluate(Agg(t))
@@ -31,7 +31,7 @@ class TestEvaluator[T <: TestUtil.TestBuild](module: T,
case t: Target[_]
if module.millInternal.targets.contains(t)
&& !t.isInstanceOf[Input[_]] => t
- case t: mill.define.Command[_] => t
+ case t: mill.define.Command[_] => t
}.size
))
} else {
diff --git a/docs/cross.md b/docs/cross.md
index 25ae4a8a..fe14a23e 100644
--- a/docs/cross.md
+++ b/docs/cross.md
@@ -25,7 +25,7 @@ mill --show foo[2.12].suffix
mill --show foo[2.12].bigSuffix
```
-The modules each also have a `basePath` of
+The modules each also have a `millSourcePath` of
```text
foo/2.10
diff --git a/docs/modules.md b/docs/modules.md
index 86f807de..b92ab684 100644
--- a/docs/modules.md
+++ b/docs/modules.md
@@ -76,9 +76,9 @@ You can override targets and commands to customize them or change what they do.
The overriden version is available via `super`. You can omit the `override`
keyword in Mill builds.
-## basePath
+## millSourcePath
-Each Module has a `basePath` field that corresponds to the path that module
+Each Module has a `millSourcePath` field that corresponds to the path that module
expects it's input files to be on disk. Re-visiting our examples above:
```scala
@@ -90,24 +90,24 @@ object foo extends mill.Module{
}
```
-The `foo` module has a `basePath` of `./foo`, while the `foo.baz` module has a
-`basePath` of `./foo/baz`.
+The `foo` module has a `millSourcePath` of `./foo`, while the `foo.baz` module has a
+`millSourcePath` of `./foo/baz`.
-You can use `basePath` to automatically set the source directories of your
+You can use `millSourcePath` to automatically set the source directories of your
modules to match the build structure. You are not forced to rigidly use
-`basePath` to define the source folders of all your code, but it can simplify
+`millSourcePath` to define the source folders of all your code, but it can simplify
the common case where you probably want your build-layout on on-disk-layout to
be the same.
e.g. for `mill.scalalib.ScalaModule`, the Scala source code is assumed by
-default to be in `basePath/"src"` while resources are automatically assumed to
-be in `basePath/"resources"`.
+default to be in `millSourcePath/"src"` while resources are automatically assumed to
+be in `millSourcePath/"resources"`.
-You can override `basePath`:
+You can override `millSourcePath`:
```scala
object foo extends mill.Module{
- def basePath = super.basePath / "lols"
+ def millSourcePath = super.millSourcePath / "lols"
def bar = T{ "hello" }
object baz extends mill.Module{
def qux = T{ "world" }
@@ -116,10 +116,10 @@ object foo extends mill.Module{
```
And any overrides propagate down to the module's children: in the above example,
-module `foo` would have it's `basePath` be `./foo/lols` while module` foo.baz`
-would have it's `basePath` be `./foo/lols/baz`.
+module `foo` would have it's `millSourcePath` be `./foo/lols` while module` foo.baz`
+would have it's `millSourcePath` be `./foo/lols/baz`.
-Note that `basePath` is generally only used for a module's input source files.
+Note that `millSourcePath` is generally only used for a module's input source files.
Output is always in the `out/` folder and cannot be changed, e.g. even with the
-overriden `basePath` the output paths are still the default `./out/foo/bar` and
+overriden `millSourcePath` the output paths are still the default `./out/foo/bar` and
`./out/foo/baz/qux` folders. \ No newline at end of file
diff --git a/integration/test/resources/acyclic/build.sc b/integration/test/resources/acyclic/build.sc
index b8f878ad..5328db24 100644
--- a/integration/test/resources/acyclic/build.sc
+++ b/integration/test/resources/acyclic/build.sc
@@ -4,7 +4,7 @@ import mill.scalalib.publish.{PomSettings, License, Developer, SCM}
object acyclic extends Cross[AcyclicModule]("2.10.6", "2.11.8", "2.12.3", "2.12.4")
class AcyclicModule(val crossScalaVersion: String) extends CrossSbtModule with PublishModule {
- def basePath = super.basePath / ammonite.ops.up
+ def millSourcePath = super.millSourcePath / ammonite.ops.up
def artifactName = "acyclic"
def publishVersion = "0.1.7"
diff --git a/integration/test/resources/ammonite/build.sc b/integration/test/resources/ammonite/build.sc
index 4b8db461..f8732a4c 100644
--- a/integration/test/resources/ammonite/build.sc
+++ b/integration/test/resources/ammonite/build.sc
@@ -59,7 +59,7 @@ object amm extends Cross[MainModule](fullCrossScalaVersions:_*){
def generatedSources = T{
import ammonite.ops._
mkdir(T.ctx().dest)
- cp(build.basePath/'project/"Constants.scala", T.ctx().dest/"Constants.scala")
+ cp(build.millSourcePath/'project/"Constants.scala", T.ctx().dest/"Constants.scala")
Seq(PathRef(T.ctx().dest))
}
}
diff --git a/integration/test/resources/jawn/build.sc b/integration/test/resources/jawn/build.sc
index ac9de195..b83eac17 100644
--- a/integration/test/resources/jawn/build.sc
+++ b/integration/test/resources/jawn/build.sc
@@ -4,7 +4,7 @@ import mill.scalalib.{Dep, TestModule, DepSyntax, Lib}
import ammonite.ops.up
object jawn extends Cross[JawnModule]("2.10.6", "2.11.11", "2.12.3")
class JawnModule(crossVersion: String) extends mill.Module{
- override def basePath = super.basePath / up / up
+ override def millSourcePath = super.millSourcePath / up / up
trait JawnModule extends scalalib.SbtModule{
def scalaVersion = crossVersion
@@ -53,7 +53,7 @@ class JawnModule(crossVersion: String) extends mill.Module{
object rojoma extends Support(ivy"com.rojoma::rojoma-json:2.4.3")
object rojomaV3 extends Support(ivy"com.rojoma::rojoma-json-v3:3.7.2"){
- override def basePath = super.basePath / up / "rojoma-v3"
+ override def millSourcePath = super.millSourcePath / up / "rojoma-v3"
}
object spray extends Support(ivy"io.spray::spray-json:1.3.3")
}
diff --git a/scalajslib/test/src/mill/scalajslib/HelloJSWorldTests.scala b/scalajslib/test/src/mill/scalajslib/HelloJSWorldTests.scala
index 5ba4343f..fc419e27 100644
--- a/scalajslib/test/src/mill/scalajslib/HelloJSWorldTests.scala
+++ b/scalajslib/test/src/mill/scalajslib/HelloJSWorldTests.scala
@@ -20,7 +20,7 @@ object HelloJSWorldTests extends TestSuite {
trait HelloJSWorldModule extends ScalaJSModule with PublishModule {
- override def basePath = HelloJSWorldTests.workspacePath
+ override def millSourcePath = HelloJSWorldTests.workspacePath
override def mainClass = Some("Main")
}
@@ -36,7 +36,7 @@ object HelloJSWorldTests extends TestSuite {
class BuildModuleUtest(scalaVersion0: String, sjsVersion0: String)
extends BuildModule(scalaVersion0: String, sjsVersion0: String) {
object test extends super.Tests {
- override def sources = T.input{ Agg(PathRef(basePath / 'src / 'utest)) }
+ override def sources = T.input{ Agg(PathRef(millSourcePath / 'src / 'utest)) }
def testFramework: T[String] = "utest.runner.Framework"
override def ivyDeps = Agg(
ivy"com.lihaoyi:utest_sjs${scalaJSBinaryVersion()}_${Lib.scalaBinaryVersion(scalaVersion())}:0.6.3"
@@ -48,7 +48,7 @@ object HelloJSWorldTests extends TestSuite {
class BuildModuleScalaTest(scalaVersion0: String, sjsVersion0: String)
extends BuildModule(scalaVersion0: String, sjsVersion0: String) {
object test extends super.Tests {
- override def sources = T.input{ Agg(PathRef(basePath / 'src / 'scalatest)) }
+ override def sources = T.input{ Agg(PathRef(millSourcePath / 'src / 'scalatest)) }
def testFramework: T[String] = "org.scalatest.tools.Framework"
override def ivyDeps = Agg(
ivy"org.scalatest:scalatest_sjs${scalaJSBinaryVersion()}_${Lib.scalaBinaryVersion(scalaVersion())}:3.0.4"
@@ -76,7 +76,7 @@ object HelloJSWorldTests extends TestSuite {
}
}
- val srcPath = pwd / 'scalajslib / 'test / 'resources / "hello-js-world"
+ val millSourcePath = pwd / 'scalajslib / 'test / 'resources / "hello-js-world"
val workspacePath = pwd / 'target / 'workspace / "hello-js-world"
val outputPath = workspacePath / 'out
val mainObject = workspacePath / 'src / "Main.scala"
@@ -84,7 +84,7 @@ object HelloJSWorldTests extends TestSuite {
val helloWorldEvaluator = new TestEvaluator(
HelloJSWorld,
workspacePath,
- srcPath
+ millSourcePath
)
class Console {
@@ -243,7 +243,7 @@ object HelloJSWorldTests extends TestSuite {
def prepareWorkspace(): Unit = {
rm(workspacePath)
mkdir(workspacePath / up)
- cp(srcPath, workspacePath)
+ cp(millSourcePath, workspacePath)
}
}
diff --git a/scalalib/src/mill/scalalib/GenIdea.scala b/scalalib/src/mill/scalalib/GenIdea.scala
index 99b820b0..60153f1f 100644
--- a/scalalib/src/mill/scalalib/GenIdea.scala
+++ b/scalalib/src/mill/scalalib/GenIdea.scala
@@ -116,7 +116,7 @@ object GenIdea {
val normalSourcePaths = (allSourcesPathRefs.map(_.path).toSet -- generatedSourcePaths.toSet).toSeq
val paths = Evaluator.resolveDestPaths(
- evaluator.workspacePath,
+ evaluator.outPath,
mod.compile.ctx.segments
)
diff --git a/scalalib/src/mill/scalalib/MiscModule.scala b/scalalib/src/mill/scalalib/MiscModule.scala
index e20fe7be..440b7dcd 100644
--- a/scalalib/src/mill/scalalib/MiscModule.scala
+++ b/scalalib/src/mill/scalalib/MiscModule.scala
@@ -14,7 +14,7 @@ object CrossModuleBase{
}
trait CrossModuleBase extends mill.Module{
def crossScalaVersion: String
- override def basePath = super.basePath / ammonite.ops.up
+ override def millSourcePath = super.millSourcePath / ammonite.ops.up
implicit def crossSbtModuleResolver: Resolver[CrossModuleBase] = new Resolver[CrossModuleBase]{
def resolve[V <: CrossModuleBase](c: Cross[V]): V = {
crossScalaVersion.split('.')
@@ -37,14 +37,14 @@ trait CrossModuleBase extends mill.Module{
trait CrossScalaModule extends ScalaModule with CrossModuleBase{ outer =>
override def sources = T.input{
super.sources() ++
- CrossModuleBase.scalaVersionPaths(crossScalaVersion, s => basePath / s"src-$s" )
+ CrossModuleBase.scalaVersionPaths(crossScalaVersion, s => millSourcePath / s"src-$s" )
}
trait Tests extends super.Tests {
override def sources = T.input{
super.sources() ++
- CrossModuleBase.scalaVersionPaths(crossScalaVersion, s => basePath / s"src-$s" )
+ CrossModuleBase.scalaVersionPaths(crossScalaVersion, s => millSourcePath / s"src-$s" )
}
}
}
@@ -52,20 +52,20 @@ trait CrossScalaModule extends ScalaModule with CrossModuleBase{ outer =>
trait SbtModule extends ScalaModule { outer =>
override def sources = T.input{
Agg(
- PathRef(basePath / 'src / 'main / 'scala),
- PathRef(basePath / 'src / 'main / 'java)
+ PathRef(millSourcePath / 'src / 'main / 'scala),
+ PathRef(millSourcePath / 'src / 'main / 'java)
)
}
- override def resources = T.input{ Agg(PathRef(basePath / 'src / 'main / 'resources)) }
+ override def resources = T.input{ Agg(PathRef(millSourcePath / 'src / 'main / 'resources)) }
trait Tests extends super.Tests {
- override def basePath = outer.basePath
+ override def millSourcePath = outer.millSourcePath
override def sources = T.input{
Agg(
- PathRef(basePath / 'src / 'test / 'scala),
- PathRef(basePath / 'src / 'test / 'java)
+ PathRef(millSourcePath / 'src / 'test / 'scala),
+ PathRef(millSourcePath / 'src / 'test / 'java)
)
}
- override def resources = T.input{ Agg(PathRef(basePath / 'src / 'test / 'resources)) }
+ override def resources = T.input{ Agg(PathRef(millSourcePath / 'src / 'test / 'resources)) }
}
}
@@ -76,17 +76,17 @@ trait CrossSbtModule extends SbtModule with CrossModuleBase{ outer =>
super.sources() ++
CrossModuleBase.scalaVersionPaths(
crossScalaVersion,
- s => basePath / 'src / 'main / s"scala-$s"
+ s => millSourcePath / 'src / 'main / s"scala-$s"
)
}
trait Tests extends super.Tests {
- override def basePath = outer.basePath
+ override def millSourcePath = outer.millSourcePath
override def sources = T.input{
super.sources() ++
CrossModuleBase.scalaVersionPaths(
crossScalaVersion,
- s => basePath / 'src / 'main / s"scala-$s"
+ s => millSourcePath / 'src / 'main / s"scala-$s"
)
}
}
diff --git a/scalalib/src/mill/scalalib/ScalaModule.scala b/scalalib/src/mill/scalalib/ScalaModule.scala
index 47326c6c..47309350 100644
--- a/scalalib/src/mill/scalalib/ScalaModule.scala
+++ b/scalalib/src/mill/scalalib/ScalaModule.scala
@@ -126,8 +126,8 @@ trait ScalaModule extends mill.Module with TaskModule { outer =>
def prependShellScript: T[String] = T{ "" }
- def sources = T.input{ Agg(PathRef(basePath / 'src)) }
- def resources = T.input{ Agg(PathRef(basePath / 'resources)) }
+ def sources = T.input{ Agg(PathRef(millSourcePath / 'src)) }
+ def resources = T.input{ Agg(PathRef(millSourcePath / 'resources)) }
def generatedSources = T { Agg.empty[PathRef] }
def allSources = T{ sources() ++ generatedSources() }
@@ -249,7 +249,7 @@ trait ScalaModule extends mill.Module with TaskModule { outer =>
// publish artifact with name "mill_2.12.4" instead of "mill_2.12"
def crossFullScalaVersion: T[Boolean] = false
- def artifactName: T[String] = basePath.last.toString
+ def artifactName: T[String] = millSourcePath.last.toString
def artifactScalaVersion: T[String] = T {
if (crossFullScalaVersion()) scalaVersion()
else Lib.scalaBinaryVersion(scalaVersion())
diff --git a/scalalib/test/src/mill/scalalib/GenIdeaTests.scala b/scalalib/test/src/mill/scalalib/GenIdeaTests.scala
index 58992e4f..00d9f53e 100644
--- a/scalalib/test/src/mill/scalalib/GenIdeaTests.scala
+++ b/scalalib/test/src/mill/scalalib/GenIdeaTests.scala
@@ -8,13 +8,13 @@ import utest._
import mill.util.TestEvaluator.implicitDisover
object GenIdeaTests extends TestSuite {
- val basePath = pwd / 'target / 'workspace / "gen-idea"
- val outPath = basePath / 'out
- val workingSrcPath = basePath / 'src
+ val millSourcePath = pwd / 'target / 'workspace / "gen-idea"
+ val outPath = millSourcePath / 'out
+ val workingSrcPath = millSourcePath / 'src
trait HelloWorldModule extends scalalib.ScalaModule {
def scalaVersion = "2.12.4"
- def basePath = HelloWorldTests.workingSrcPath
+ def millSourcePath = HelloWorldTests.workingSrcPath
}
object HelloWorld extends TestUtil.BaseModule with HelloWorldModule
@@ -32,34 +32,34 @@ object GenIdeaTests extends TestSuite {
val layout = GenIdea.xmlFileLayout(helloWorldEvaluator.evaluator, HelloWorld, fetchMillModules = false)
for((relPath, xml) <- layout){
- write.over(basePath/ "generated"/ relPath, pp.format(xml))
+ write.over(millSourcePath/ "generated"/ relPath, pp.format(xml))
}
Seq(
"gen-idea/idea_modules/iml" ->
- basePath / "generated" / ".idea_modules" /".iml",
+ millSourcePath / "generated" / ".idea_modules" /".iml",
"gen-idea/idea_modules/root.iml" ->
- basePath / "generated" / ".idea_modules" /"root.iml",
+ millSourcePath / "generated" / ".idea_modules" /"root.iml",
"gen-idea/idea/libraries/scala-reflect_2.12.4_scala-reflect-2.12.4-sources.jar.xml" ->
- basePath / "generated" / ".idea" / "libraries" / "scala-reflect_2.12.4_scala-reflect-2.12.4-sources.jar.xml",
+ millSourcePath / "generated" / ".idea" / "libraries" / "scala-reflect_2.12.4_scala-reflect-2.12.4-sources.jar.xml",
"gen-idea/idea/libraries/scala-reflect_2.12.4_scala-reflect-2.12.4.jar.xml" ->
- basePath / "generated" / ".idea" / "libraries" / "scala-reflect_2.12.4_scala-reflect-2.12.4.jar.xml",
+ millSourcePath / "generated" / ".idea" / "libraries" / "scala-reflect_2.12.4_scala-reflect-2.12.4.jar.xml",
"gen-idea/idea/libraries/scala-library_2.12.4_scala-library-2.12.4.jar.xml" ->
- basePath / "generated" / ".idea" / "libraries" / "scala-library_2.12.4_scala-library-2.12.4.jar.xml",
+ millSourcePath / "generated" / ".idea" / "libraries" / "scala-library_2.12.4_scala-library-2.12.4.jar.xml",
"gen-idea/idea/libraries/modules_scala-xml_2.12_1.0.6_scala-xml_2.12-1.0.6.jar.xml" ->
- basePath / "generated" / ".idea" / "libraries" / "modules_scala-xml_2.12_1.0.6_scala-xml_2.12-1.0.6.jar.xml",
+ millSourcePath / "generated" / ".idea" / "libraries" / "modules_scala-xml_2.12_1.0.6_scala-xml_2.12-1.0.6.jar.xml",
"gen-idea/idea/libraries/modules_scala-xml_2.12_1.0.6_scala-xml_2.12-1.0.6-sources.jar.xml" ->
- basePath / "generated" / ".idea" / "libraries" / "modules_scala-xml_2.12_1.0.6_scala-xml_2.12-1.0.6-sources.jar.xml",
+ millSourcePath / "generated" / ".idea" / "libraries" / "modules_scala-xml_2.12_1.0.6_scala-xml_2.12-1.0.6-sources.jar.xml",
"gen-idea/idea/libraries/scala-compiler_2.12.4_scala-compiler-2.12.4-sources.jar.xml" ->
- basePath / "generated" / ".idea" / "libraries" / "scala-compiler_2.12.4_scala-compiler-2.12.4-sources.jar.xml",
+ millSourcePath / "generated" / ".idea" / "libraries" / "scala-compiler_2.12.4_scala-compiler-2.12.4-sources.jar.xml",
"gen-idea/idea/libraries/scala-library_2.12.4_scala-library-2.12.4-sources.jar.xml" ->
- basePath / "generated" / ".idea" / "libraries" / "scala-library_2.12.4_scala-library-2.12.4-sources.jar.xml",
+ millSourcePath / "generated" / ".idea" / "libraries" / "scala-library_2.12.4_scala-library-2.12.4-sources.jar.xml",
"gen-idea/idea/libraries/scala-compiler_2.12.4_scala-compiler-2.12.4.jar.xml" ->
- basePath / "generated" / ".idea" / "libraries" / "scala-compiler_2.12.4_scala-compiler-2.12.4.jar.xml",
+ millSourcePath / "generated" / ".idea" / "libraries" / "scala-compiler_2.12.4_scala-compiler-2.12.4.jar.xml",
"gen-idea/idea/modules.xml" ->
- basePath / "generated" / ".idea" / "modules.xml",
+ millSourcePath / "generated" / ".idea" / "modules.xml",
"gen-idea/idea/misc.xml" ->
- basePath / "generated" / ".idea" / "misc.xml"
+ millSourcePath / "generated" / ".idea" / "misc.xml"
).foreach { case (resource, generated) =>
val resourceString = scala.io.Source.fromResource(resource).getLines().mkString("\n")
val generatedString = normaliseLibraryPaths(read! generated)
diff --git a/scalalib/test/src/mill/scalalib/HelloWorldTests.scala b/scalalib/test/src/mill/scalalib/HelloWorldTests.scala
index 06d650c1..cecc9349 100644
--- a/scalalib/test/src/mill/scalalib/HelloWorldTests.scala
+++ b/scalalib/test/src/mill/scalalib/HelloWorldTests.scala
@@ -17,7 +17,7 @@ import scala.collection.JavaConverters._
object HelloWorldTests extends TestSuite {
trait HelloWorldModule extends scalalib.ScalaModule {
def scalaVersion = "2.12.4"
- def basePath = HelloWorldTests.workingSrcPath
+ def millSourcePath = HelloWorldTests.workingSrcPath
}
object HelloWorld extends TestUtil.BaseModule with HelloWorldModule
@@ -73,10 +73,10 @@ object HelloWorldTests extends TestSuite {
object HelloWorldScalaOverride extends TestUtil.BaseModule with HelloWorldModule {
override def scalaVersion: Target[String] = "2.11.11"
}
- val srcPath = pwd / 'scalalib / 'test / 'resources / "hello-world"
- val basePath = pwd / 'target / 'workspace / "hello-world"
- val workingSrcPath = basePath / 'src
- val outPath = basePath / 'out
+ val resourcePath = pwd / 'scalalib / 'test / 'resources / "hello-world"
+ val millSourcePath = pwd / 'target / 'workspace / "hello-world"
+ val workingSrcPath = millSourcePath / 'src
+ val outPath = millSourcePath / 'out
val mainObject = workingSrcPath / 'src / "Main.scala"
@@ -211,7 +211,7 @@ object HelloWorldTests extends TestSuite {
}
'runMain - {
'runMainObject - {
- val runResult = basePath / 'out / 'runMain / 'dest / "hello-mill"
+ val runResult = millSourcePath / 'out / 'runMain / 'dest / "hello-mill"
val Right((_, evalCount)) = helloWorldEvaluator(HelloWorld.runMain("Main", runResult.toString))
assert(evalCount > 0)
@@ -224,7 +224,7 @@ object HelloWorldTests extends TestSuite {
'runCross{
def cross(v: String) {
- val runResult = basePath / 'out / 'cross / v / 'runMain / 'dest / "hello-mill"
+ val runResult = millSourcePath / 'out / 'cross / v / 'runMain / 'dest / "hello-mill"
val Right((_, evalCount)) = helloWorldCrossEvaluator(
CrossHelloWorld.cross(v).runMain("Main", runResult.toString)
@@ -265,7 +265,7 @@ object HelloWorldTests extends TestSuite {
'forkRun - {
'runIfMainClassProvided - {
- val runResult = basePath / 'out / 'run / 'dest / "hello-mill"
+ val runResult = millSourcePath / 'out / 'run / 'dest / "hello-mill"
val Right((_, evalCount)) = helloWorldWithMainEvaluator(
HelloWorldWithMain.run(runResult.toString)
)
@@ -288,7 +288,7 @@ object HelloWorldTests extends TestSuite {
}
'run - {
'runIfMainClassProvided - {
- val runResult = basePath / 'out / 'run / 'dest / "hello-mill"
+ val runResult = millSourcePath / 'out / 'run / 'dest / "hello-mill"
val Right((_, evalCount)) = helloWorldWithMainEvaluator(
HelloWorldWithMain.runLocal(runResult.toString)
)
@@ -364,9 +364,9 @@ object HelloWorldTests extends TestSuite {
exists(result.path),
evalCount > 0
)
- val runResult = basePath / "hello-mill"
+ val runResult = millSourcePath / "hello-mill"
- %%("java", "-jar", result.path, runResult)(wd = basePath)
+ %%("java", "-jar", result.path, runResult)(wd = millSourcePath)
assert(
exists(runResult),
@@ -394,7 +394,7 @@ object HelloWorldTests extends TestSuite {
rm(outPath)
rm(workingSrcPath)
mkdir(outPath)
- cp(srcPath, workingSrcPath)
+ cp(resourcePath, workingSrcPath)
}
}
diff --git a/scalaworker/src/mill/scalaworker/ScalaWorker.scala b/scalaworker/src/mill/scalaworker/ScalaWorker.scala
index 45b2b927..62fc7f58 100644
--- a/scalaworker/src/mill/scalaworker/ScalaWorker.scala
+++ b/scalaworker/src/mill/scalaworker/ScalaWorker.scala
@@ -95,6 +95,7 @@ class ScalaWorker(ctx0: mill.util.Ctx,
.get
.invoke(null, argsArray)
}
+
compiledDest
}