summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2018-02-25 19:14:08 -0800
committerLi Haoyi <haoyi.sg@gmail.com>2018-02-25 19:14:08 -0800
commit0b2efbaf943501da2dac3741a9a8322597cc35e7 (patch)
tree0905bec5b6efeb97c7b0d655c346d83ee0042c68 /main
parentfc1e0e4116e3dc208722983d26da29c325e04701 (diff)
downloadmill-0b2efbaf943501da2dac3741a9a8322597cc35e7.tar.gz
mill-0b2efbaf943501da2dac3741a9a8322597cc35e7.tar.bz2
mill-0b2efbaf943501da2dac3741a9a8322597cc35e7.zip
bump Ammonite version
Diffstat (limited to 'main')
-rw-r--r--main/src/mill/main/MainRunner.scala60
1 files changed, 30 insertions, 30 deletions
diff --git a/main/src/mill/main/MainRunner.scala b/main/src/mill/main/MainRunner.scala
index 4205b6dc..ff7bcbbd 100644
--- a/main/src/mill/main/MainRunner.scala
+++ b/main/src/mill/main/MainRunner.scala
@@ -116,38 +116,38 @@ class MainRunner(val config: ammonite.main.Cli.Config,
}
object CustomCodeWrapper extends Preprocessor.CodeWrapper {
- def top(pkgName: Seq[Name], imports: Imports, indexedWrapperName: Name) = {
+ def apply(code: String,
+ pkgName: Seq[ammonite.util.Name],
+ imports: ammonite.util.Imports,
+ printCode: String,
+ indexedWrapperName: ammonite.util.Name,
+ extraCode: String): (String, String, Int) = {
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($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]()
- |
- | // Need to wrap the returned Module in Some(...) to make sure it
- | // doesn't get picked up during reflective child-module discovery
- | def millSelf = Some(this)
- |
- | implicit lazy val millDiscover: mill.define.Discover[this.type] = mill.define.Discover[this.type]
- |}
- |
- |sealed trait $wrapName extends mill.main.MainModule{
- |""".stripMargin
- }
-
-
- def bottom(printCode: String, indexedWrapperName: Name, extraCode: String) = {
- // We need to disable the `$main` method definition inside the wrapper class,
- // because otherwise it might get picked up by Ammonite and run as a static
- // class method, which blows up since it's defined as an instance method
- "\n}"
+ val top = s"""
+ |package ${pkgName.head.encoded}
+ |package ${Util.encodeScalaSourcePath(pkgName.tail)}
+ |$imports
+ |import mill._
+ |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]()
+ |
+ | // Need to wrap the returned Module in Some(...) to make sure it
+ | // doesn't get picked up during reflective child-module discovery
+ | def millSelf = Some(this)
+ |
+ | implicit lazy val millDiscover: mill.define.Discover[this.type] = mill.define.Discover[this.type]
+ |}
+ |
+ |sealed trait $wrapName extends mill.main.MainModule{
+ |""".stripMargin
+ val bottom = "}"
+
+ (top, bottom, 1)
}
}
}