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

Unified Diff: lib/src/utils.dart

Issue 1020043002: Replace dart_core.js with actual compiled SDK (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 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: lib/src/utils.dart
diff --git a/lib/src/utils.dart b/lib/src/utils.dart
index dd62656ddfa875dfc0f7bd617775b75237a0ab04..0c286f3033b207a01157f4b4162941ef8d1640b5 100644
--- a/lib/src/utils.dart
+++ b/lib/src/utils.dart
@@ -316,15 +316,21 @@ String resourceOutputPath(Uri resourceUri, Uri entryUri) {
// further inside the folder where the entrypoint is located, otherwise we
// assume this is a runtime resource from the dev_compiler.
if (!relativePath.startsWith('..')) return relativePath;
+
var segments = resourceUri.pathSegments;
- var len = segments.length;
- if (segments.length < 4 ||
- segments[len - 2] != 'runtime' ||
- segments[len - 3] != 'lib' ||
- // If loaded from sources this will be exactly dev_compiler, otherwise it
- // can be the name in the pub cache (typically dev_compiler-version).
- !segments[len - 4].startsWith('dev_compiler')) {
- return null;
+ for (int i = 0, len = segments.length; i < len; i++) {
+ var s = segments[i];
+ if (_packageNameWithVersion.stringMatch(s) == s &&
Siggi Cherem (dart-lang) 2015/03/19 23:11:14 FYI you'll have a not so fun merge conflict here :
+ i + 3 < len &&
+ segments[i + 1] == 'lib' &&
+ segments[i + 2] == 'runtime') {
+ return path.joinAll(['dev_compiler']..addAll(segments.skip(i + 2)));
+ }
}
- return path.joinAll(['dev_compiler']..addAll(segments.skip(len - 2)));
+ return null;
}
+
+// If loaded from sources this will be exactly dev_compiler, otherwise it
+// can be the name in the pub cache (typically dev_compiler-version).
+// TODO(jmesserly): avoid depending on pub cache implementation details.
+final _packageNameWithVersion = new RegExp('dev_compiler[0-9A-Za-z-.]*');

Powered by Google App Engine
This is Rietveld 408576698