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

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

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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/utils.dart ('k') | utils/pub/validator/directory.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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
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).chain((_) {
58 return Futures.wait(validators.map((validator) => validator.validate())); 58 return Futures.wait(
59 }).transform((_) { 59 validators.mappedBy((validator) => validator.validate()));
60 var errors = flatten(validators.map((validator) => validator.errors)); 60 }).then((_) {
61 var warnings = flatten(validators.map((validator) => validator.warnings)); 61 var errors =
62 flatten(validators.mappedBy((validator) => validator.errors));
63 var warnings =
64 flatten(validators.mappedBy((validator) => validator.warnings));
62 65
63 if (!errors.isEmpty) { 66 if (!errors.isEmpty) {
64 log.error("Missing requirements:"); 67 log.error("Missing requirements:");
65 for (var error in errors) { 68 for (var error in errors) {
66 log.error("* ${Strings.join(error.split('\n'), '\n ')}"); 69 log.error("* ${Strings.join(error.split('\n'), '\n ')}");
67 } 70 }
68 log.error(""); 71 log.error("");
69 } 72 }
70 73
71 if (!warnings.isEmpty) { 74 if (!warnings.isEmpty) {
72 log.warning("Suggestions:"); 75 log.warning("Suggestions:");
73 for (var warning in warnings) { 76 for (var warning in warnings) {
74 log.warning("* ${Strings.join(warning.split('\n'), '\n ')}"); 77 log.warning("* ${Strings.join(warning.split('\n'), '\n ')}");
75 } 78 }
76 log.warning(""); 79 log.warning("");
77 } 80 }
78 81
79 return new Pair<List<String>, List<String>>(errors, warnings); 82 return new Pair<List<String>, List<String>>(errors, warnings);
80 }); 83 });
81 } 84 }
82 } 85 }
OLDNEW
« no previous file with comments | « utils/pub/utils.dart ('k') | utils/pub/validator/directory.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698