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

Unified Diff: utils/pub/validator.dart

Issue 12094093: Add a validator that tests the size of pub packages. (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 side-by-side diff with in-line comments
Download patch
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((_) {

Powered by Google App Engine
This is Rietveld 408576698