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

Unified Diff: lib/src/barback/dart2js_transformer.dart

Issue 2653753010: Fix URI for packages: make them self contained within the domain served by pub-serve (Closed)
Patch Set: Created 3 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 | test/dart2js/source_maps_are_self_contained_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/barback/dart2js_transformer.dart
diff --git a/lib/src/barback/dart2js_transformer.dart b/lib/src/barback/dart2js_transformer.dart
index 94d05d18fc49b70e62b6d9c4c3f233239a506528..54428a1e874866e7ddd4e59492c72cd53973cd87 100644
--- a/lib/src/barback/dart2js_transformer.dart
+++ b/lib/src/barback/dart2js_transformer.dart
@@ -125,6 +125,14 @@ class Dart2JSTransformer extends Transformer implements LazyTransformer {
var entrypoint = _environment.graph.packages[id.package].path(id.path);
+ // We define the packageRoot in terms of the entrypoint directory, and not
+ // the rootPackage, to ensure that the generated source-maps are valid.
+ // Source-maps contain relative URLs to package sources and these relative
+ // URLs should be self-contained within the paths served by pub-serve.
+ // See #1511 for details.
+ var buildDir = _environment.getSourceDirectoryContaining(id.path);
+ var packageRoot = _environment.rootPackage.path(buildDir, "packages");
+
// TODO(rnystrom): Should have more sophisticated error-handling here. Need
// to report compile errors to the user in an easily visible way. Need to
// make sure paths in errors are mapped to the original source path so they
@@ -138,7 +146,7 @@ class Dart2JSTransformer extends Transformer implements LazyTransformer {
'minify', defaultsTo: _settings.mode == BarbackMode.RELEASE),
verbose: _configBool('verbose'),
environment: _configEnvironment,
- packageRoot: _environment.rootPackage.path("packages"),
+ packageRoot: packageRoot,
analyzeAll: _configBool('analyzeAll'),
preserveUris: _configBool('preserveUris'),
suppressWarnings: _configBool('suppressWarnings'),
« no previous file with comments | « no previous file | test/dart2js/source_maps_are_self_contained_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698