OLD | NEW |
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 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'entrypoint.dart'; | 7 import 'entrypoint.dart'; |
8 import 'log.dart' as log; | 8 import 'log.dart' as log; |
9 import 'utils.dart'; | 9 import 'utils.dart'; |
10 import 'validator/compiled_dartdoc.dart'; | 10 import 'validator/compiled_dartdoc.dart'; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 new CompiledDartdocValidator(entrypoint), | 68 new CompiledDartdocValidator(entrypoint), |
69 new Utf8ReadmeValidator(entrypoint), | 69 new Utf8ReadmeValidator(entrypoint), |
70 new SdkConstraintValidator(entrypoint) | 70 new SdkConstraintValidator(entrypoint) |
71 ]; | 71 ]; |
72 if (packageSize != null) { | 72 if (packageSize != null) { |
73 validators.add(new SizeValidator(entrypoint, packageSize)); | 73 validators.add(new SizeValidator(entrypoint, packageSize)); |
74 } | 74 } |
75 | 75 |
76 return Future.wait(validators.map((validator) => validator.validate())) | 76 return Future.wait(validators.map((validator) => validator.validate())) |
77 .then((_) { | 77 .then((_) { |
78 var errors = | 78 var errors = validators.expand((validator) => validator.errors); |
79 flatten(validators.map((validator) => validator.errors)); | 79 var warnings = validators.expand((validator) => validator.warnings); |
80 var warnings = | |
81 flatten(validators.map((validator) => validator.warnings)); | |
82 | 80 |
83 if (!errors.isEmpty) { | 81 if (!errors.isEmpty) { |
84 log.error("Missing requirements:"); | 82 log.error("Missing requirements:"); |
85 for (var error in errors) { | 83 for (var error in errors) { |
86 log.error("* ${error.split('\n').join('\n ')}"); | 84 log.error("* ${error.split('\n').join('\n ')}"); |
87 } | 85 } |
88 log.error(""); | 86 log.error(""); |
89 } | 87 } |
90 | 88 |
91 if (!warnings.isEmpty) { | 89 if (!warnings.isEmpty) { |
92 log.warning("Suggestions:"); | 90 log.warning("Suggestions:"); |
93 for (var warning in warnings) { | 91 for (var warning in warnings) { |
94 log.warning("* ${warning.split('\n').join('\n ')}"); | 92 log.warning("* ${warning.split('\n').join('\n ')}"); |
95 } | 93 } |
96 log.warning(""); | 94 log.warning(""); |
97 } | 95 } |
98 | 96 |
99 return new Pair<List<String>, List<String>>(errors, warnings); | 97 return new Pair<List<String>, List<String>>(errors, warnings); |
100 }); | 98 }); |
101 } | 99 } |
102 } | 100 } |
OLD | NEW |