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

Unified Diff: sdk/lib/_internal/pub/lib/src/command/build.dart

Issue 82373002: Fix filtering out .dart files in release mode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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/lib/src/command/build.dart
diff --git a/sdk/lib/_internal/pub/lib/src/command/build.dart b/sdk/lib/_internal/pub/lib/src/command/build.dart
index 2df2ecf18a1e6bf7530563538a1cb7c2750ebc1e..1c9e37ec3b9eeffc54aeb3249933cd00f6dded97 100644
--- a/sdk/lib/_internal/pub/lib/src/command/build.dart
+++ b/sdk/lib/_internal/pub/lib/src/command/build.dart
@@ -50,6 +50,7 @@ class BuildCommand extends PubCommand {
cleanDir(target);
var dart2jsTransformer;
+ var builtFiles = 0;
return entrypoint.ensureLockFileIsUpToDate().then((_) {
return entrypoint.loadPackageGraph();
@@ -78,6 +79,14 @@ class BuildCommand extends PubCommand {
() => server.barback.getAllAssets());
}).then((assets) {
return Future.wait(assets.map((asset) {
+ // In release mode, strip out .dart files since all relevant ones have
+ // been compiled to JavaScript already.
+ if (mode == BarbackMode.RELEASE && asset.id.extension == ".dart") {
+ return new Future.value();
+ }
+
+ builtFiles++;
+
// Figure out the output directory for the asset, which is the same
// as the path pub serve would use to serve it.
var relativeUrl = barback.idtoUrlPath(entrypoint.root.name, asset.id);
@@ -92,10 +101,8 @@ class BuildCommand extends PubCommand {
// TODO(rnystrom): Should we display this to the user?
return createFileFromStream(asset.read(), destPath);
})).then((_) {
- _copyBrowserJsFiles(dart2jsTransformer.entrypoints);
- // TODO(rnystrom): Should this count include the JS files?
- log.message("Built ${assets.length} "
- "${pluralize('file', assets.length)}!");
+ builtFiles += _copyBrowserJsFiles(dart2jsTransformer.entrypoints);
+ log.message("Built $builtFiles ${pluralize('file', builtFiles)}!");
});
}).catchError((error) {
// If [getAllAssets()] throws a BarbackException, the error has already
@@ -110,11 +117,13 @@ class BuildCommand extends PubCommand {
/// If this package depends directly on the `browser` package, this ensures
/// that the JavaScript bootstrap files are copied into `packages/browser/`
/// directories next to each entrypoint in [entrypoints].
- void _copyBrowserJsFiles(Iterable<AssetId> entrypoints) {
+ ///
+ /// Returns the number of files it copied.
+ int _copyBrowserJsFiles(Iterable<AssetId> entrypoints) {
// Must depend on the browser package.
if (!entrypoint.root.dependencies.any(
(dep) => dep.name == 'browser' && dep.source == 'hosted')) {
- return;
+ return 0;
}
// Get all of the directories that contain Dart entrypoints.
@@ -131,6 +140,8 @@ class BuildCommand extends PubCommand {
_addBrowserJs(dir, "dart");
_addBrowserJs(dir, "interop");
}
+
+ return entrypointDirs.length * 2;
}
// TODO(nweiz): do something more principled when issue 6101 is fixed.

Powered by Google App Engine
This is Rietveld 408576698