Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1156)

Unified Diff: sdk/lib/_internal/pub_generated/lib/src/pubspec.dart

Issue 566093003: Create binstubs for executables when activating a package. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise! Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/pub_generated/lib/src/pubspec.dart
diff --git a/sdk/lib/_internal/pub_generated/lib/src/pubspec.dart b/sdk/lib/_internal/pub_generated/lib/src/pubspec.dart
index ce32ae2cbb980577b2c52da5d3b4c2b8cf79a7c5..2023486dc19a1824226a708eec88847d451c8729 100644
--- a/sdk/lib/_internal/pub_generated/lib/src/pubspec.dart
+++ b/sdk/lib/_internal/pub_generated/lib/src/pubspec.dart
@@ -171,6 +171,44 @@ class Pubspec {
}
bool _parsedPublishTo = false;
String _publishTo;
+ Map<String, String> get executables {
+ if (_executables != null) return _executables;
+ _executables = {};
+ var yaml = fields['executables'];
+ if (yaml == null) return _executables;
+ if (yaml is! Map) {
+ _error(
+ '"executables" field must be a map.',
+ fields.nodes['executables'].span);
+ }
+ yaml.nodes.forEach((key, value) {
+ validateName(name, description) {}
+ if (key.value is! String) {
+ _error('"executables" keys must be strings.', key.span);
+ }
+ final keyPattern = new RegExp(r"^[a-zA-Z0-9_-]+$");
+ if (!keyPattern.hasMatch(key.value)) {
+ _error(
+ '"executables" keys may only contain letters, '
+ 'numbers, hyphens and underscores.',
+ key.span);
+ }
+ if (value.value == null) {
+ value = key;
+ } else if (value.value is! String) {
+ _error('"executables" values must be strings or null.', value.span);
+ }
+ final valuePattern = new RegExp(r"[/\\]");
+ if (valuePattern.hasMatch(value.value)) {
+ _error(
+ '"executables" values may not contain path separators.',
+ value.span);
+ }
+ _executables[key.value] = value.value;
+ });
+ return _executables;
+ }
+ Map<String, String> _executables;
bool get isPrivate => publishTo == "none";
bool get isEmpty =>
name == null && version == Version.none && dependencies.isEmpty;

Powered by Google App Engine
This is Rietveld 408576698