diff options
author | Nikolay Tatarinov <5min4eq.unity@gmail.com> | 2018-05-07 14:03:25 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-07 14:03:25 +0300 |
commit | c01624addf7d233b854952bb805f36bc46d76b30 (patch) | |
tree | d293e814ca3079df3996fd12a5f598696171a998 /main/src | |
parent | cb327ee2f04a5493d285b4e4dd04a89c96b7c23c (diff) | |
download | mill-c01624addf7d233b854952bb805f36bc46d76b30.tar.gz mill-c01624addf7d233b854952bb805f36bc46d76b30.tar.bz2 mill-c01624addf7d233b854952bb805f36bc46d76b30.zip |
don't fail command when there is no build.sc file in directory. Lets the user to run basic mill commands (#307)
Diffstat (limited to 'main/src')
-rw-r--r-- | main/src/mill/main/RunScript.scala | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/main/src/mill/main/RunScript.scala b/main/src/mill/main/RunScript.scala index 3c2cb1fe..50cbb213 100644 --- a/main/src/mill/main/RunScript.scala +++ b/main/src/mill/main/RunScript.scala @@ -41,7 +41,7 @@ object RunScript{ case Right(interp) => interp.watch(path) val eval = - for(rootModule <- evaluateRootModule(wd, path, interp)) + for(rootModule <- evaluateRootModule(wd, path, interp, log)) yield Evaluator.State( rootModule, rootModule.getClass.getClassLoader.asInstanceOf[SpecialClassLoader].classpathSignature, @@ -72,14 +72,19 @@ object RunScript{ def evaluateRootModule(wd: Path, path: Path, - interp: ammonite.interp.Interpreter): Res[mill.define.BaseModule] = { + interp: ammonite.interp.Interpreter, + log: Logger + ): Res[mill.define.BaseModule] = { val (pkg, wrapper) = Util.pathToPackageWrapper(Seq(), path relativeTo wd) for { scriptTxt <- try Res.Success(Util.normalizeNewlines(read(path))) - catch { case e: NoSuchFileException => Res.Failure("Script file not found: " + path) } + catch { case _: NoSuchFileException => + log.info("No build file found, you should create build.sc to do something useful") + Res.Success("") + } processed <- interp.processModule( scriptTxt, |