OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 package com.google.dart.runner; | 5 package com.google.dart.runner; |
6 | 6 |
7 import com.google.common.base.Joiner; | 7 import com.google.common.base.Joiner; |
8 import com.google.common.collect.Lists; | 8 import com.google.common.collect.Lists; |
9 import com.google.common.io.CharStreams; | 9 import com.google.common.io.CharStreams; |
10 import com.google.common.io.Files; | 10 import com.google.common.io.Files; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 throw new RunnerError("No script files specified on the command line: " +
Joiner.on(" ").join(args)); | 116 throw new RunnerError("No script files specified on the command line: " +
Joiner.on(" ").join(args)); |
117 } | 117 } |
118 | 118 |
119 String script = options.getSourceFiles().get(0); | 119 String script = options.getSourceFiles().get(0); |
120 ArrayList<String> scriptArguments = new ArrayList<String>(); | 120 ArrayList<String> scriptArguments = new ArrayList<String>(); |
121 | 121 |
122 LibrarySource app = new UrlLibrarySource(new File(script)); | 122 LibrarySource app = new UrlLibrarySource(new File(script)); |
123 | 123 |
124 File outFile = options.getOutputFilename(); | 124 File outFile = options.getOutputFilename(); |
125 | 125 |
126 DefaultDartCompilerListener listener = new DefaultDartCompilerListener(stder
r); | 126 DefaultDartCompilerListener listener = |
| 127 new DefaultDartCompilerListener(stderr, options.printMachineProblems()); |
127 | 128 |
128 CompilationResult compiled; | 129 CompilationResult compiled; |
129 compiled = compileApp(app, imports, options, listener); | 130 compiled = compileApp(app, imports, options, listener); |
130 | 131 |
131 if (listener.getErrorCount() != 0) { | 132 if (listener.getErrorCount() != 0) { |
132 throw new RunnerError("Compilation failed."); | 133 throw new RunnerError("Compilation failed."); |
133 } | 134 } |
134 | 135 |
135 if (outFile != null) { | 136 if (outFile != null) { |
136 File dir = outFile.getParentFile(); | 137 File dir = outFile.getParentFile(); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 Reader r = provider.getArtifactReader(app, "", backend.getAppExtension()); | 340 Reader r = provider.getArtifactReader(app, "", backend.getAppExtension()); |
340 String js = CharStreams.toString(r); | 341 String js = CharStreams.toString(r); |
341 r.close(); | 342 r.close(); |
342 return new CompilationResult(js, mapping); | 343 return new CompilationResult(js, mapping); |
343 } catch (IOException e) { | 344 } catch (IOException e) { |
344 // This can't happen; it's just a StringWriter. | 345 // This can't happen; it's just a StringWriter. |
345 throw new AssertionError(e); | 346 throw new AssertionError(e); |
346 } | 347 } |
347 } | 348 } |
348 } | 349 } |
OLD | NEW |