Chromium Code Reviews

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

Issue 263403006: Support deferred libraries in pub build/serve. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/lib/src/dart.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/dart2js_transformer.dart
diff --git a/sdk/lib/_internal/pub/lib/src/barback/dart2js_transformer.dart b/sdk/lib/_internal/pub/lib/src/barback/dart2js_transformer.dart
index 21243745bad405163e9062a85231e17f8f0382dc..101669ff421e8e191c0e43d8179d74e44bc07040 100644
--- a/sdk/lib/_internal/pub/lib/src/barback/dart2js_transformer.dart
+++ b/sdk/lib/_internal/pub/lib/src/barback/dart2js_transformer.dart
@@ -279,19 +279,23 @@ class _BarbackCompilerProvider implements dart.CompilerProvider {
/// A [CompilerOutputProvider] for dart2js.
EventSink<String> provideOutput(String name, String extension) {
- // Dart2js uses an empty string for the name of the entrypoint library.
- // We only expect to get output files associated with that right now. For
- // other files, we'd need some logic to determine the right relative path
- // for it.
- assert(name == "");
-
// TODO(rnystrom): Do this more cleanly. See: #17403.
if (!generateSourceMaps && extension.endsWith(".map")) {
return new NullSink<String>();
}
var primaryId = _transform.primaryInput.id;
- var id = new AssetId(primaryId.package, "${primaryId.path}.$extension");
+
+ // Dart2js uses an empty string for the name of the entrypoint library.
+ // Otherwise, it's the name of a deferred library.
+ var outPath;
+ if (name == "") {
+ outPath = _transform.primaryInput.id.path;
+ } else {
+ outPath = path.join(path.dirname(_transform.primaryInput.id.path), name);
+ }
+
+ var id = new AssetId(primaryId.package, "$outPath.$extension");
// Make a sink that dart2js can write to.
var sink = new StreamController<String>();
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/lib/src/dart.dart » ('j') | no next file with comments »

Powered by Google App Engine