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

Side by Side Diff: utils/pub/validator.dart

Issue 11785028: Commit Martin's patch for pub + lib_v2. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise. Created 7 years, 11 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
« no previous file with comments | « utils/pub/oauth2.dart ('k') | utils/pub/validator/dependency.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 validator; 5 library validator;
6 6
7 import 'entrypoint.dart'; 7 import 'entrypoint.dart';
8 import 'log.dart' as log; 8 import 'log.dart' as log;
9 import 'io.dart'; 9 import 'io.dart';
10 import 'system_cache.dart'; 10 import 'system_cache.dart';
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 new LicenseValidator(entrypoint), 47 new LicenseValidator(entrypoint),
48 new NameValidator(entrypoint), 48 new NameValidator(entrypoint),
49 new PubspecFieldValidator(entrypoint), 49 new PubspecFieldValidator(entrypoint),
50 new DependencyValidator(entrypoint), 50 new DependencyValidator(entrypoint),
51 new DirectoryValidator(entrypoint) 51 new DirectoryValidator(entrypoint)
52 ]; 52 ];
53 53
54 // TODO(nweiz): The sleep 0 here forces us to go async. This works around 54 // TODO(nweiz): The sleep 0 here forces us to go async. This works around
55 // 3356, which causes a bug if all validators are (synchronously) using 55 // 3356, which causes a bug if all validators are (synchronously) using
56 // Future.immediate and an error is thrown before a handler is set up. 56 // Future.immediate and an error is thrown before a handler is set up.
57 return sleep(0).chain((_) { 57 return sleep(0).then((_) {
58 return Futures.wait( 58 return Futures.wait(
59 validators.mappedBy((validator) => validator.validate())); 59 validators.mappedBy((validator) => validator.validate()));
60 }).then((_) { 60 }).then((_) {
61 var errors = 61 var errors =
62 flatten(validators.mappedBy((validator) => validator.errors)); 62 flatten(validators.mappedBy((validator) => validator.errors));
63 var warnings = 63 var warnings =
64 flatten(validators.mappedBy((validator) => validator.warnings)); 64 flatten(validators.mappedBy((validator) => validator.warnings));
65 65
66 if (!errors.isEmpty) { 66 if (!errors.isEmpty) {
67 log.error("Missing requirements:"); 67 log.error("Missing requirements:");
68 for (var error in errors) { 68 for (var error in errors) {
69 log.error("* ${Strings.join(error.split('\n'), '\n ')}"); 69 log.error("* ${Strings.join(error.split('\n'), '\n ')}");
70 } 70 }
71 log.error(""); 71 log.error("");
72 } 72 }
73 73
74 if (!warnings.isEmpty) { 74 if (!warnings.isEmpty) {
75 log.warning("Suggestions:"); 75 log.warning("Suggestions:");
76 for (var warning in warnings) { 76 for (var warning in warnings) {
77 log.warning("* ${Strings.join(warning.split('\n'), '\n ')}"); 77 log.warning("* ${Strings.join(warning.split('\n'), '\n ')}");
78 } 78 }
79 log.warning(""); 79 log.warning("");
80 } 80 }
81 81
82 return new Pair<List<String>, List<String>>(errors, warnings); 82 return new Pair<List<String>, List<String>>(errors, warnings);
83 }); 83 });
84 } 84 }
85 } 85 }
OLDNEW
« no previous file with comments | « utils/pub/oauth2.dart ('k') | utils/pub/validator/dependency.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698