Index: dart/lib/compiler/implementation/dart2js.dart |
diff --git a/dart/lib/compiler/implementation/dart2js.dart b/dart/lib/compiler/implementation/dart2js.dart |
index 347b1bfdc15d5a65dcbb90a055ec09cd71ba0d70..63e477fb79abd620a4da8427c3d1c066b870ad56 100644 |
--- a/dart/lib/compiler/implementation/dart2js.dart |
+++ b/dart/lib/compiler/implementation/dart2js.dart |
@@ -14,6 +14,8 @@ |
#import('filenames.dart'); |
#import('util/uri_extras.dart'); |
+final String LIBRARY_ROOT = '../../../..'; |
+ |
void compile(List<String> argv) { |
Uri cwd = getCurrentDirectory(); |
bool throwOnError = false; |
@@ -134,3 +136,26 @@ void fail(String message) { |
print(message); |
exit(1); |
} |
+ |
+void compilerMain(Options options) { |
+ List<String> argv = ['--library-root=${options.script}/$LIBRARY_ROOT']; |
+ argv.addAll(options.arguments); |
+ compile(argv); |
+} |
+ |
+void main() { |
+ try { |
+ compilerMain(new Options()); |
+ } catch (var exception, var trace) { |
+ try { |
+ print('Internal error: \$exception'); |
+ } catch (var ignored) { |
+ print('Internal error: error while printing exception'); |
+ } |
+ try { |
+ print(trace); |
+ } finally { |
+ exit(253); // 253 is recognized as a crash by our test scripts. |
+ } |
+ } |
+} |