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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 library pub.pubspec; 1 library pub.pubspec;
2 import 'package:path/path.dart' as path; 2 import 'package:path/path.dart' as path;
3 import 'package:source_span/source_span.dart'; 3 import 'package:source_span/source_span.dart';
4 import 'package:yaml/yaml.dart'; 4 import 'package:yaml/yaml.dart';
5 import 'barback/transformer_config.dart'; 5 import 'barback/transformer_config.dart';
6 import 'exceptions.dart'; 6 import 'exceptions.dart';
7 import 'io.dart'; 7 import 'io.dart';
8 import 'package.dart'; 8 import 'package.dart';
9 import 'source_registry.dart'; 9 import 'source_registry.dart';
10 import 'utils.dart'; 10 import 'utils.dart';
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 span, 164 span,
165 () => Uri.parse(publishTo)); 165 () => Uri.parse(publishTo));
166 } 166 }
167 } 167 }
168 _parsedPublishTo = true; 168 _parsedPublishTo = true;
169 _publishTo = publishTo; 169 _publishTo = publishTo;
170 return _publishTo; 170 return _publishTo;
171 } 171 }
172 bool _parsedPublishTo = false; 172 bool _parsedPublishTo = false;
173 String _publishTo; 173 String _publishTo;
174 Map<String, String> get executables {
175 if (_executables != null) return _executables;
176 var yaml = fields['executables'];
177 if (yaml == null) {
178 _executables = {};
179 return _executables;
180 }
181 if (yaml is! Map) {
182 _error(
183 '"executables" field must be a map.',
184 fields.nodes['executables'].span);
185 }
186 yaml.nodes.forEach((key, value) {
187 validateName(name, description) {
188 final validName = new RegExp(r"^[a-zA-Z0-9_-]+$");
189 if (!validName.hasMatch(name.value)) {
190 _error(
191 '"executables" $description may only contain letters, '
192 'numbers, hyphens and underscores.',
193 name.span);
194 }
195 }
196 if (key.value is! String) {
197 _error('"executables" keys must be strings.', key.span);
198 }
199 validateName(key, "keys");
200 if (value.value == null) return;
201 if (value.value is! String) {
202 _error('"executables" values must be strings or null.', value.span);
203 }
204 validateName(value, "values");
205 });
206 _executables = yaml;
207 return _executables;
208 }
209 Map<String, String> _executables;
174 bool get isPrivate => publishTo == "none"; 210 bool get isPrivate => publishTo == "none";
175 bool get isEmpty => 211 bool get isEmpty =>
176 name == null && version == Version.none && dependencies.isEmpty; 212 name == null && version == Version.none && dependencies.isEmpty;
177 factory Pubspec.load(String packageDir, SourceRegistry sources, 213 factory Pubspec.load(String packageDir, SourceRegistry sources,
178 {String expectedName}) { 214 {String expectedName}) {
179 var pubspecPath = path.join(packageDir, 'pubspec.yaml'); 215 var pubspecPath = path.join(packageDir, 'pubspec.yaml');
180 var pubspecUri = path.toUri(pubspecPath); 216 var pubspecUri = path.toUri(pubspecPath);
181 if (!fileExists(pubspecPath)) { 217 if (!fileExists(pubspecPath)) {
182 throw new FileException( 218 throw new FileException(
183 'Could not find a file named "pubspec.yaml" in "$packageDir".', 219 'Could not find a file named "pubspec.yaml" in "$packageDir".',
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 class PubspecEnvironment { 414 class PubspecEnvironment {
379 final VersionConstraint sdkVersion; 415 final VersionConstraint sdkVersion;
380 PubspecEnvironment([VersionConstraint sdk]) 416 PubspecEnvironment([VersionConstraint sdk])
381 : sdkVersion = sdk != null ? sdk : VersionConstraint.any; 417 : sdkVersion = sdk != null ? sdk : VersionConstraint.any;
382 } 418 }
383 class PubspecException extends SourceSpanFormatException implements 419 class PubspecException extends SourceSpanFormatException implements
384 ApplicationException { 420 ApplicationException {
385 PubspecException(String message, SourceSpan span) : super(message, span); 421 PubspecException(String message, SourceSpan span) : super(message, span);
386 } 422 }
387 bool _isFileUri(Uri uri) => uri.scheme == 'file' || uri.scheme == ''; 423 bool _isFileUri(Uri uri) => uri.scheme == 'file' || uri.scheme == '';
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698