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

Unified Diff: sdk/lib/_internal/pub/lib/src/barback/pub_package_provider.dart

Issue 602923002: Fix the listing of built-in packages for "pub build". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes 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
« no previous file with comments | « no previous file | sdk/lib/_internal/pub_generated/lib/src/barback/pub_package_provider.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/barback/pub_package_provider.dart
diff --git a/sdk/lib/_internal/pub/lib/src/barback/pub_package_provider.dart b/sdk/lib/_internal/pub/lib/src/barback/pub_package_provider.dart
index 7f3dfeacea01b1f2450b8dcd0e076065fc0a0f9e..23c1a48db13094dd942088c23a04cdd38d6be5a1 100644
--- a/sdk/lib/_internal/pub/lib/src/barback/pub_package_provider.dart
+++ b/sdk/lib/_internal/pub/lib/src/barback/pub_package_provider.dart
@@ -75,11 +75,37 @@ class PubPackageProvider implements StaticPackageProvider {
}
Stream<AssetId> getAllAssetIds(String packageName) {
- var package = _graph.packages[packageName];
- return new Stream.fromIterable(
- package.listFiles(beneath: 'lib').map((file) {
- return new AssetId(packageName,
- path.toUri(package.relative(file)).toString());
- }));
+ if (packageName == r'$pub') {
+ // "$pub" is a pseudo-package that allows pub's transformer-loading
+ // infrastructure to share code with pub proper. We provide it only during
+ // the initial transformer loading process.
+ var dartPath = assetPath('dart');
+ return new Stream.fromIterable(listDir(dartPath, recursive: true)
+ // Don't include directories.
+ .where((file) => path.extension(file) == ".dart")
+ .map((library) {
+ var idPath = path.join('lib', path.relative(library, from: dartPath));
+ return new AssetId('\$pub', path.toUri(idPath).toString());
+ }));
+ } else if (packageName == r'$sdk') {
+ // "$sdk" is a pseudo-package that allows the dart2js transformer to find
+ // the Dart core libraries without hitting the file system directly. This
+ // ensures they work with source maps.
+ var libPath = path.join(sdk.rootDirectory, "lib");
+ return new Stream.fromIterable(listDir(libPath, recursive: true)
+ .where((file) => path.extension(file) == ".dart")
+ .map((file) {
+ var idPath = path.join("lib",
+ path.relative(file, from: sdk.rootDirectory));
+ return new AssetId('\$sdk', path.toUri(idPath).toString());
+ }));
+ } else {
+ var package = _graph.packages[packageName];
+ return new Stream.fromIterable(
+ package.listFiles(beneath: 'lib').map((file) {
+ return new AssetId(packageName,
+ path.toUri(package.relative(file)).toString());
+ }));
+ }
}
}
« no previous file with comments | « no previous file | sdk/lib/_internal/pub_generated/lib/src/barback/pub_package_provider.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698