summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2018-02-02 08:53:11 -0800
committerLi Haoyi <haoyi.sg@gmail.com>2018-02-02 08:54:16 -0800
commitf1153f8fff92be3711fd238cd2c7c06ac2a7a5bc (patch)
treea5cbc4d30abea88da2f774dcf210f8d5a5a2bb60 /core/src
parent5be2c5aea4527cf637948e6bf2e4c56e3273fbd9 (diff)
downloadmill-f1153f8fff92be3711fd238cd2c7c06ac2a7a5bc.tar.gz
mill-f1153f8fff92be3711fd238cd2c7c06ac2a7a5bc.tar.bz2
mill-f1153f8fff92be3711fd238cd2c7c06ac2a7a5bc.zip
Fix propagation of overriden `Module#basePath` and add a test to verify it's behavior
Diffstat (limited to 'core/src')
-rw-r--r--core/src/mill/define/Module.scala2
-rw-r--r--core/src/mill/main/MainRunner.scala5
2 files changed, 5 insertions, 2 deletions
diff --git a/core/src/mill/define/Module.scala b/core/src/mill/define/Module.scala
index dd451c9c..09e8e974 100644
--- a/core/src/mill/define/Module.scala
+++ b/core/src/mill/define/Module.scala
@@ -104,7 +104,7 @@ class BaseModule(basePath0: Path)
// 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 implicit def millModuleBasePath: BasePath = BasePath(millOuterCtx.basePath)
override def basePath = millOuterCtx.basePath
+ override implicit def millModuleBasePath: BasePath = BasePath(basePath)
implicit def millImplicitBaseModule: BaseModule.Implicit = BaseModule.Implicit(this)
} \ No newline at end of file
diff --git a/core/src/mill/main/MainRunner.scala b/core/src/mill/main/MainRunner.scala
index e098144f..06e1795f 100644
--- a/core/src/mill/main/MainRunner.scala
+++ b/core/src/mill/main/MainRunner.scala
@@ -84,13 +84,16 @@ class MainRunner(config: ammonite.main.Cli.Config,
object CustomCodeWrapper extends Preprocessor.CodeWrapper {
def top(pkgName: Seq[Name], imports: Imports, indexedWrapperName: Name) = {
val wrapName = indexedWrapperName.backticked
+ val literalPath = pprint.Util.literalize(config.wd.toString)
s"""
|package ${pkgName.head.encoded}
|package ${Util.encodeScalaSourcePath(pkgName.tail)}
|$imports
|import mill._
|
- |object $wrapName extends mill.define.BaseModule(ammonite.ops.Path(${pprint.Util.literalize(config.wd.toString)})) with $wrapName{
+ |object $wrapName
+ |extends mill.define.BaseModule(ammonite.ops.Path($literalPath))
+ |with $wrapName{
| // Stub to make sure Ammonite has something to call after it evaluates a script,
| // even if it does nothing...
| def $$main() = Iterator[String]()