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

Side by Side Diff: pkg/dev_compiler/tool/input_sdk/libraries.dart

Issue 2698353003: unfork DDC's copy of most SDK libraries (Closed)
Patch Set: fix Created 3 years, 10 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
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
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.
4
5 library libraries;
6
7 /**
8 * A bit flag used by [LibraryInfo] indicating that a library is used by dart2js
9 */
10 const int DART2JS_PLATFORM = 1;
11
12 /**
13 * A bit flag used by [LibraryInfo] indicating that a library is used by the VM
14 */
15 const int VM_PLATFORM = 2;
16
17 /// The contexts that a library can be used from.
18 enum Category {
19 /// Indicates that a library can be used in a browser context.
20 client,
21 /// Indicates that a library can be used in a command line context.
22 server,
23 /// Indicates that a library can be used from embedded devices.
24 embedded
25 }
26
27 Category parseCategory(String name) {
28 switch (name) {
29 case "Client": return Category.client;
30 case "Server": return Category.server;
31 case "Embedded": return Category.embedded;
32 }
33 return null;
34 }
35
36 /// Mapping of "dart:" library name (e.g. "core") to information about that
37 /// library.
38 const Map<String, LibraryInfo> libraries = const {
39 "async": const LibraryInfo(
40 "async/async.dart",
41 categories: "Client,Server",
42 maturity: Maturity.STABLE,
43 dart2jsPatchPath: "_internal/js_runtime/lib/async_patch.dart"),
44
45 "_blink": const LibraryInfo(
46 "_blink/dartium/_blink_dartium.dart",
47 categories: "Client",
48 implementation: true,
49 documented: false,
50 platforms: VM_PLATFORM),
51
52 "_chrome": const LibraryInfo(
53 "_chrome/dart2js/chrome_dart2js.dart",
54 categories: "Client",
55 documented: false),
56
57 "collection": const LibraryInfo(
58 "collection/collection.dart",
59 categories: "Client,Server,Embedded",
60 maturity: Maturity.STABLE,
61 dart2jsPatchPath: "_internal/js_runtime/lib/collection_patch.dart"),
62
63 "convert": const LibraryInfo(
64 "convert/convert.dart",
65 categories: "Client,Server",
66 maturity: Maturity.STABLE,
67 dart2jsPatchPath: "_internal/js_runtime/lib/convert_patch.dart"),
68
69 "core": const LibraryInfo(
70 "core/core.dart",
71 categories: "Client,Server,Embedded",
72 maturity: Maturity.STABLE,
73 dart2jsPatchPath: "_internal/js_runtime/lib/core_patch.dart"),
74
75 "developer": const LibraryInfo(
76 "developer/developer.dart",
77 categories: "Client,Server,Embedded",
78 maturity: Maturity.UNSTABLE,
79 dart2jsPatchPath: "_internal/js_runtime/lib/developer_patch.dart"),
80
81 "html": const LibraryInfo(
82 "html/dartium/html_dartium.dart",
83 categories: "Client",
84 maturity: Maturity.WEB_STABLE,
85 dart2jsPath: "html/dart2js/html_dart2js.dart"),
86
87 "html_common": const LibraryInfo(
88 "html/html_common/html_common.dart",
89 categories: "Client",
90 maturity: Maturity.WEB_STABLE,
91 dart2jsPath: "html/html_common/html_common_dart2js.dart",
92 documented: false,
93 implementation: true),
94
95 "indexed_db": const LibraryInfo(
96 "indexed_db/dartium/indexed_db_dartium.dart",
97 categories: "Client",
98 maturity: Maturity.WEB_STABLE,
99 dart2jsPath: "indexed_db/dart2js/indexed_db_dart2js.dart"),
100
101 "io": const LibraryInfo(
102 "io/io.dart",
103 categories: "Server",
104 dart2jsPatchPath: "_internal/js_runtime/lib/io_patch.dart"),
105
106 "isolate": const LibraryInfo(
107 "isolate/isolate.dart",
108 categories: "Client,Server",
109 maturity: Maturity.STABLE,
110 dart2jsPatchPath: "_internal/js_runtime/lib/isolate_patch.dart"),
111
112 "js": const LibraryInfo(
113 "js/dartium/js_dartium.dart",
114 categories: "Client",
115 maturity: Maturity.STABLE,
116 dart2jsPath: "js/dart2js/js_dart2js.dart"),
117
118 "js_util": const LibraryInfo(
119 "js_util/dartium/js_util_dartium.dart",
120 categories: "Client",
121 maturity: Maturity.STABLE,
122 dart2jsPath: "js_util/dart2js/js_util_dart2js.dart"),
123
124 "math": const LibraryInfo(
125 "math/math.dart",
126 categories: "Client,Server,Embedded",
127 maturity: Maturity.STABLE,
128 dart2jsPatchPath: "_internal/js_runtime/lib/math_patch.dart"),
129
130 "mirrors": const LibraryInfo(
131 "mirrors/mirrors.dart",
132 categories: "Client,Server",
133 maturity: Maturity.UNSTABLE,
134 dart2jsPatchPath: "_internal/js_runtime/lib/mirrors_patch.dart"),
135
136 "nativewrappers": const LibraryInfo(
137 "html/dartium/nativewrappers.dart",
138 categories: "Client",
139 implementation: true,
140 documented: false,
141 platforms: VM_PLATFORM),
142
143 "typed_data": const LibraryInfo(
144 "typed_data/typed_data.dart",
145 categories: "Client,Server,Embedded",
146 maturity: Maturity.STABLE,
147 dart2jsPatchPath: "_internal/js_runtime/lib/typed_data_patch.dart"),
148
149 "_native_typed_data": const LibraryInfo(
150 "_internal/js_runtime/lib/native_typed_data.dart",
151 categories: "",
152 implementation: true,
153 documented: false,
154 platforms: DART2JS_PLATFORM),
155
156 "svg": const LibraryInfo(
157 "svg/dartium/svg_dartium.dart",
158 categories: "Client",
159 maturity: Maturity.WEB_STABLE,
160 dart2jsPath: "svg/dart2js/svg_dart2js.dart"),
161
162 "web_audio": const LibraryInfo(
163 "web_audio/dartium/web_audio_dartium.dart",
164 categories: "Client",
165 maturity: Maturity.WEB_STABLE,
166 dart2jsPath: "web_audio/dart2js/web_audio_dart2js.dart"),
167
168 "web_gl": const LibraryInfo(
169 "web_gl/dartium/web_gl_dartium.dart",
170 categories: "Client",
171 maturity: Maturity.WEB_STABLE,
172 dart2jsPath: "web_gl/dart2js/web_gl_dart2js.dart"),
173
174 "web_sql": const LibraryInfo(
175 "web_sql/dartium/web_sql_dartium.dart",
176 categories: "Client",
177 maturity: Maturity.WEB_STABLE,
178 dart2jsPath: "web_sql/dart2js/web_sql_dart2js.dart"),
179
180 "_internal": const LibraryInfo(
181 "internal/internal.dart",
182 categories: "",
183 documented: false,
184 dart2jsPatchPath: "_internal/js_runtime/lib/internal_patch.dart"),
185
186 "_js_helper": const LibraryInfo(
187 "_internal/js_runtime/lib/js_helper.dart",
188 categories: "",
189 documented: false,
190 platforms: DART2JS_PLATFORM),
191
192 "_interceptors": const LibraryInfo(
193 "_internal/js_runtime/lib/interceptors.dart",
194 categories: "",
195 documented: false,
196 platforms: DART2JS_PLATFORM),
197
198 "_foreign_helper": const LibraryInfo(
199 "_internal/js_runtime/lib/foreign_helper.dart",
200 categories: "",
201 documented: false,
202 platforms: DART2JS_PLATFORM),
203
204 "_isolate_helper": const LibraryInfo(
205 "_internal/js_runtime/lib/isolate_helper.dart",
206 categories: "",
207 documented: false,
208 platforms: DART2JS_PLATFORM),
209
210 "_js_mirrors": const LibraryInfo(
211 "_internal/js_runtime/lib/js_mirrors.dart",
212 categories: "",
213 documented: false,
214 platforms: DART2JS_PLATFORM),
215
216 "_js_names": const LibraryInfo(
217 "_internal/js_runtime/lib/js_names.dart",
218 categories: "",
219 documented: false,
220 platforms: DART2JS_PLATFORM),
221
222 "_js_primitives": const LibraryInfo(
223 "_internal/js_runtime/lib/js_primitives.dart",
224 categories: "",
225 documented: false,
226 platforms: DART2JS_PLATFORM),
227
228 "_js_embedded_names": const LibraryInfo(
229 "_internal/js_runtime/lib/shared/embedded_names.dart",
230 categories: "",
231 documented: false,
232 platforms: DART2JS_PLATFORM),
233
234 "_async_await_error_codes": const LibraryInfo(
235 "_internal/js_runtime/lib/shared/async_await_error_codes.dart",
236 categories: "",
237 documented: false,
238 platforms: DART2JS_PLATFORM),
239
240 "_metadata": const LibraryInfo(
241 "html/html_common/metadata.dart",
242 categories: "",
243 documented: false,
244 platforms: DART2JS_PLATFORM),
245
246 "_debugger": const LibraryInfo(
247 "_internal/js_runtime/lib/debugger.dart",
248 category: "",
249 documented: false,
250 platforms: DART2JS_PLATFORM),
251
252 "_runtime": const LibraryInfo(
253 "_internal/js_runtime/lib/ddc_runtime/runtime.dart",
254 category: "",
255 documented: false,
256 platforms: DART2JS_PLATFORM),
257 };
258
259 /**
260 * Information about a "dart:" library.
261 */
262 class LibraryInfo {
263 /**
264 * Path to the library's *.dart file relative to this file.
265 */
266 final String path;
267
268 /**
269 * The categories in which the library can be used encoded as a
270 * comma-separated String.
271 */
272 final String _categories;
273
274 /**
275 * Path to the dart2js library's *.dart file relative to this file
276 * or null if dart2js uses the common library path defined above.
277 * Access using the [#getDart2JsPath()] method.
278 */
279 final String dart2jsPath;
280
281 /**
282 * Path to the dart2js library's patch file relative to this file
283 * or null if no dart2js patch file associated with this library.
284 * Access using the [#getDart2JsPatchPath()] method.
285 */
286 final String dart2jsPatchPath;
287
288 /**
289 * True if this library is documented and should be shown to the user.
290 */
291 final bool documented;
292
293 /**
294 * Bit flags indicating which platforms consume this library.
295 * See [DART2JS_LIBRARY] and [VM_LIBRARY].
296 */
297 final int platforms;
298
299 /**
300 * True if the library contains implementation details for another library.
301 * The implication is that these libraries are less commonly used
302 * and that tools like Dart Editor should not show these libraries
303 * in a list of all libraries unless the user specifically asks the tool to
304 * do so.
305 */
306 final bool implementation;
307
308 /**
309 * States the current maturity of this library.
310 */
311 final Maturity maturity;
312
313 const LibraryInfo(this.path, {
314 String categories: "",
315 this.dart2jsPath,
316 this.dart2jsPatchPath,
317 this.implementation: false,
318 this.documented: true,
319 this.maturity: Maturity.UNSPECIFIED,
320 this.platforms: DART2JS_PLATFORM | VM_PLATFORM})
321 : _categories = categories;
322
323 bool get isDart2jsLibrary => (platforms & DART2JS_PLATFORM) != 0;
324 bool get isVmLibrary => (platforms & VM_PLATFORM) != 0;
325
326 /**
327 * The categories in which the library can be used.
328 *
329 * If no categories are specified, the library is internal and can not be
330 * loaded by user code.
331 */
332 List<Category> get categories {
333 // `"".split(,)` returns [""] not [], so we handle that case separately.
334 if (_categories == "") return const <Category>[];
335 return _categories.split(",").map(parseCategory).toList();
336 }
337
338 bool get isInternal => categories.isEmpty;
339
340 /// The original "categories" String that was passed to the constructor.
341 ///
342 /// Can be used to construct a slightly modified copy of this LibraryInfo.
343 String get categoriesString {
344 return _categories;
345 }
346 }
347
348 /**
349 * Abstraction to capture the maturity of a library.
350 */
351 class Maturity {
352 final int level;
353 final String name;
354 final String description;
355
356 const Maturity(this.level, this.name, this.description);
357
358 String toString() => "$name: $level\n$description\n";
359
360 static const Maturity DEPRECATED = const Maturity(0, "Deprecated",
361 "This library will be remove before next major release.");
362
363 static const Maturity EXPERIMENTAL = const Maturity(1, "Experimental",
364 "This library is experimental and will likely change or be removed\n"
365 "in future versions.");
366
367 static const Maturity UNSTABLE = const Maturity(2, "Unstable",
368 "This library is in still changing and have not yet endured\n"
369 "sufficient real-world testing.\n"
370 "Backwards-compatibility is NOT guaranteed.");
371
372 static const Maturity WEB_STABLE = const Maturity(3, "Web Stable",
373 "This library is tracking the DOM evolution as defined by WC3.\n"
374 "Backwards-compatibility is NOT guaranteed.");
375
376 static const Maturity STABLE = const Maturity(4, "Stable",
377 "The library is stable. API backwards-compatibility is guaranteed.\n"
378 "However implementation details might change.");
379
380 static const Maturity LOCKED = const Maturity(5, "Locked",
381 "This library will not change except when serious bugs are encountered.");
382
383 static const Maturity UNSPECIFIED = const Maturity(-1, "Unspecified",
384 "The maturity for this library has not been specified.");
385 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698