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

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

Issue 135153012: Generate non-dart assets from “lib” into the build output. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise. Created 6 years, 10 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 | sdk/lib/_internal/pub/test/build/includes_assets_from_dependencies_in_lib_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5131ea24ee5e084f331603b2dc8687f473f8d7a2..83a619561d5a2208544c8f0e935073f8a75a3690 100644
--- a/sdk/lib/_internal/pub/lib/src/command/build.dart
+++ b/sdk/lib/_internal/pub/lib/src/command/build.dart
@@ -177,14 +177,6 @@ class BuildCommand extends PubCommand {
return new Future.value();
}
- // If the asset is from a package's "lib" directory, we make it available
- // as an input for transformers, but don't want it in the final output.
- // (Any Dart code in there should be imported and compiled to JS, anything
- // else we want to omit.)
- if (asset.id.path.startsWith("lib/")) {
- return new Future.value();
- }
-
// 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,
@@ -193,9 +185,10 @@ class BuildCommand extends PubCommand {
// Remove the leading "/".
relativeUrl = relativeUrl.substring(1);
- // If the asset is from the shared "assets" directory, copy it into all of
- // the top-level build directories.
- if (relativeUrl.startsWith("assets/")) {
+ // If the asset is from a public directory, copy it into all of the
+ // top-level build directories.
+ if (relativeUrl.startsWith("assets/") ||
+ relativeUrl.startsWith("packages/")) {
builtFiles += buildDirectories.length;
return Future.wait(buildDirectories.map(
(buildDir) => _writeOutputFile(asset,
@@ -228,10 +221,14 @@ class BuildCommand extends PubCommand {
return 0;
}
- // Get all of the directories that contain Dart entrypoints.
+ // Get all of the subdirectories that contain Dart entrypoints.
var entrypointDirs = entrypoints
- .map((id) => path.url.split(id.path))
- .map((relative) => path.dirname(path.joinAll(relative)))
+ // Convert the asset path to a native-separated one and get the
+ // directory containing the entrypoint.
+ .map((id) => path.dirname(path.joinAll(path.url.split(id.path))))
+ // Don't copy files to the top levels of the build directories since
+ // the normal lib asset copying will take care of that.
+ .where((dir) => dir.contains(path.separator))
.toSet();
for (var dir in entrypointDirs) {
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/test/build/includes_assets_from_dependencies_in_lib_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698