OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 library rasta.rastask; | 5 library rasta.rastask; |
6 | 6 |
7 import 'dart:async' show | 7 import 'dart:async' show |
8 Future; | 8 Future; |
9 | 9 |
10 import 'dart:io' show | 10 import 'dart:io' show |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 111 |
112 Iterable<ir.Procedure> mainMethods = library.procedures.where( | 112 Iterable<ir.Procedure> mainMethods = library.procedures.where( |
113 (ir.Procedure function) => function.name.name == "main"); | 113 (ir.Procedure function) => function.name.name == "main"); |
114 ir.Program program = | 114 ir.Program program = |
115 new ir.Program(kernel.libraryDependencies(options.input)); | 115 new ir.Program(kernel.libraryDependencies(options.input)); |
116 | 116 |
117 if (mainMethods.isNotEmpty) { | 117 if (mainMethods.isNotEmpty) { |
118 program.mainMethod = mainMethods.single; | 118 program.mainMethod = mainMethods.single; |
119 } | 119 } |
120 compiler.printVerboseTimings(setupDuration); | 120 compiler.printVerboseTimings(setupDuration); |
121 if (options.output != null) { | 121 if (!options.noOutput) { |
122 await openWrite(options.output, (IOSink sink) { | 122 if (options.output != null) { |
123 BinaryPrinter printer = new BinaryPrinter(sink); | 123 await openWrite(options.output, (IOSink sink) { |
124 printer.writeProgramFile(program); | 124 BinaryPrinter printer = new BinaryPrinter(sink); |
125 }); | 125 printer.writeProgramFile(program); |
126 } else { | 126 }); |
127 StringBuffer buffer = new StringBuffer(); | |
128 Printer printer = new Printer(buffer); | |
129 if (generateLibrary) { | |
130 printer.writeLibraryFile(library); | |
131 } else { | 127 } else { |
132 printer.writeProgramFile(program); | 128 StringBuffer buffer = new StringBuffer(); |
| 129 Printer printer = new Printer(buffer); |
| 130 if (generateLibrary) { |
| 131 printer.writeLibraryFile(library); |
| 132 } else { |
| 133 printer.writeProgramFile(program); |
| 134 } |
| 135 print("$buffer"); |
133 } | 136 } |
134 print("$buffer"); | |
135 } | 137 } |
136 | 138 |
137 if (options.dependenciesFile != null) { | 139 if (options.dependenciesFile != null) { |
138 await openWrite(options.dependenciesFile, (IOSink sink) { | 140 await openWrite(options.dependenciesFile, (IOSink sink) { |
139 void writeCompilationUnit(CompilationUnitElement unit) { | 141 void writeCompilationUnit(CompilationUnitElement unit) { |
140 sink.write("${unit.script.resourceUri}\n"); | 142 sink.write("${unit.script.resourceUri}\n"); |
141 } | 143 } |
142 kernel.forEachLibraryElement((LibraryElement library) { | 144 kernel.forEachLibraryElement((LibraryElement library) { |
143 library.compilationUnits.forEach(writeCompilationUnit); | 145 library.compilationUnits.forEach(writeCompilationUnit); |
144 }); | 146 }); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 Rastask task; | 186 Rastask task; |
185 if (options.isBatch) { | 187 if (options.isBatch) { |
186 task = new RunBatch(compiler, wallClock, options); | 188 task = new RunBatch(compiler, wallClock, options); |
187 } else { | 189 } else { |
188 task = new RunSingle(compiler, wallClock, options); | 190 task = new RunSingle(compiler, wallClock, options); |
189 } | 191 } |
190 compiler.tasks.add(task); | 192 compiler.tasks.add(task); |
191 return task; | 193 return task; |
192 } | 194 } |
193 } | 195 } |
OLD | NEW |