OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library pub.executable; | 5 library pub.executable; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 | 9 |
10 import 'package:barback/barback.dart'; | 10 import 'package:barback/barback.dart'; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // If we're running an executable directly from the filesystem, make sure that | 113 // If we're running an executable directly from the filesystem, make sure that |
114 // it knows where to load the packages. If it's a dependency's executable, for | 114 // it knows where to load the packages. If it's a dependency's executable, for |
115 // example, it may not have the right packages directory itself. | 115 // example, it may not have the right packages directory itself. |
116 if (executableUrl.scheme == 'file' || executableUrl.scheme == '') { | 116 if (executableUrl.scheme == 'file' || executableUrl.scheme == '') { |
117 // TODO(nweiz): use a .packages file once sdk#23369 is fixed. | 117 // TODO(nweiz): use a .packages file once sdk#23369 is fixed. |
118 | 118 |
119 // We use an absolute path here not because the VM insists but because it's | 119 // We use an absolute path here not because the VM insists but because it's |
120 // helpful for the subprocess to be able to spawn Dart with | 120 // helpful for the subprocess to be able to spawn Dart with |
121 // Platform.executableArguments and have that work regardless of the working | 121 // Platform.executableArguments and have that work regardless of the working |
122 // directory. | 122 // directory. |
123 vmArgs.add('--package-root=${p.toUri(p.absolute(entrypoint.packagesDir))}'); | 123 vmArgs.add('--packages=${p.toUri(p.absolute(entrypoint.packagesFile))}'); |
124 } | 124 } |
125 | 125 |
126 vmArgs.add(executableUrl.toString()); | 126 vmArgs.add(executableUrl.toString()); |
127 vmArgs.addAll(args); | 127 vmArgs.addAll(args); |
128 | 128 |
129 var process = await Process.start(Platform.executable, vmArgs); | 129 var process = await Process.start(Platform.executable, vmArgs); |
130 | 130 |
131 _forwardSignals(process); | 131 _forwardSignals(process); |
132 | 132 |
133 // Note: we're not using process.std___.pipe(std___) here because | 133 // Note: we're not using process.std___.pipe(std___) here because |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 } | 267 } |
268 | 268 |
269 /// Runs the executable snapshot at [snapshotPath]. | 269 /// Runs the executable snapshot at [snapshotPath]. |
270 Future<int> _runCachedExecutable(Entrypoint entrypoint, String snapshotPath, | 270 Future<int> _runCachedExecutable(Entrypoint entrypoint, String snapshotPath, |
271 List<String> args) { | 271 List<String> args) { |
272 return runSnapshot(snapshotPath, args, checked: true, recompile: () { | 272 return runSnapshot(snapshotPath, args, checked: true, recompile: () { |
273 log.fine("Precompiled executable is out of date."); | 273 log.fine("Precompiled executable is out of date."); |
274 return entrypoint.precompileExecutables(); | 274 return entrypoint.precompileExecutables(); |
275 }); | 275 }); |
276 } | 276 } |
OLD | NEW |