diff options
-rw-r--r-- | sources/scala/tools/nsc/ant/NSC.scala | 822 |
1 files changed, 409 insertions, 413 deletions
diff --git a/sources/scala/tools/nsc/ant/NSC.scala b/sources/scala/tools/nsc/ant/NSC.scala index 4f7bd6969e..1fdaa249b7 100644 --- a/sources/scala/tools/nsc/ant/NSC.scala +++ b/sources/scala/tools/nsc/ant/NSC.scala @@ -65,392 +65,376 @@ package scala.tools.nsc.ant { */ class NSC extends MatchingTask { - private val SCALA_PRODUCT: String = - System.getProperty("scala.product", "Scalac Ant compiler"); - private val SCALA_VERSION: String = - System.getProperty("scala.version", "Unknown version"); - - /** The unique Ant file utilities instance to use in this task. */ - private val fileUtils = FileUtils.newFileUtils(); - - // ################################################################### - // ##### Ant Properties ##### - // ################################################################### - - abstract class PermissibleValue { - val values: List[String]; - def isPermissible (value: String): Boolean = (value == "") || values.exists(v:String=>(v.compareToIgnoreCase(value) == 0)); - } - - /** Defines valid values for the logging property. */ - object LoggingLevel extends PermissibleValue { - val values = List("none", "verbose", "debug"); - } - - /** Defines valid values for properties that refer to compiler phases. */ - object CompilerPhase extends PermissibleValue { - val values = List("namer", "typer", "pickler", "uncurry", "tailcalls", "transmatch", "explicitouter", "erasure", "lambdalift", "flatten", "constructors", "mixin", "icode", "jvm"); - } - - /** The directories that contain source files to compile. */ - private var origin: Option[Path] = None; - /** The directory to put the compiled files in. */ - private var destination: Option[File] = None; - - /** The class path to use for this compilation. */ - private var classpath: Option[Path] = None; - /** The source path to use for this compilation. */ - private var sourcepath: Option[Path] = None; - /** The boot class path to use for this compilation. */ - private var bootclasspath: Option[Path] = None; - /** The external extensions path to use for this compilation. */ - private var extpath: Option[Path] = None; - - /** The text encoding of the files to compile. */ - private var encoding: Option[String] = None; - - /** How much logging output to print. Either none (default), verbose or debug. */ - private var logging: Option[String] = None; - /** Whether to use implicit predefined values or not. */ - private var usepredefs: Boolean = true; - /** Whether to implicitly import or not. */ - private var useimports: Boolean = true; - /** Whether to force compilation of all files or not. */ - private var force: Boolean = false; - /** After which phase the compilation should stop. */ - private var stop: Option[String] = None; - /** Which compilation phases should be skipped during compilation. */ - private var skip: List[String] = Nil; - /** Which compilation phases results should be checked for consistency. */ - private var check: List[String] = Nil; - - // ################################################################### - // ##### Properties setters ##### - // ################################################################### - - /** - * Sets the srcdir attribute. Used by Ant. - * @param input The value of <code>origin</code>. - */ - def setSrcdir (input: Path) = { - if (origin.isEmpty) { - origin = Some(input); - } else { - origin.get.append(input); - } - } - - /** - * Sets the <code>origin</code> as a nested src Ant parameter. - * @return An origin path to be configured. - */ - def createSrc (): Path = { - if (origin.isEmpty) { - origin = Some(new Path(getProject())); - } - origin.get.createPath(); - } - - /** - * Sets the <code>origin</code> as an external reference Ant parameter. - * @param input A reference to an origin path. - */ - def setSrcref (input: Reference) = { - createSrc().setRefid(input); - } - - /** - * Gets the value of the origin attribute in a Scala-friendly form. - * @returns The origin path as a list of files. - */ - private def getOrigin: List[File] = { - if (origin.isEmpty) - throw new ArrayIndexOutOfBoundsException("Member 'origin' is empty."); - else List.fromArray(origin.get.list()).map(nameToFile("src")); - } - - /** - * Sets the destdir attribute. Used by Ant. - * @param input The value of <code>destination</code>. - */ - def setDestdir (input: File) = { - destination = Some(input); - } - - /** - * Gets the value of the destination attribute in a Scala-friendly form. - * @returns The destination as a file. - */ - private def getDestination: File = { - if (destination.isEmpty) - throw new ArrayIndexOutOfBoundsException("Member 'destination' is empty."); - else testReadableFile("destdir")(getProject().resolveFile(destination.get.toString())); - } - - /** - * Sets the classpath attribute. Used by Ant. - * @param input The value of <code>classpath</code>. - */ - def setClasspath (input: Path) = { - if (classpath.isEmpty) { - classpath = Some(input); - } else { - classpath.get.append(input); - } - } - - /** - * Sets the <code>classpath</code> as a nested classpath Ant parameter. - * @return A class path to be configured. - */ - def createClasspath (): Path = { - if (classpath.isEmpty) { - classpath = Some(new Path(getProject())); - } - classpath.get.createPath(); - } - - /** - * Sets the <code>classpath</code> as an external reference Ant parameter. - * @param input A reference to a class path. - */ - def setClasspathref (input: Reference) = { - createClasspath().setRefid(input); - } - - /** - * Gets the value of the classpath attribute in a Scala-friendly form. - * @returns The class path as a list of files. - */ - private def getClasspath: List[File] = { - if (classpath.isEmpty) - throw new ArrayIndexOutOfBoundsException("Member 'classpath' is empty."); - else List.fromArray(classpath.get.list()).map(nameToFile("classpath")); - } - - /** - * Sets the sourcepath attribute. Used by Ant. - * @param input The value of <code>sourcepath</code>. - */ - def setSourcepath (input: Path) = { - if (sourcepath.isEmpty) { - sourcepath = Some(input); - } else { - sourcepath.get.append(input); - } - } - - /** - * Sets the <code>sourcepath</code> as a nested sourcepath Ant parameter. - * @return A source path to be configured. - */ - def createSourcepath (): Path = { - if (sourcepath.isEmpty) { - sourcepath = Some(new Path(getProject())); - } - sourcepath.get.createPath(); - } - - /** - * Sets the <code>sourcepath</code> as an external reference Ant parameter. - * @param input A reference to a source path. - */ - def setSourcepathref (input: Reference) = { - createSourcepath().setRefid(input); - } - - /** - * Gets the value of the sourcepath attribute in a Scala-friendly form. - * @returns The source path as a list of files. - */ - private def getSourcepath: List[File] = { - if (sourcepath.isEmpty) - throw new ArrayIndexOutOfBoundsException("Member 'sourcepath' is empty."); - else List.fromArray(sourcepath.get.list()).map(nameToFile("sourcepath")); - } - - /** - * Sets the boot classpath attribute. Used by Ant. - * @param input The value of <code>bootclasspath</code>. - */ - def setBootclasspath (input: Path) = { - if (bootclasspath.isEmpty) { - bootclasspath = Some(input); - } else { - bootclasspath.get.append(input); - } - } - - /** - * Sets the <code>bootclasspath</code> as a nested sourcepath Ant parameter. - * @return A source path to be configured. - */ - def createBootclasspath (): Path = { - if (bootclasspath.isEmpty) { - bootclasspath = Some(new Path(getProject())); - } - bootclasspath.get.createPath(); - } - - /** - * Sets the <code>bootclasspath</code> as an external reference Ant parameter. - * @param input A reference to a source path. - */ - def setBootclasspathref (input: Reference) = { - createBootclasspath().setRefid(input); - } - - /** - * Gets the value of the bootclasspath attribute in a Scala-friendly form. - * @returns The boot class path as a list of files. - */ - private def getBootclasspath: List[File] = { - if (bootclasspath.isEmpty) - throw new ArrayIndexOutOfBoundsException("Member 'bootclasspath' is empty."); - else List.fromArray(bootclasspath.get.list()).map(nameToFile("bootclasspath")); - } - - /** - * Sets the external extensions path attribute. Used by Ant. - * @param input The value of <code>extpath</code>. - */ - def setExtdirs (input: Path) = { - if (extpath.isEmpty) { - extpath = Some(input); - } else { - extpath.get.append(input); - } - } - - /** - * Sets the <code>extpath</code> as a nested sourcepath Ant parameter. - * @return An extensions path to be configured. - */ - def createExtdirs (): Path = { - if (extpath.isEmpty) { - extpath = Some(new Path(getProject())); - } - extpath.get.createPath(); - } - - /** - * Sets the <code>extpath</code> as an external reference Ant parameter. - * @param input A reference to an extensions path. - */ - def setExtdirsref (input: Reference) = { - createExtdirs().setRefid(input); - } - - /** - * Gets the value of the extpath attribute in a Scala-friendly form. - * @returns The extensions path as a list of files. - */ - private def getExtpath: List[File] = { - if (extpath.isEmpty) - throw new ArrayIndexOutOfBoundsException("Member 'extdirs' is empty."); - else List.fromArray(extpath.get.list()).map(nameToFile("extdirs")); - } - - /** - * Sets the encoding attribute. Used by Ant. - * @param input The value of <code>encoding</code>. - */ - def setEncoding (input: String) = { - encoding = Some(input); - } - - /** - * Sets the logging level attribute. Used by Ant. - * @param input The value for <code>logging</code>. - */ - def setLogging (input: String) = { - if (LoggingLevel.isPermissible(input)) - logging = Some(input); - else error("Logging level '" + input + "' does not exist."); - } - - /** - * Sets the use predefs attribute. Used by Ant. - * @param input The value for <code>usepredefs</code>. - */ - def setUsepredefs (input: Boolean) = { - usepredefs = input; - } - - /** - * Sets the use imports attribute. Used by Ant. - * @param input The value for <code>useimport</code>. - */ - def setUseimports (input: Boolean) = { - useimports = input; - } - - /** - * Sets the force attribute. Used by Ant. - * @param input The value for <code>force</code>. - */ - def setForce (input: Boolean) = { - force = input; - } - - /** - * Sets the force attribute. Used by Ant. - * @param input The value for <code>force</code>. - */ - def setStop (input: String) = { - if (CompilerPhase.isPermissible(input)) { - if (input != "") - stop = Some(input); - } else error("Phase '" + input + "' in stop does not exist."); - } - - /** - * Sets the force attribute. Used by Ant. - * @param input The value for <code>force</code>. - */ - def setSkip (input: String) = { - skip = List.fromArray(input.split(",")).flatMap(s:String=>{ - val st = s.trim(); - if (CompilerPhase.isPermissible(st)) (if (input != "") List(st) else Nil) - else {error("Phase '" + st + "' in skip does not exist."); Nil} - }); - } - - /** - * Sets the force attribute. Used by Ant. - * @param input The value for <code>force</code>. - */ - def setCheck (input: String) = { - check = List.fromArray(input.split(",")).flatMap(s:String=>{ - val st = s.trim(); - if (CompilerPhase.isPermissible(st)) (if (input != "") List(st) else Nil) - else {error("Phase " + st + " in check does not exist."); Nil} - }); - } - - // ################################################################### - // ##### Compilation and support methods ##### - // ################################################################### - - /** - * Creates a file from a given string. - * @param test A method to test whether the file is valid. - * @param name The path of the file as a string. - * @return The file corresponding to the provided name. - */ - private def nameToFile (test: File=>File) (name: String): File = { - test(getProject().resolveFile(name)); - } - - /** - * Creates a file from a given string. - * @param test A method to test whether the file is valid. - * @param name The path of the file as a string. - * @return The file corresponding to the provided name. - */ - private def nameToFile (test: File=>File, origin: File) (name: String): File = { - test(fileUtils.resolveFile(origin, name)); - } + private val SCALA_PRODUCT: String = + System.getProperty("scala.product", "Scalac Ant compiler"); + private val SCALA_VERSION: String = + System.getProperty("scala.version", "Unknown version"); + + /** The unique Ant file utilities instance to use in this task. */ + private val fileUtils = FileUtils.newFileUtils(); + + // ################################################################### + // ##### Ant Properties ##### + // ################################################################### + + abstract class PermissibleValue { + val values: List[String]; + def isPermissible (value: String): Boolean = + (value == "") || + values.exists(v: String => v.compareToIgnoreCase(value) == 0); + } + + /** Defines valid values for the logging property. */ + object LoggingLevel extends PermissibleValue { + val values = List("none", "verbose", "debug"); + } + + /** Defines valid values for properties that refer to compiler phases. */ + object CompilerPhase extends PermissibleValue { + val values = List( + "namer", "typer", "pickler", "uncurry", "tailcalls", + "transmatch", "explicitouter", "erasure", "lambdalift", + "flatten", "constructors", "mixin", "icode", "jvm"); + } + + /** The directories that contain source files to compile. */ + private var origin: Option[Path] = None; + /** The directory to put the compiled files in. */ + private var destination: Option[File] = None; + + /** The class path to use for this compilation. */ + private var classpath: Option[Path] = None; + /** The source path to use for this compilation. */ + private var sourcepath: Option[Path] = None; + /** The boot class path to use for this compilation. */ + private var bootclasspath: Option[Path] = None; + /** The external extensions path to use for this compilation. */ + private var extpath: Option[Path] = None; + + /** The text encoding of the files to compile. */ + private var encoding: Option[String] = None; + + /** How much logging output to print. Either none (default), verbose or debug. */ + private var logging: Option[String] = None; + /** Whether to use implicit predefined values or not. */ + private var usepredefs: Boolean = true; + /** Whether to implicitly import or not. */ + private var useimports: Boolean = true; + /** Whether to force compilation of all files or not. */ + private var force: Boolean = false; + /** After which phase the compilation should stop. */ + private var stop: Option[String] = None; + /** Which compilation phases should be skipped during compilation. */ + private var skip: List[String] = Nil; + /** Which compilation phases results should be checked for consistency. */ + private var check: List[String] = Nil; + + // ################################################################### + // ##### Properties setters ##### + // ################################################################### + + /** + * Sets the srcdir attribute. Used by Ant. + * @param input The value of <code>origin</code>. + */ + def setSrcdir (input: Path) = + if (origin.isEmpty) + origin = Some(input); + else + origin.get.append(input); + + /** + * Sets the <code>origin</code> as a nested src Ant parameter. + * @return An origin path to be configured. + */ + def createSrc (): Path = { + if (origin.isEmpty) { + origin = Some(new Path(getProject())) + } + origin.get.createPath() + } + + /** + * Sets the <code>origin</code> as an external reference Ant parameter. + * @param input A reference to an origin path. + */ + def setSrcref (input: Reference) = + createSrc().setRefid(input); + + /** + * Gets the value of the origin attribute in a Scala-friendly form. + * @returns The origin path as a list of files. + */ + private def getOrigin: List[File] = + if (origin.isEmpty) + throw new ArrayIndexOutOfBoundsException("Member 'origin' is empty."); + else + List.fromArray(origin.get.list()).map(nameToFile("src")); + + /** + * Sets the destdir attribute. Used by Ant. + * @param input The value of <code>destination</code>. + */ + def setDestdir (input: File) = + destination = Some(input); + + /** + * Gets the value of the destination attribute in a Scala-friendly form. + * @returns The destination as a file. + */ + private def getDestination: File = + if (destination.isEmpty) + throw new ArrayIndexOutOfBoundsException("Member 'destination' is empty."); + else + testReadableFile("destdir")(getProject().resolveFile(destination.get.toString())); + + /** + * Sets the classpath attribute. Used by Ant. + * @param input The value of <code>classpath</code>. + */ + def setClasspath (input: Path) = + if (classpath.isEmpty) + classpath = Some(input); + else + classpath.get.append(input); + + /** + * Sets the <code>classpath</code> as a nested classpath Ant parameter. + * @return A class path to be configured. + */ + def createClasspath (): Path = { + if (classpath.isEmpty) { + classpath = Some(new Path(getProject())) + } + classpath.get.createPath() + } + + /** + * Sets the <code>classpath</code> as an external reference Ant parameter. + * @param input A reference to a class path. + */ + def setClasspathref (input: Reference) = + createClasspath().setRefid(input); + + /** + * Gets the value of the classpath attribute in a Scala-friendly form. + * @returns The class path as a list of files. + */ + private def getClasspath: List[File] = + if (classpath.isEmpty) + throw new ArrayIndexOutOfBoundsException("Member 'classpath' is empty."); + else + List.fromArray(classpath.get.list()).map(nameToFile("classpath")); + + /** + * Sets the sourcepath attribute. Used by Ant. + * @param input The value of <code>sourcepath</code>. + */ + def setSourcepath (input: Path) = + if (sourcepath.isEmpty) + sourcepath = Some(input); + else + sourcepath.get.append(input); + + /** + * Sets the <code>sourcepath</code> as a nested sourcepath Ant parameter. + * @return A source path to be configured. + */ + def createSourcepath (): Path = { + if (sourcepath.isEmpty) { + sourcepath = Some(new Path(getProject())) + } + sourcepath.get.createPath() + } + + /** + * Sets the <code>sourcepath</code> as an external reference Ant parameter. + * @param input A reference to a source path. + */ + def setSourcepathref (input: Reference) = + createSourcepath().setRefid(input); + + /** + * Gets the value of the sourcepath attribute in a Scala-friendly form. + * @returns The source path as a list of files. + */ + private def getSourcepath: List[File] = + if (sourcepath.isEmpty) + throw new ArrayIndexOutOfBoundsException("Member 'sourcepath' is empty."); + else + List.fromArray(sourcepath.get.list()).map(nameToFile("sourcepath")); + + /** + * Sets the boot classpath attribute. Used by Ant. + * @param input The value of <code>bootclasspath</code>. + */ + def setBootclasspath (input: Path) = + if (bootclasspath.isEmpty) + bootclasspath = Some(input); + else + bootclasspath.get.append(input); + + /** + * Sets the <code>bootclasspath</code> as a nested sourcepath Ant parameter. + * @return A source path to be configured. + */ + def createBootclasspath (): Path = { + if (bootclasspath.isEmpty) { + bootclasspath = Some(new Path(getProject())) + } + bootclasspath.get.createPath() + } + + /** + * Sets the <code>bootclasspath</code> as an external reference Ant parameter. + * @param input A reference to a source path. + */ + def setBootclasspathref (input: Reference) = + createBootclasspath().setRefid(input); + + /** + * Gets the value of the bootclasspath attribute in a Scala-friendly form. + * @returns The boot class path as a list of files. + */ + private def getBootclasspath: List[File] = + if (bootclasspath.isEmpty) + throw new ArrayIndexOutOfBoundsException("Member 'bootclasspath' is empty."); + else + List.fromArray(bootclasspath.get.list()).map(nameToFile("bootclasspath")); + + /** + * Sets the external extensions path attribute. Used by Ant. + * @param input The value of <code>extpath</code>. + */ + def setExtdirs (input: Path) = + if (extpath.isEmpty) + extpath = Some(input); + else + extpath.get.append(input); + + /** + * Sets the <code>extpath</code> as a nested sourcepath Ant parameter. + * @return An extensions path to be configured. + */ + def createExtdirs (): Path = { + if (extpath.isEmpty) { + extpath = Some(new Path(getProject())) + } + extpath.get.createPath() + } + + /** + * Sets the <code>extpath</code> as an external reference Ant parameter. + * @param input A reference to an extensions path. + */ + def setExtdirsref (input: Reference) = + createExtdirs().setRefid(input); + + /** + * Gets the value of the extpath attribute in a Scala-friendly form. + * @returns The extensions path as a list of files. + */ + private def getExtpath: List[File] = + if (extpath.isEmpty) + throw new ArrayIndexOutOfBoundsException("Member 'extdirs' is empty."); + else + List.fromArray(extpath.get.list()).map(nameToFile("extdirs")); + + /** + * Sets the encoding attribute. Used by Ant. + * @param input The value of <code>encoding</code>. + */ + def setEncoding(input: String): Unit = + encoding = Some(input); + + /** + * Sets the logging level attribute. Used by Ant. + * @param input The value for <code>logging</code>. + */ + def setLogging (input: String) = + if (LoggingLevel.isPermissible(input)) + logging = Some(input); + else + error("Logging level '" + input + "' does not exist."); + + /** + * Sets the use predefs attribute. Used by Ant. + * @param input The value for <code>usepredefs</code>. + */ + def setUsepredefs (input: Boolean): Unit = + usepredefs = input; + + /** + * Sets the use imports attribute. Used by Ant. + * @param input The value for <code>useimport</code>. + */ + def setUseimports (input: Boolean): Unit = + useimports = input; + + /** + * Sets the force attribute. Used by Ant. + * @param input The value for <code>force</code>. + */ + def setForce (input: Boolean): Unit = + force = input; + + /** + * Sets the force attribute. Used by Ant. + * @param input The value for <code>force</code>. + */ + def setStop (input: String) = + if (CompilerPhase.isPermissible(input)) { + if (input != "") + stop = Some(input); + } + else + error("Phase '" + input + "' in stop does not exist."); + + /** + * Sets the force attribute. Used by Ant. + * @param input The value for <code>force</code>. + */ + def setSkip (input: String) = { + skip = List.fromArray(input.split(",")).flatMap(s: String => { + val st = s.trim(); + if (CompilerPhase.isPermissible(st)) (if (input != "") List(st) else Nil) + else {error("Phase '" + st + "' in skip does not exist."); Nil} + }); + } + + /** + * Sets the force attribute. Used by Ant. + * @param input The value for <code>force</code>. + */ + def setCheck (input: String) = { + check = List.fromArray(input.split(",")).flatMap(s: String => { + val st = s.trim(); + if (CompilerPhase.isPermissible(st)) (if (input != "") List(st) else Nil) + else {error("Phase " + st + " in check does not exist."); Nil} + }); + } + + // ################################################################### + // ##### Compilation and support methods ##### + // ################################################################### + + /** + * Creates a file from a given string. + * @param test A method to test whether the file is valid. + * @param name The path of the file as a string. + * @return The file corresponding to the provided name. + */ + private def nameToFile(test: File=>File) (name: String): File = + test(getProject().resolveFile(name)); + + /** + * Creates a file from a given string. + * @param test A method to test whether the file is valid. + * @param name The path of the file as a string. + * @return The file corresponding to the provided name. + */ + private def nameToFile (test: File=>File, origin: File) (name: String): File = + test(fileUtils.resolveFile(origin, name)); /** * Creates a file from a given string and tests its validity using the <code>testReadableFile</code> method. @@ -537,23 +521,26 @@ package scala.tools.nsc.ant { // If force is false, only files were the .class file in destination is older than // the .scala file will be used. val sourceFiles: List[File] = - for (val originDir <- getOrigin; - val originFile <- { - var includedFiles = getDirectoryScanner(originDir).getIncludedFiles(); - if (!force) { - includedFiles = new SourceFileScanner(this).restrict(includedFiles, originDir, destination.get, mapper) - } - (List.fromArray(includedFiles)).map(nameToFile("srcdir", originDir)) - } - ) yield { - log(originFile.toString(), Project.MSG_VERBOSE); - originFile - } + for (val originDir <- getOrigin; + val originFile <- { + var includedFiles = getDirectoryScanner(originDir).getIncludedFiles(); + if (!force) { + includedFiles = new SourceFileScanner(this) + .restrict(includedFiles, originDir, destination.get, mapper) + } + (List.fromArray(includedFiles)).map(nameToFile("srcdir", originDir)) + } + ) yield { + log(originFile.toString(), Project.MSG_VERBOSE); + originFile + } if (sourceFiles.length == 0) log("No files selected for compilation") else - log("Compiling " + sourceFiles.length + " source file" + (if (sourceFiles.length == 1) "s" else "") + (" to " + getDestination.toString())); + log("Compiling " + sourceFiles.length + " source file" + + (if (sourceFiles.length > 1) "s" else "") + + (" to " + getDestination.toString())); System.setProperty("scala.library.class.path", ""); System.setProperty("scala.library.source.path", ""); @@ -568,10 +555,11 @@ package scala.tools.nsc.ant { if (!extpath.isEmpty) settings.extdirs.value = asString(getExtpath); if (!encoding.isEmpty) settings.encoding.value = encoding.get; if (!logging.isEmpty && logging.get == "verbose") { - settings.verbose.value = true; - } else if (!logging.isEmpty && logging.get == "debug") { - settings.verbose.value = true; - settings.debug.value = true; + settings.verbose.value = true; + } + else if (!logging.isEmpty && logging.get == "debug") { + settings.verbose.value = true; + settings.debug.value = true; } settings.noimports.value = !useimports; settings.nopredefs.value = !usepredefs; @@ -587,20 +575,28 @@ package scala.tools.nsc.ant { // Compiles the actual code val compiler = new Global(settings, reporter); try { - (new compiler.Run).compile(sourceFiles.map(f:File=>f.toString())); - if (reporter.errors() > 0) - error("Compile failed with " + reporter.errors() + " error" + (if (reporter.errors() == 1) "" else "s") + "; see the compiler error output for details."); - } catch { - case exception @ FatalError(msg) => { - if (settings.debug.value) exception.printStackTrace(); - error("Compile failed because of an internal compiler error (" + msg + "); see the error output for details."); - } + (new compiler.Run).compile(sourceFiles.map(f:File=>f.toString())); + if (reporter.errors() > 0) + error("Compile failed with " + + reporter.errors() + " error" + + (if (reporter.errors() > 1) "s" else "") + + "; see the compiler error output for details."); + } + catch { + case exception @ FatalError(msg) => { + if (settings.debug.value) exception.printStackTrace(); + error("Compile failed because of an internal compiler error (" + + msg + "); see the error output for details."); + } } if (reporter.warnings() > 0) - log("Compile suceeded with " + reporter.errors() + " warning" + (if (reporter.warnings() == 1) "" else "s") + "; see the compiler output for details."); + log("Compile suceeded with " + + reporter.errors() + " warning" + + (if (reporter.warnings() > 1) "s" else "") + + "; see the compiler output for details."); reporter.printSummary() } } -}
\ No newline at end of file +} |