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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:io'; | 6 import 'dart:io'; |
7 | 7 |
8 import 'package:path/path.dart' as p; | 8 import 'package:path/path.dart' as p; |
9 import 'package:barback/barback.dart'; | 9 import 'package:barback/barback.dart'; |
10 import 'package:pub_semver/pub_semver.dart'; | 10 import 'package:pub_semver/pub_semver.dart'; |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 entrypoint = new Entrypoint.inMemory( | 314 entrypoint = new Entrypoint.inMemory( |
315 cache.load(id), lockFile, cache, isGlobal: true); | 315 cache.load(id), lockFile, cache, isGlobal: true); |
316 } else { | 316 } else { |
317 // For uncached sources (i.e. path), the ID just points to the real | 317 // For uncached sources (i.e. path), the ID just points to the real |
318 // directory for the package. | 318 // directory for the package. |
319 entrypoint = new Entrypoint( | 319 entrypoint = new Entrypoint( |
320 (id.source as PathSource).pathFromDescription(id.description), cache, | 320 (id.source as PathSource).pathFromDescription(id.description), cache, |
321 isGlobal: true); | 321 isGlobal: true); |
322 } | 322 } |
323 | 323 |
324 if (entrypoint.root.pubspec.environment.sdkVersion.allows(sdk.version)) { | 324 if (entrypoint.root.pubspec.flutterSdkConstraint != null) { |
325 return entrypoint; | 325 dataError("${log.bold(name)} ${entrypoint.root.version} requires the " |
| 326 "Flutter SDK, which is unsupported for global executables."); |
326 } | 327 } |
327 | 328 |
328 dataError("${log.bold(name)} ${entrypoint.root.version} doesn't support " | 329 if (!entrypoint.root.pubspec.dartSdkConstraint.allows(sdk.version)) { |
329 "Dart ${sdk.version}."); | 330 dataError("${log.bold(name)} ${entrypoint.root.version} doesn't support " |
| 331 "Dart ${sdk.version}."); |
| 332 } |
| 333 |
| 334 return entrypoint; |
330 } | 335 } |
331 | 336 |
332 /// Runs [package]'s [executable] with [args]. | 337 /// Runs [package]'s [executable] with [args]. |
333 /// | 338 /// |
334 /// If [executable] is available in its precompiled form, that will be | 339 /// If [executable] is available in its precompiled form, that will be |
335 /// recompiled if the SDK has been upgraded since it was first compiled and | 340 /// recompiled if the SDK has been upgraded since it was first compiled and |
336 /// then run. Otherwise, it will be run from source. | 341 /// then run. Otherwise, it will be run from source. |
337 /// | 342 /// |
338 /// If [checked] is true, the program is run in checked mode. If [mode] is | 343 /// If [checked] is true, the program is run in checked mode. If [mode] is |
339 /// passed, it's used as the barback mode; it defaults to | 344 /// passed, it's used as the barback mode; it defaults to |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 } | 796 } |
792 | 797 |
793 /// Returns the value of the property named [name] in the bin stub script | 798 /// Returns the value of the property named [name] in the bin stub script |
794 /// [source]. | 799 /// [source]. |
795 String _binStubProperty(String source, String name) { | 800 String _binStubProperty(String source, String name) { |
796 var pattern = new RegExp(quoteRegExp(name) + r": ([a-zA-Z0-9_-]+)"); | 801 var pattern = new RegExp(quoteRegExp(name) + r": ([a-zA-Z0-9_-]+)"); |
797 var match = pattern.firstMatch(source); | 802 var match = pattern.firstMatch(source); |
798 return match == null ? null : match[1]; | 803 return match == null ? null : match[1]; |
799 } | 804 } |
800 } | 805 } |
OLD | NEW |