| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 var vmArgs = []; | 98 var vmArgs = []; |
| 99 | 99 |
| 100 // Run in checked mode. | 100 // Run in checked mode. |
| 101 if (checked) vmArgs.add("--checked"); | 101 if (checked) vmArgs.add("--checked"); |
| 102 | 102 |
| 103 var executableUrl = await _executableUrl( | 103 var executableUrl = await _executableUrl( |
| 104 entrypoint, package, executable, isGlobal: isGlobal, mode: mode); | 104 entrypoint, package, executable, isGlobal: isGlobal, mode: mode); |
| 105 | 105 |
| 106 if (executableUrl == null) { | 106 if (executableUrl == null) { |
| 107 var message = "Could not find ${log.bold(executable)}"; | 107 var message = "Could not find ${log.bold(executable)}"; |
| 108 if (package != entrypoint.root.name) { | 108 if (isGlobal || package != entrypoint.root.name) { |
| 109 message += " in package ${log.bold(package)}"; | 109 message += " in package ${log.bold(package)}"; |
| 110 } | 110 } |
| 111 log.error("$message."); | 111 log.error("$message."); |
| 112 return exit_codes.NO_INPUT; | 112 return exit_codes.NO_INPUT; |
| 113 } | 113 } |
| 114 | 114 |
| 115 // If we're running an executable directly from the filesystem, make sure that | 115 // If we're running an executable directly from the filesystem, make sure that |
| 116 // it knows where to load the packages. If it's a dependency's executable, for | 116 // it knows where to load the packages. If it's a dependency's executable, for |
| 117 // example, it may not have the right packages directory itself. | 117 // example, it may not have the right packages directory itself. |
| 118 // | 118 // |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 Future<int> _runCachedExecutable(Entrypoint entrypoint, String snapshotPath, | 284 Future<int> _runCachedExecutable(Entrypoint entrypoint, String snapshotPath, |
| 285 List<String> args, {bool checked: false}) { | 285 List<String> args, {bool checked: false}) { |
| 286 return runSnapshot(snapshotPath, args, | 286 return runSnapshot(snapshotPath, args, |
| 287 packagesFile: entrypoint.packagesFile, | 287 packagesFile: entrypoint.packagesFile, |
| 288 checked: checked, | 288 checked: checked, |
| 289 recompile: () { | 289 recompile: () { |
| 290 log.fine("Precompiled executable is out of date."); | 290 log.fine("Precompiled executable is out of date."); |
| 291 return entrypoint.precompileExecutables(); | 291 return entrypoint.precompileExecutables(); |
| 292 }); | 292 }); |
| 293 } | 293 } |
| OLD | NEW |