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

Unified Diff: sdk/lib/_internal/pub_generated/lib/src/validator/size.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/size.dart
diff --git a/sdk/lib/_internal/pub_generated/lib/src/validator/size.dart b/sdk/lib/_internal/pub_generated/lib/src/validator/size.dart
new file mode 100644
index 0000000000000000000000000000000000000000..675587c5e5796b2345fd2b2a1e8e891763d0a1e3
--- /dev/null
+++ b/sdk/lib/_internal/pub_generated/lib/src/validator/size.dart
@@ -0,0 +1,18 @@
+library pub.validator.size;
+import 'dart:async';
+import 'dart:math' as math;
+import '../entrypoint.dart';
+import '../validator.dart';
+const _MAX_SIZE = 10 * 1024 * 1024;
+class SizeValidator extends Validator {
+ final Future<int> packageSize;
+ SizeValidator(Entrypoint entrypoint, this.packageSize) : super(entrypoint);
+ Future validate() {
+ return packageSize.then((size) {
+ if (size <= _MAX_SIZE) return;
+ var sizeInMb = (size / math.pow(2, 20)).toStringAsPrecision(4);
+ errors.add(
+ "Your package is $sizeInMb MB. Hosted packages must be " "smaller than 10 MB.");
+ });
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698