diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2017-02-11 17:05:56 -0500 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2017-02-11 17:05:56 -0500 |
commit | aca3c4dab2528b30ffad73b67ef95e41ab485304 (patch) | |
tree | 2e779dba3f043dfd7a36bf03c9107641aef63f3c /stage1/Stage1Lib.scala | |
parent | 59666ddfdca48ae79ef38bcf42427954c6fea17d (diff) | |
download | cbt-aca3c4dab2528b30ffad73b67ef95e41ab485304.tar.gz cbt-aca3c4dab2528b30ffad73b67ef95e41ab485304.tar.bz2 cbt-aca3c4dab2528b30ffad73b67ef95e41ab485304.zip |
omit classpath when classpath is empty (= no dependencies, only jdk)
Diffstat (limited to 'stage1/Stage1Lib.scala')
-rw-r--r-- | stage1/Stage1Lib.scala | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/stage1/Stage1Lib.scala b/stage1/Stage1Lib.scala index f73995e..4f3f592 100644 --- a/stage1/Stage1Lib.scala +++ b/stage1/Stage1Lib.scala @@ -201,8 +201,6 @@ class Stage1Lib( logger: Logger ) extends BaseLib{ val d = Dependencies(dependencies) val classpath = d.classpath val cp = classpath.string - if(classpath.files.isEmpty) - throw new Exception("Trying to compile with empty classpath. Source files: " ++ sourceFiles.toString) if( sourceFiles.isEmpty ){ None @@ -258,29 +256,28 @@ class Stage1Lib( logger: Logger ) extends BaseLib{ try{ lib.runMain( _class, - dualArgs ++ singleArgs ++ Seq( - "-cp", cp // let's put cp last. It so long + dualArgs ++ singleArgs ++ ( + if(cp.isEmpty) Nil else Seq("-cp", cp) ) ++ sourceFiles.map(_.toString), zinc.classLoader(classLoaderCache) ) } catch { - case e: Exception => + case scala.util.control.NonFatal(e) => System.err.println(red("The Scala compiler crashed. Try running it by hand:")) System.out.println(s""" - java -cp \\ - ${zinc.classpath.strings.mkString(":\\\n")} \\ - \\ - ${_class} \\ - \\ - ${dualArgs.grouped(2).map(_.mkString(" ")).mkString(" \\\n")} \\ - \\ - ${singleArgs.mkString(" \\\n")} \\ - \\ - -cp \\ - ${classpath.strings.mkString(":\\\n")} \\ - \\ - ${sourceFiles.sorted.mkString(" \\\n")} - """ +java -cp \\ +${zinc.classpath.strings.mkString(":\\\n")} \\ +\\ +${_class} \\ +\\ +${dualArgs.grouped(2).map(_.mkString(" ")).mkString(" \\\n")} \\ +\\ +${singleArgs.mkString(" \\\n")} \\ +\\ +${if(cp.isEmpty) "" else (" -classpath \\\n" ++ classpath.strings.mkString(":\\\n"))} \\ +\\ +${sourceFiles.sorted.mkString(" \\\n")} +""" ) redirectOutToErr( e.printStackTrace ) |