| CODENOTIFIER | HelpYou are not signed inSign in |
Project: Scala
Revision: 16022
Author: phaller
Date: 04 Sep 2008 10:45:18
Diff at Trac: https://lampsvn.epfl.ch/trac/scala/changeset/16022
Changes:Fixed problem running plugin tests.
Files:| ... | ...@@ -20,7 +20,6 @@ | |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | abstract class SimpleCompiler { |
| 23 | def compile(file: File, kind: String): Boolean | |
| 24 | 23 | def compile(out: Option[File], files: List[File], kind: String, log: File): Boolean |
| 25 | 24 | } |
| 26 | 25 | |
| ... | ...@@ -93,14 +92,16 @@ | |
| 93 | 92 | val toCompile = files.map(_.getPath) |
| 94 | 93 | try { |
| 95 | 94 | NestUI.verbose("compiling "+toCompile) |
| 96 | (new global.Run) compile toCompile | |
| 95 | try { | |
| 96 | (new global.Run) compile toCompile | |
| 97 | } catch { | |
| 98 | case FatalError(msg) => | |
| 99 | testRep.error(null, "fatal error: " + msg) | |
| 100 | } | |
| 97 | 101 | testRep.printSummary |
| 98 | 102 | testRep.writer.flush |
| 99 | 103 | testRep.writer.close |
| 100 | 104 | } catch { |
| 101 | case FatalError(msg) => | |
| 102 | logWriter.write("FatalError: "+msg) | |
| 103 | return false | |
| 104 | 105 | case e: Exception => |
| 105 | 106 | e.printStackTrace() |
| 106 | 107 | return false |
| ... | ...@@ -109,37 +110,6 @@ | |
| 109 | 110 | } |
| 110 | 111 | !testRep.hasErrors |
| 111 | 112 | } |
| 112 | ||
| 113 | def compile(file: File, kind: String): Boolean = { | |
| 114 | val testSettings = newSettings | |
| 115 | val testRep = newReporter(testSettings) | |
| 116 | val args = List.fromArray(fileManager.SCALAC_OPTS.split("\\s")) | |
| 117 | val command = new CompilerCommand(args, testSettings, x => {}, false) | |
| 118 | val global = newGlobal(command.settings, testRep) | |
| 119 | ||
| 120 | val test: TestFile = kind match { | |
| 121 | case "pos" => PosTestFile(file, fileManager, true) | |
| 122 | case "neg" => NegTestFile(file, fileManager, true) | |
| 123 | case "run" => RunTestFile(file, fileManager, true) | |
| 124 | case "jvm" => JvmTestFile(file, fileManager, true) | |
| 125 | case "jvm5" => Jvm5TestFile(file, fileManager, true) | |
| 126 | case "shootout" => ShootoutTestFile(file, fileManager, true) | |
| 127 | } | |
| 128 | test.defineSettings(testSettings) | |
| 129 | ||
| 130 | val toCompile = List(file.getPath) | |
| 131 | try { | |
| 132 | (new global.Run) compile toCompile | |
| 133 | testRep.printSummary | |
| 134 | testRep.writer.flush | |
| 135 | testRep.writer.close | |
| 136 | } catch { | |
| 137 | case e: Exception => | |
| 138 | e.printStackTrace() | |
| 139 | return false | |
| 140 | } | |
| 141 | !testRep.hasErrors | |
| 142 | } | |
| 143 | 113 | } |
| 144 | 114 | |
| 145 | 115 | class ReflectiveCompiler(val fileManager: ConsoleFileManager) extends SimpleCompiler { |
| ... | ...@@ -167,17 +137,6 @@ | |
| 167 | 137 | * This exception is handled in the shouldCompile and shouldFailCompile |
| 168 | 138 | * methods of class CompileManager. |
| 169 | 139 | */ |
| 170 | def compile(file: File, kind: String): Boolean = { | |
| 171 | val fileArgs: Array[AnyRef] = Array(file, kind) | |
| 172 | val res = sepCompileMethod.invoke(sepCompiler, fileArgs: _*).asInstanceOf[java.lang.Boolean] | |
| 173 | res.booleanValue() | |
| 174 | } | |
| 175 | ||
| 176 | /* This method throws java.lang.reflect.InvocationTargetException | |
| 177 | * if the compiler crashes. | |
| 178 | * This exception is handled in the shouldCompile and shouldFailCompile | |
| 179 | * methods of class CompileManager. | |
| 180 | */ | |
| 181 | 140 | def compile(out: Option[File], files: List[File], kind: String, log: File): Boolean = { |
| 182 | 141 | val fileArgs: Array[AnyRef] = Array(out, files, kind, log) |
| 183 | 142 | val res = sepCompileMethod2.invoke(sepCompiler, fileArgs: _*).asInstanceOf[java.lang.Boolean] |