| 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 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 // TODO(nweiz): The sleep 0 here forces us to go async. This works around | 50 // TODO(nweiz): The sleep 0 here forces us to go async. This works around |
| 51 // 3356, which causes a bug if all validators are (synchronously) using | 51 // 3356, which causes a bug if all validators are (synchronously) using |
| 52 // Future.immediate and an error is thrown before a handler is set up. | 52 // Future.immediate and an error is thrown before a handler is set up. |
| 53 return sleep(0).chain((_) { | 53 return sleep(0).chain((_) { |
| 54 return Futures.wait(validators.map((validator) => validator.validate())); | 54 return Futures.wait(validators.map((validator) => validator.validate())); |
| 55 }).transform((_) { | 55 }).transform((_) { |
| 56 var errors = flatten(validators.map((validator) => validator.errors)); | 56 var errors = flatten(validators.map((validator) => validator.errors)); |
| 57 var warnings = flatten(validators.map((validator) => validator.warnings)); | 57 var warnings = flatten(validators.map((validator) => validator.warnings)); |
| 58 | 58 |
| 59 if (!errors.isEmpty) { | 59 if (!errors.isEmpty) { |
| 60 log.error("== Errors:"); | 60 log.error("Missing requirements:"); |
| 61 for (var error in errors) { | 61 for (var error in errors) { |
| 62 log.error("* $error"); | 62 log.error("* ${Strings.join(error.split('\n'), '\n ')}"); |
| 63 } | 63 } |
| 64 log.error(""); | 64 log.error(""); |
| 65 } | 65 } |
| 66 | 66 |
| 67 if (!warnings.isEmpty) { | 67 if (!warnings.isEmpty) { |
| 68 log.warning("== Warnings:"); | 68 log.warning("Suggestions:"); |
| 69 for (var warning in warnings) { | 69 for (var warning in warnings) { |
| 70 log.warning("* $warning"); | 70 log.warning("* ${Strings.join(warning.split('\n'), '\n ')}"); |
| 71 } | 71 } |
| 72 log.warning(""); | 72 log.warning(""); |
| 73 } | 73 } |
| 74 | 74 |
| 75 return new Pair<List<String>, List<String>>(errors, warnings); | 75 return new Pair<List<String>, List<String>>(errors, warnings); |
| 76 }); | 76 }); |
| 77 } | 77 } |
| 78 } | 78 } |
| OLD | NEW |