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

Unified Diff: sdk/lib/_internal/pub_generated/lib/src/validator.dart

Issue 557563002: Store the async-await compiled pub code directly in the repo. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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: sdk/lib/_internal/pub_generated/lib/src/validator.dart
diff --git a/sdk/lib/_internal/pub_generated/lib/src/validator.dart b/sdk/lib/_internal/pub_generated/lib/src/validator.dart
new file mode 100644
index 0000000000000000000000000000000000000000..27f071b820897b7d72bf3aac504ac3217ce07182
--- /dev/null
+++ b/sdk/lib/_internal/pub_generated/lib/src/validator.dart
@@ -0,0 +1,56 @@
+library pub.validator;
+import 'dart:async';
+import 'entrypoint.dart';
+import 'log.dart' as log;
+import 'utils.dart';
+import 'validator/compiled_dartdoc.dart';
+import 'validator/dependency.dart';
+import 'validator/dependency_override.dart';
+import 'validator/directory.dart';
+import 'validator/license.dart';
+import 'validator/name.dart';
+import 'validator/pubspec_field.dart';
+import 'validator/size.dart';
+import 'validator/utf8_readme.dart';
+abstract class Validator {
+ final Entrypoint entrypoint;
+ final errors = <String>[];
+ final warnings = <String>[];
+ Validator(this.entrypoint);
+ Future validate();
+ static Future<Pair<List<String>, List<String>>> runAll(Entrypoint entrypoint,
+ [Future<int> packageSize]) {
+ var validators = [
+ new LicenseValidator(entrypoint),
+ new NameValidator(entrypoint),
+ new PubspecFieldValidator(entrypoint),
+ new DependencyValidator(entrypoint),
+ new DependencyOverrideValidator(entrypoint),
+ new DirectoryValidator(entrypoint),
+ new CompiledDartdocValidator(entrypoint),
+ new Utf8ReadmeValidator(entrypoint)];
+ if (packageSize != null) {
+ validators.add(new SizeValidator(entrypoint, packageSize));
+ }
+ return Future.wait(
+ validators.map((validator) => validator.validate())).then((_) {
+ var errors = flatten(validators.map((validator) => validator.errors));
+ var warnings = flatten(validators.map((validator) => validator.warnings));
+ if (!errors.isEmpty) {
+ log.error("Missing requirements:");
+ for (var error in errors) {
+ log.error("* ${error.split('\n').join('\n ')}");
+ }
+ log.error("");
+ }
+ if (!warnings.isEmpty) {
+ log.warning("Suggestions:");
+ for (var warning in warnings) {
+ log.warning("* ${warning.split('\n').join('\n ')}");
+ }
+ log.warning("");
+ }
+ return new Pair<List<String>, List<String>>(errors, warnings);
+ });
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698