summaryrefslogtreecommitdiff
path: root/scalalib
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 /scalalib
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
Diffstat (limited to 'scalalib')
-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
5 files changed, 46 insertions, 46 deletions
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)
}
}