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

Side by Side Diff: pkg/front_end/lib/src/fasta/translate_uri.dart

Issue 2832353002: Add support for building patched_sdk and platform.dill for dart2js: (Closed)
Patch Set: fix .gn circularity by removing use of rebase_path Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library fasta.translate_uri; 5 library fasta.translate_uri;
6 6
7 import 'dart:async' show Future; 7 import 'dart:async' show Future;
8 8
9 import 'package:package_config/packages_file.dart' as packages_file show parse; 9 import 'package:package_config/packages_file.dart' as packages_file show parse;
10 10
(...skipping 19 matching lines...) Expand all
30 int index = uri.path.indexOf("/"); 30 int index = uri.path.indexOf("/");
31 if (index == -1) return null; 31 if (index == -1) return null;
32 String name = uri.path.substring(0, index); 32 String name = uri.path.substring(0, index);
33 String path = uri.path.substring(index + 1); 33 String path = uri.path.substring(index + 1);
34 Uri root = packages[name]; 34 Uri root = packages[name];
35 if (root == null) return null; 35 if (root == null) return null;
36 return root.resolve(path); 36 return root.resolve(path);
37 } 37 }
38 38
39 static Future<TranslateUri> parse(Uri sdk, [Uri uri]) async { 39 static Future<TranslateUri> parse(Uri sdk, [Uri uri]) async {
40 // This list is generated with [bin/generate_dart_libraries.dart] below. 40 // This list below is generated with [bin/generate_dart_libraries.dart] and
41 // additional entries for _builtin, _vmservice, profiler, and vmservice_io.
41 // 42 //
42 // TODO(ahe): This is only used with the option --compile-sdk, and 43 // TODO(ahe): This is only used with the option --compile-sdk, and
43 // currently doesn't work outside the SDK source tree. 44 // currently doesn't work outside the SDK source tree.
44 Map<String, Uri> dartLibraries = <String, Uri>{}; 45 Map<String, Uri> dartLibraries = <String, Uri>{};
45 if (sdk != null) { 46 if (sdk != null) {
46 dartLibraries = <String, Uri>{ 47 dartLibraries = <String, Uri>{
48 "_async_await_error_codes": sdk.resolve(
49 "lib/_internal/js_runtime/lib/shared/async_await_error_codes.dart"),
50 "_blink": sdk.resolve("lib/_blink/dartium/_blink_dartium.dart"),
51 "_builtin": sdk.resolve("lib/_builtin/_builtin.dart"),
52 "_chrome": sdk.resolve("lib/_chrome/dart2js/chrome_dart2js.dart"),
53 "_foreign_helper":
54 sdk.resolve("lib/_internal/js_runtime/lib/foreign_helper.dart"),
55 "_interceptors":
56 sdk.resolve("lib/_internal/js_runtime/lib/interceptors.dart"),
57 "_internal": sdk.resolve("lib/internal/internal.dart"),
58 "_isolate_helper":
59 sdk.resolve("lib/_internal/js_runtime/lib/isolate_helper.dart"),
60 "_js_embedded_names": sdk
61 .resolve("lib/_internal/js_runtime/lib/shared/embedded_names.dart"),
62 "_js_helper":
63 sdk.resolve("lib/_internal/js_runtime/lib/js_helper.dart"),
64 "_js_mirrors":
65 sdk.resolve("lib/_internal/js_runtime/lib/js_mirrors.dart"),
66 "_js_names": sdk.resolve("lib/_internal/js_runtime/lib/js_names.dart"),
67 "_js_primitives":
68 sdk.resolve("lib/_internal/js_runtime/lib/js_primitives.dart"),
69 "_metadata": sdk.resolve("lib/html/html_common/metadata.dart"),
70 "_native_typed_data":
71 sdk.resolve("lib/_internal/js_runtime/lib/native_typed_data.dart"),
72 "_vmservice": sdk.resolve("lib/vmservice/vmservice.dart"),
47 "async": sdk.resolve("lib/async/async.dart"), 73 "async": sdk.resolve("lib/async/async.dart"),
48 "_blink": sdk.resolve("lib/_blink/dartium/_blink_dartium.dart"),
49 "_chrome": sdk.resolve("lib/_chrome/dart2js/chrome_dart2js.dart"),
50 "collection": sdk.resolve("lib/collection/collection.dart"), 74 "collection": sdk.resolve("lib/collection/collection.dart"),
51 "convert": sdk.resolve("lib/convert/convert.dart"), 75 "convert": sdk.resolve("lib/convert/convert.dart"),
52 "core": sdk.resolve("lib/core/core.dart"), 76 "core": sdk.resolve("lib/core/core.dart"),
53 "developer": sdk.resolve("lib/developer/developer.dart"), 77 "developer": sdk.resolve("lib/developer/developer.dart"),
54 "html": sdk.resolve("lib/html/dartium/html_dartium.dart"), 78 "html": sdk.resolve("lib/html/dartium/html_dartium.dart"),
55 "html_common": sdk.resolve("lib/html/html_common/html_common.dart"), 79 "html_common": sdk.resolve("lib/html/html_common/html_common.dart"),
56 "indexed_db": 80 "indexed_db":
57 sdk.resolve("lib/indexed_db/dartium/indexed_db_dartium.dart"), 81 sdk.resolve("lib/indexed_db/dartium/indexed_db_dartium.dart"),
58 "io": sdk.resolve("lib/io/io.dart"), 82 "io": sdk.resolve("lib/io/io.dart"),
59 "isolate": sdk.resolve("lib/isolate/isolate.dart"), 83 "isolate": sdk.resolve("lib/isolate/isolate.dart"),
60 "js": sdk.resolve("lib/js/dartium/js_dartium.dart"), 84 "js": sdk.resolve("lib/js/dartium/js_dartium.dart"),
61 "js_util": sdk.resolve("lib/js_util/dartium/js_util_dartium.dart"), 85 "js_util": sdk.resolve("lib/js_util/dartium/js_util_dartium.dart"),
62 "math": sdk.resolve("lib/math/math.dart"), 86 "math": sdk.resolve("lib/math/math.dart"),
63 "mirrors": sdk.resolve("lib/mirrors/mirrors.dart"), 87 "mirrors": sdk.resolve("lib/mirrors/mirrors.dart"),
64 "nativewrappers": sdk.resolve("lib/html/dartium/nativewrappers.dart"), 88 "nativewrappers": sdk.resolve("lib/html/dartium/nativewrappers.dart"),
89 "profiler": sdk.resolve("lib/profiler/profiler.dart"),
90 "svg": sdk.resolve("lib/svg/dartium/svg_dartium.dart"),
65 "typed_data": sdk.resolve("lib/typed_data/typed_data.dart"), 91 "typed_data": sdk.resolve("lib/typed_data/typed_data.dart"),
66 "svg": sdk.resolve("lib/svg/dartium/svg_dartium.dart"), 92 "vmservice_io": sdk.resolve("lib/vmservice_io/vmservice_io.dart"),
67 "web_audio": 93 "web_audio":
68 sdk.resolve("lib/web_audio/dartium/web_audio_dartium.dart"), 94 sdk.resolve("lib/web_audio/dartium/web_audio_dartium.dart"),
69 "web_gl": sdk.resolve("lib/web_gl/dartium/web_gl_dartium.dart"), 95 "web_gl": sdk.resolve("lib/web_gl/dartium/web_gl_dartium.dart"),
70 "web_sql": sdk.resolve("lib/web_sql/dartium/web_sql_dartium.dart"), 96 "web_sql": sdk.resolve("lib/web_sql/dartium/web_sql_dartium.dart"),
71 "_internal": sdk.resolve("lib/internal/internal.dart"),
72 "profiler": sdk.resolve("lib/profiler/profiler.dart"),
73 "vmservice_io": sdk.resolve("lib/vmservice_io/vmservice_io.dart"),
74 "_vmservice": sdk.resolve("lib/vmservice/vmservice.dart"),
75 "_builtin": sdk.resolve("lib/_builtin/_builtin.dart"),
76 }; 97 };
77 } 98 }
78 uri ??= Uri.base.resolve(".packages"); 99 uri ??= Uri.base.resolve(".packages");
79 List<int> bytes = 100 List<int> bytes =
80 await readBytesFromFile(uri, ensureZeroTermination: false); 101 await readBytesFromFile(uri, ensureZeroTermination: false);
81 Map<String, Uri> packages = const <String, Uri>{}; 102 Map<String, Uri> packages = const <String, Uri>{};
82 try { 103 try {
83 packages = packages_file.parse(bytes, uri); 104 packages = packages_file.parse(bytes, uri);
84 } on FormatException catch (e) { 105 } on FormatException catch (e) {
85 return inputError(uri, e.offset, e.message); 106 return inputError(uri, e.offset, e.message);
86 } 107 }
87 return new TranslateUri(packages, dartLibraries); 108 return new TranslateUri(packages, dartLibraries);
88 } 109 }
89 } 110 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/target_implementation.dart ('k') | pkg/front_end/tool/_fasta/generate_dart_libraries.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698