From 0b2efbaf943501da2dac3741a9a8322597cc35e7 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sun, 25 Feb 2018 19:14:08 -0800 Subject: bump Ammonite version --- build.sbt | 2 +- build.sc | 2 +- main/src/mill/main/MainRunner.scala | 60 ++++++++++++++++++------------------- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/build.sbt b/build.sbt index d26a848c..47ba823f 100644 --- a/build.sbt +++ b/build.sbt @@ -24,7 +24,7 @@ val sharedSettings = Seq( autoCompilerPlugins := true, addCompilerPlugin("com.lihaoyi" %% "acyclic" % "0.1.7"), - libraryDependencies += "com.lihaoyi" % "ammonite" % "1.0.3-21-05b5d32" cross CrossVersion.full, + libraryDependencies += "com.lihaoyi" % "ammonite" % "1.0.3-49-7fa03d0" cross CrossVersion.full, mainClass in Test := Some("ammonite.Main") ) diff --git a/build.sc b/build.sc index c3aa017c..77a6b4a2 100755 --- a/build.sc +++ b/build.sc @@ -78,7 +78,7 @@ object core extends MillModule { def ivyDeps = Agg( ivy"com.lihaoyi::sourcecode:0.1.4", - ivy"com.lihaoyi:::ammonite:1.0.3-21-05b5d32" + ivy"com.lihaoyi:::ammonite:1.0.3-49-7fa03d0" ) def generatedSources = T { 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) } } } -- cgit v1.2.3