OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 /// A library for compiling Dart code and manipulating analyzer parse trees. | 5 /// A library for compiling Dart code and manipulating analyzer parse trees. |
6 library pub.dart; | 6 library pub.dart; |
7 | 7 |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'dart:io'; | 9 import 'dart:io'; |
10 import 'dart:isolate'; | 10 import 'dart:isolate'; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 } | 94 } |
95 | 95 |
96 if (environment == null) environment = {}; | 96 if (environment == null) environment = {}; |
97 if (commandLineOptions != null) options.addAll(commandLineOptions); | 97 if (commandLineOptions != null) options.addAll(commandLineOptions); |
98 | 98 |
99 if (packageRoot == null) { | 99 if (packageRoot == null) { |
100 packageRoot = path.join(path.dirname(entrypoint), 'packages'); | 100 packageRoot = path.join(path.dirname(entrypoint), 'packages'); |
101 } | 101 } |
102 | 102 |
103 return compiler.compile( | 103 return compiler.compile( |
104 path.toUri(entrypoint), | 104 path.toUri(path.absolute(entrypoint)), |
105 provider.libraryRoot, | 105 provider.libraryRoot, |
106 path.toUri(appendSlash(packageRoot)), | 106 path.toUri(appendSlash(path.absolute(packageRoot))), |
107 provider.provideInput, | 107 provider.provideInput, |
108 provider.handleDiagnostic, | 108 provider.handleDiagnostic, |
109 options, | 109 options, |
110 provider.provideOutput, | 110 provider.provideOutput, |
111 environment); | 111 environment); |
112 }); | 112 }); |
113 } | 113 } |
114 | 114 |
115 /// Returns whether [dart] looks like an entrypoint file. | 115 /// Returns whether [dart] looks like an entrypoint file. |
116 bool isEntrypoint(CompilationUnit dart) { | 116 bool isEntrypoint(CompilationUnit dart) { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 Isolate.spawnUri(Uri.parse(message['uri']), [], message['message'], | 215 Isolate.spawnUri(Uri.parse(message['uri']), [], message['message'], |
216 packageRoot: packageRoot) | 216 packageRoot: packageRoot) |
217 .then((_) => replyTo.send({'type': 'success'})) | 217 .then((_) => replyTo.send({'type': 'success'})) |
218 .catchError((e, stack) { | 218 .catchError((e, stack) { |
219 replyTo.send({ | 219 replyTo.send({ |
220 'type': 'error', | 220 'type': 'error', |
221 'error': CrossIsolateException.serialize(e, stack) | 221 'error': CrossIsolateException.serialize(e, stack) |
222 }); | 222 }); |
223 }); | 223 }); |
224 } | 224 } |
OLD | NEW |