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

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

Issue 198053009: Use real "package:" imports in pub's plugin-loading code. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 9 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
Index: sdk/lib/_internal/pub/lib/src/barback/load_transformers.dart
diff --git a/sdk/lib/_internal/pub/lib/src/barback/load_transformers.dart b/sdk/lib/_internal/pub/lib/src/barback/load_transformers.dart
index 7f81922b5f78020802bc81e1730fcecbe4be3bda..70b6151f0bc974da8b6e2d15327e03617d77969b 100644
--- a/sdk/lib/_internal/pub/lib/src/barback/load_transformers.dart
+++ b/sdk/lib/_internal/pub/lib/src/barback/load_transformers.dart
@@ -34,9 +34,15 @@ Future<Set> loadTransformers(BuildEnvironment environment,
var baseUrl = transformerServer.url;
var uri = '$baseUrl/packages/${id.package}/$path';
- var code = 'import "$uri";\n' +
- readAsset(p.join("dart", "transformer_isolate.dart"))
- .replaceAll('<<URL_BASE>>', baseUrl);
+ var code = """
+ import 'dart:isolate';
+
+ import '$uri';
+
+ import r'$baseUrl/packages/\$pub/transformer_isolate.dart';
+
+ void main(_, SendPort replyTo) => loadTransformers(replyTo);
+ """;
log.fine("Loading transformers from $assetId");
var port = new ReceivePort();
@@ -60,7 +66,7 @@ Future<Set> loadTransformers(BuildEnvironment environment,
if (error.type != 'IsolateSpawnException') throw error;
// TODO(nweiz): don't parse this as a string once issues 12617 and 12689
// are fixed.
- if (!error.message.split('\n')[1].startsWith('import "$uri";')) {
+ if (!error.message.split('\n')[1].endsWith("import '$uri';")) {
throw error;
}
@@ -148,6 +154,11 @@ Map _serializeTransform(Transform transform) {
return null;
}
+ if (message['type'] == 'consumePrimary') {
+ transform.consumePrimary();
+ return null;
+ }
+
assert(message['type'] == 'log');
var method;
if (message['level'] == 'Info') {

Powered by Google App Engine
This is Rietveld 408576698