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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 = | 126 DefaultDartCompilerListener listener = |
127 new DefaultDartCompilerListener(stderr, options.printMachineProblems()); | 127 new DefaultDartCompilerListener(stderr, options.printErrorFormat()); |
128 | 128 |
129 CompilationResult compiled; | 129 CompilationResult compiled; |
130 compiled = compileApp(app, imports, options, listener); | 130 compiled = compileApp(app, imports, options, listener); |
131 | 131 |
132 if (listener.getErrorCount() != 0) { | 132 if (listener.getErrorCount() != 0) { |
133 throw new RunnerError("Compilation failed."); | 133 throw new RunnerError("Compilation failed."); |
134 } | 134 } |
135 | 135 |
136 if (outFile != null) { | 136 if (outFile != null) { |
137 File dir = outFile.getParentFile(); | 137 File dir = outFile.getParentFile(); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 Reader r = provider.getArtifactReader(app, "", backend.getAppExtension()); | 340 Reader r = provider.getArtifactReader(app, "", backend.getAppExtension()); |
341 String js = CharStreams.toString(r); | 341 String js = CharStreams.toString(r); |
342 r.close(); | 342 r.close(); |
343 return new CompilationResult(js, mapping); | 343 return new CompilationResult(js, mapping); |
344 } catch (IOException e) { | 344 } catch (IOException e) { |
345 // This can't happen; it's just a StringWriter. | 345 // This can't happen; it's just a StringWriter. |
346 throw new AssertionError(e); | 346 throw new AssertionError(e); |
347 } | 347 } |
348 } | 348 } |
349 } | 349 } |
OLD | NEW |