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.rastak; | 5 library rasta.rastak; |
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 |
11 File, | 11 File, |
12 IOSink; | 12 IOSink; |
13 | 13 |
| 14 import 'dart:isolate' show |
| 15 Isolate; |
| 16 |
14 import 'package:compiler/src/common/tasks.dart' show | 17 import 'package:compiler/src/common/tasks.dart' show |
15 CompilerTask; | 18 CompilerTask; |
16 | 19 |
17 import 'package:compiler/src/elements/elements.dart' show | 20 import 'package:compiler/src/elements/elements.dart' show |
18 CompilationUnitElement, | 21 CompilationUnitElement, |
19 LibraryElement; | 22 LibraryElement; |
20 | 23 |
21 import 'package:kernel/ast.dart' as ir; | 24 import 'package:kernel/ast.dart' as ir; |
22 | 25 |
23 import 'package:kernel/binary/ast_to_binary.dart' show | 26 import 'package:kernel/binary/ast_to_binary.dart' show |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 await sink.close(); | 124 await sink.close(); |
122 } | 125 } |
123 print("Wrote $uri"); | 126 print("Wrote $uri"); |
124 } | 127 } |
125 | 128 |
126 Future<Null> main(List<String> arguments, isolateArgument) async { | 129 Future<Null> main(List<String> arguments, isolateArgument) async { |
127 Stopwatch wallClock = new Stopwatch()..start(); | 130 Stopwatch wallClock = new Stopwatch()..start(); |
128 Options options = new OptionParser().parse(arguments, Uri.base); | 131 Options options = new OptionParser().parse(arguments, Uri.base); |
129 List<String> compilerOptions = | 132 List<String> compilerOptions = |
130 options.isVerbose ? <String>['--verbose'] : <String>[]; | 133 options.isVerbose ? <String>['--verbose'] : <String>[]; |
| 134 Uri script = await Isolate.resolvePackageUri( |
| 135 Uri.parse("package:rasta/src/rastak.dart")); |
| 136 Uri targetSpecification = Uri.base.resolveUri(script) |
| 137 .resolve("../../dart_vm_standalone.json"); |
131 IoCompilerFactory factory = new IoCompilerFactory( | 138 IoCompilerFactory factory = new IoCompilerFactory( |
132 Uri.base.resolve("dart_vm_standalone.json"), compilerOptions, | 139 targetSpecification, compilerOptions, <String, dynamic>{}); |
133 <String, dynamic>{}); | |
134 (await factory.diagnostics) | 140 (await factory.diagnostics) |
135 ..verbose = options.isVerbose | 141 ..verbose = options.isVerbose |
136 ..showWarnings = true | 142 ..showWarnings = true |
137 ..throwOnError = true | 143 ..throwOnError = true |
138 ..throwOnErrorCount = 1; | 144 ..throwOnErrorCount = 1; |
139 | 145 |
140 CustomCompiler compiler = await factory.compiler; | 146 CustomCompiler compiler = await factory.compiler; |
141 Rastask task = new Rastask(compiler); | 147 Rastask task = new Rastask(compiler); |
142 compiler.tasks.add(task); | 148 compiler.tasks.add(task); |
143 | 149 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 await openWrite(options.dependenciesFile, (IOSink sink) { | 205 await openWrite(options.dependenciesFile, (IOSink sink) { |
200 void writeCompilationUnit(CompilationUnitElement unit) { | 206 void writeCompilationUnit(CompilationUnitElement unit) { |
201 sink.write("${unit.script.resourceUri}\n"); | 207 sink.write("${unit.script.resourceUri}\n"); |
202 } | 208 } |
203 kernel.forEachLibraryElement((LibraryElement library) { | 209 kernel.forEachLibraryElement((LibraryElement library) { |
204 library.compilationUnits.forEach(writeCompilationUnit); | 210 library.compilationUnits.forEach(writeCompilationUnit); |
205 }); | 211 }); |
206 }); | 212 }); |
207 } | 213 } |
208 } | 214 } |
OLD | NEW |