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

Unified Diff: utils/pub/command_lish.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
« no previous file with comments | « no previous file | utils/pub/validator.dart » ('j') | utils/pub/validator/size.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/command_lish.dart
diff --git a/utils/pub/command_lish.dart b/utils/pub/command_lish.dart
index 81d896a956ec32da939736b6c99685efebe33688..536a3aae3f8789a127a6a435865425a7023dff56 100644
--- a/utils/pub/command_lish.dart
+++ b/utils/pub/command_lish.dart
@@ -87,20 +87,21 @@ class LishCommand extends PubCommand {
Future onRun() {
var files;
- return _filesToPublish.then((f) {
+ var packageBytesFuture = _filesToPublish.then((f) {
files = f;
log.fine('Archiving and publishing ${entrypoint.root}.');
return createTarGz(files, baseDir: entrypoint.root.dir);
- }).then(consumeInputStream).then((packageBytes) {
- // Show the package contents so the user can verify they look OK.
- var package = entrypoint.root;
- log.message(
- 'Publishing "${package.name}" ${package.version}:\n'
- '${generateTree(files)}');
+ }).then(consumeInputStream);
+
+ // Show the package contents so the user can verify they look OK.
+ var package = entrypoint.root;
+ log.message(
+ 'Publishing "${package.name}" ${package.version}:\n'
+ '${generateTree(files)}');
// Validate the package.
- return _validate().then((_) => _publish(packageBytes));
- });
+ return _validate(packageBytesFuture.then((bytes) => bytes.length))
+ .then((_) => packageBytesFuture).then(_publish);
}
/// The basenames of files that are automatically excluded from archives.
@@ -159,8 +160,8 @@ class LishCommand extends PubCommand {
}
/// Validates the package. Throws an exception if it's invalid.
- Future _validate() {
- return Validator.runAll(entrypoint).then((pair) {
+ Future _validate(Future<int> packageSize) {
+ return Validator.runAll(entrypoint, packageSize).then((pair) {
var errors = pair.first;
var warnings = pair.last;
« no previous file with comments | « no previous file | utils/pub/validator.dart » ('j') | utils/pub/validator/size.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698