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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // Ensure that there's a trailing extension. | 75 // Ensure that there's a trailing extension. |
76 if (p.extension(executable) != ".dart") executable += ".dart"; | 76 if (p.extension(executable) != ".dart") executable += ".dart"; |
77 | 77 |
78 var localSnapshotPath = p.join(".pub", "bin", package, | 78 var localSnapshotPath = p.join(".pub", "bin", package, |
79 "$executable.snapshot"); | 79 "$executable.snapshot"); |
80 if (!isGlobal && fileExists(localSnapshotPath) && | 80 if (!isGlobal && fileExists(localSnapshotPath) && |
81 // Dependencies are only snapshotted in release mode, since that's the | 81 // Dependencies are only snapshotted in release mode, since that's the |
82 // default mode for them to run. We can't run them in a different mode | 82 // default mode for them to run. We can't run them in a different mode |
83 // using the snapshot. | 83 // using the snapshot. |
84 mode == BarbackMode.RELEASE) { | 84 mode == BarbackMode.RELEASE) { |
| 85 // Since we don't access the package graph, this doesn't happen |
| 86 // automatically. |
| 87 entrypoint.assertUpToDate(); |
| 88 |
85 return _runCachedExecutable(entrypoint, localSnapshotPath, args, | 89 return _runCachedExecutable(entrypoint, localSnapshotPath, args, |
86 checked: checked); | 90 checked: checked); |
87 } | 91 } |
88 | 92 |
89 // If the command has a path separator, then it's a path relative to the | 93 // If the command has a path separator, then it's a path relative to the |
90 // root of the package. Otherwise, it's implicitly understood to be in | 94 // root of the package. Otherwise, it's implicitly understood to be in |
91 // "bin". | 95 // "bin". |
92 if (p.split(executable).length == 1) executable = p.join("bin", executable); | 96 if (p.split(executable).length == 1) executable = p.join("bin", executable); |
93 | 97 |
94 var vmArgs = []; | 98 var vmArgs = []; |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 Future<int> _runCachedExecutable(Entrypoint entrypoint, String snapshotPath, | 284 Future<int> _runCachedExecutable(Entrypoint entrypoint, String snapshotPath, |
281 List<String> args, {bool checked: false}) { | 285 List<String> args, {bool checked: false}) { |
282 return runSnapshot(snapshotPath, args, | 286 return runSnapshot(snapshotPath, args, |
283 packagesFile: entrypoint.packagesFile, | 287 packagesFile: entrypoint.packagesFile, |
284 checked: checked, | 288 checked: checked, |
285 recompile: () { | 289 recompile: () { |
286 log.fine("Precompiled executable is out of date."); | 290 log.fine("Precompiled executable is out of date."); |
287 return entrypoint.precompileExecutables(); | 291 return entrypoint.precompileExecutables(); |
288 }); | 292 }); |
289 } | 293 } |
OLD | NEW |