Index: utils/pub/validator.dart |
diff --git a/utils/pub/validator.dart b/utils/pub/validator.dart |
index 2dd5420fe66d335b2737d41819864d26e84f6c4d..72f65d1b3249e1630c79d4f2897e98e65b7b7748 100644 |
--- a/utils/pub/validator.dart |
+++ b/utils/pub/validator.dart |
@@ -18,6 +18,7 @@ import 'validator/lib.dart'; |
import 'validator/license.dart'; |
import 'validator/name.dart'; |
import 'validator/pubspec_field.dart'; |
+import 'validator/size.dart'; |
import 'validator/utf8_readme.dart'; |
/// The base class for validators that check whether a package is fit for |
@@ -44,8 +45,12 @@ abstract class Validator { |
/// Run all validators on the [entrypoint] package and print their results. |
/// The future will complete with the error and warning messages, |
/// respectively. |
+ /// |
+ /// [packageSize], if passed, should complete to the size of the tarred |
+ /// package, in bytes. This is used to validate that it's not too big to |
+ /// upload to the server. |
static Future<Pair<List<String>, List<String>>> runAll( |
- Entrypoint entrypoint) { |
+ Entrypoint entrypoint, [Future<int> packageSize]) { |
var validators = [ |
new LibValidator(entrypoint), |
new LicenseValidator(entrypoint), |
@@ -56,6 +61,9 @@ abstract class Validator { |
new CompiledDartdocValidator(entrypoint), |
new Utf8ReadmeValidator(entrypoint) |
]; |
+ if (packageSize != null) { |
+ validators.add(new SizeValidator(entrypoint, packageSize)); |
+ } |
return Future.wait(validators.map((validator) => validator.validate())) |
.then((_) { |