sdk files reorganization to make dart2js a proper package

BUG=
R=brianwilkerson@google.com, floitsch@google.com, whesse@google.com

Review URL: https://codereview.chromium.org//1212513002.
This commit is contained in:
Sigmund Cherem 2015-06-29 10:21:14 -07:00
parent 21b65e700b
commit b18c5a3e7c
71 changed files with 444 additions and 392 deletions

View file

@ -28,7 +28,7 @@
'"^(?!.*pub/test).*dart$",'
'"sdk/lib"])',
'<!@(["python", "tools/list_files.py", "", '
'"sdk/lib/_internal/compiler/js_lib/preambles"])',
'"sdk/lib/_internal/js_runtime/lib/preambles"])',
'<!@(["python", "tools/list_files.py", "", "sdk/bin"])',
'tools/create_sdk.py',
'<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)dart<(EXECUTABLE_SUFFIX)',

View file

@ -103,10 +103,22 @@ class DirectoryBasedDartSdk implements DartSdk {
/**
* The name of the directory within the SDK directory that contains the
* libraries file.
* sdk_library_metadata directory.
*/
static String _INTERNAL_DIR = "_internal";
/**
* The name of the sdk_library_metadata directory that contains the package
* holding the libraries.dart file.
*/
static String _SDK_LIBRARY_METADATA_DIR = "sdk_library_metadata";
/**
* The name of the directory within the sdk_library_metadata that contains
* libraries.dart.
*/
static String _SDK_LIBRARY_METADATA_LIB_DIR = "lib";
/**
* The name of the directory within the SDK directory that contains the
* libraries.
@ -463,7 +475,11 @@ class DirectoryBasedDartSdk implements DartSdk {
*/
LibraryMap initialLibraryMap(bool useDart2jsPaths) {
JavaFile librariesFile = new JavaFile.relative(
new JavaFile.relative(libraryDirectory, _INTERNAL_DIR),
new JavaFile.relative(
new JavaFile.relative(
new JavaFile.relative(libraryDirectory, _INTERNAL_DIR),
_SDK_LIBRARY_METADATA_DIR),
_SDK_LIBRARY_METADATA_LIB_DIR),
_LIBRARIES_FILE);
try {
String contents = librariesFile.readAsStringSync();
@ -515,14 +531,15 @@ class DirectoryBasedDartSdk implements DartSdk {
/**
* An object used to read and parse the libraries file
* (dart-sdk/lib/_internal/libraries.dart) for information about the libraries
* in an SDK. The library information is represented as a Dart file containing a
* single top-level variable whose value is a const map. The keys of the map are
* the names of libraries defined in the SDK and the values in the map are info
* objects defining the library. For example, a subset of a typical SDK might
* have a libraries file that looks like the following:
* (dart-sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart) for information
* about the libraries in an SDK. The library information is represented as a
* Dart file containing a single top-level variable whose value is a const map.
* The keys of the map are the names of libraries defined in the SDK and the
* values in the map are info objects defining the library. For example, a
* subset of a typical SDK might have a libraries file that looks like the
* following:
*
* final Map&lt;String, LibraryInfo&gt; LIBRARIES = const &lt;LibraryInfo&gt; {
* final Map<String, LibraryInfo> LIBRARIES = const <LibraryInfo> {
* // Used by VM applications
* "builtin" : const LibraryInfo(
* "builtin/builtin_runtime.dart",

View file

@ -11,8 +11,8 @@ import '../compiler.dart' as api;
import 'dart2jslib.dart' as leg;
import 'tree/tree.dart' as tree;
import 'elements/elements.dart' as elements;
import 'package:_internal/libraries.dart' hide LIBRARIES;
import 'package:_internal/libraries.dart' as library_info show LIBRARIES;
import 'package:sdk_library_metadata/libraries.dart' hide LIBRARIES;
import 'package:sdk_library_metadata/libraries.dart' as library_info show LIBRARIES;
import 'io/source_file.dart';
import 'package:package_config/packages.dart';
import 'package:package_config/packages_file.dart' as pkgs;

View file

@ -31,7 +31,7 @@ import '../ssa/ssa.dart' show TypeMaskFactory;
import '../types/types.dart' show TypeMask;
import '../util/util.dart';
import 'package:_internal/compiler/js_lib/shared/embedded_names.dart'
import 'package:js_runtime/shared/embedded_names.dart'
show JsBuiltin, JsGetName;
import '../constants/values.dart';

View file

@ -18,7 +18,7 @@ import 'filenames.dart';
import 'util/uri_extras.dart';
import 'util/util.dart' show stackTraceFilePrefix;
import 'util/command_line.dart';
import 'package:_internal/libraries.dart';
import 'package:sdk_library_metadata/libraries.dart';
import 'package:package_config/discovery.dart' show findPackages;
const String LIBRARY_ROOT = '../../../../../sdk';

View file

@ -7,7 +7,7 @@ library rewrite_async;
import "dart:math" show max;
import 'dart:collection';
import 'package:_internal/compiler/js_lib/shared/async_await_error_codes.dart'
import 'package:js_runtime/shared/async_await_error_codes.dart'
as error_codes;
import "js.dart" as js;

View file

@ -7,10 +7,8 @@ library js_backend;
import 'dart:async' show EventSink, Future;
import 'dart:collection' show HashMap;
import 'package:_internal/compiler/js_lib/shared/embedded_names.dart'
as embeddedNames;
import 'package:_internal/compiler/js_lib/shared/embedded_names.dart'
show JsGetName;
import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames;
import 'package:js_runtime/shared/embedded_names.dart' show JsGetName;
import '../closure.dart';
import '../compile_time_constants.dart';

View file

@ -93,10 +93,8 @@ import '../util/util.dart' show
import '../deferred_load.dart' show
OutputUnit;
import 'package:_internal/compiler/js_lib/shared/embedded_names.dart'
as embeddedNames;
import 'package:_internal/compiler/js_lib/shared/embedded_names.dart' show
JsBuiltin;
import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames;
import 'package:js_runtime/shared/embedded_names.dart' show JsBuiltin;
import '../native/native.dart' as native;
part 'class_stub_generator.dart';

View file

@ -4,7 +4,7 @@
library dart2js.new_js_emitter.emitter;
import 'package:_internal/compiler/js_lib/shared/embedded_names.dart' show
import 'package:js_runtime/shared/embedded_names.dart' show
JsBuiltin,
METADATA,
TYPES;

View file

@ -15,7 +15,7 @@ import '../../js_backend/js_backend.dart' show
import '../js_emitter.dart' show AstContainer, NativeEmitter;
import 'package:_internal/compiler/js_lib/shared/embedded_names.dart' show
import 'package:js_runtime/shared/embedded_names.dart' show
CREATE_NEW_ISOLATE,
DEFERRED_LIBRARY_URIS,
DEFERRED_LIBRARY_HASHES,

View file

@ -102,9 +102,10 @@ import 'util/util.dart' show
* 'dart:core' and 'dart:_js_helper' are not readable themselves but are instead
* resolved into a readable URI using the library root URI provided from the
* command line and the list of platform libraries found in
* 'sdk/lib/_internal/libraries.dart'. This is done through the
* [Compiler.translateResolvedUri] method which checks whether a library by that
* name exists and in case of internal libraries whether access is granted.
* 'sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart'. This is done
* through the [Compiler.translateResolvedUri] method which checks whether a
* library by that name exists and in case of internal libraries whether access
* is granted.
*
* ## Resource URI ##
*

View file

@ -9,7 +9,7 @@
* [FunctionElement]. Patches are introduced in patch libraries which are loaded
* together with the corresponding origin library. Which libraries that are
* patched is determined by the dart2jsPatchPath field of LibraryInfo found
* in [:lib/_internal/libraries.dart:].
* in [:lib/_internal/sdk_library_metadata/lib/libraries.dart:].
*
* Patch libraries are parsed like regular library and thus provided with their
* own elements. These elements which are distinct from the elements from the

View file

@ -32,7 +32,7 @@ import '../types/constants.dart' show computeTypeMask;
import '../universe/universe.dart';
import '../util/util.dart';
import '../js/rewrite_async.dart';
import 'package:_internal/compiler/js_lib/shared/embedded_names.dart';
import 'package:js_runtime/shared/embedded_names.dart';
part 'builder.dart';
part 'codegen.dart';

View file

@ -2204,7 +2204,7 @@ Please include the following information:
static const MessageKind PREAMBLE = const MessageKind(
"When run on the command-line, the compiled output might"
" require a preamble file located in:\n"
" <sdk>/lib/_internal/compiler/js_lib/preambles.");
" <sdk>/lib/_internal/js_runtime/lib/preambles.");
static const MessageKind INVALID_SYNC_MODIFIER = const MessageKind(
"Invalid modifier 'sync'.",

23
pkg/compiler/pubspec.yaml Normal file
View file

@ -0,0 +1,23 @@
# This pubspec is currently mainly used to make it easier to develop on dart2js
# by making it a standalone package.
name: compiler
#version: do-not-upload
dependencies:
package_config: ^0.0.4
js_ast:
path: ../js_ast
js_runtime:
path: ../../sdk/lib/_internal/js_runtime
sdk_library_metadata:
path: ../../sdk/lib/_internal/sdk_library_metadata
# Uncomment if running gclient, so you can depend directly on the downloaded
# versions of dart2js's transitive dependencies:
#
# dependency_overrides:
# package_config:
# path: ../../third_party/pkg/package_config
# path:
# path: ../../third_party/pkg/path
# charcode:
# path: ../../third_party/pkg/charcode

View file

@ -32,7 +32,7 @@ import 'dart:io';
import 'dart:mirrors';
import 'package:_internal/libraries.dart'
import 'package:sdk_library_metadata/libraries.dart'
show LIBRARIES, LibraryInfo;
import 'package:compiler/src/mirrors/analyze.dart'

View file

@ -7,7 +7,7 @@ import 'dart:convert';
import 'dart:mirrors';
import 'package:_internal/libraries.dart'
import 'package:sdk_library_metadata/libraries.dart'
show LIBRARIES, LibraryInfo;
import '../../lib/src/mirrors/analyze.dart'

View file

@ -73,7 +73,7 @@ import 'package:compiler/src/js_emitter/model.dart' show
import 'package:compiler/src/js_emitter/program_builder.dart' show
ProgramBuilder;
import 'package:_internal/compiler/js_lib/shared/embedded_names.dart'
import 'package:js_runtime/shared/embedded_names.dart'
as embeddedNames;
import 'package:compiler/src/js_backend/js_backend.dart' show

View file

@ -4,4 +4,4 @@
library docgen.exports.libraries;
export '../../../../../sdk/lib/_internal/libraries.dart';
export 'package:sdk_library_metadata/libraries.dart';

View file

@ -19,7 +19,8 @@
'"../third_party/pkg_tested"])',
'<!@(["python", "../tools/list_pkg_directories.py", '
'"../runtime"])',
'../sdk/lib/_internal',
'../sdk/lib/_internal/js_runtime/lib',
'../sdk/lib/_internal/sdk_library_metadata/lib',
'../site/try',
],
'outputs': [

View file

@ -4,10 +4,10 @@ execute the preambles before executing the output of dart2js.
=Usage=
- d8:
d8 <sdk>/lib/_internal/compiler/js_lib/preambles/d8.js <output>.js
d8 <sdk>/lib/_internal/js_runtime/lib/preambles/d8.js <output>.js
- jsshell:
jsshell -f <sdk>/lib/_internal/compiler/js_lib/preambles/d8.js -f <output>.js
jsshell -f <sdk>/lib/_internal/js_runtime/lib/preambles/d8.js -f <output>.js
- node.js:
The d8 preamble file works for most programs.

View file

@ -0,0 +1,4 @@
# Note: This package is not meant to be uploaded to pub. This file is used to
# make it easer to develop on dart2js.
name: js_runtime
# version: do-not-upload

View file

@ -2,339 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/// This file moved under `sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart`.
@deprecated
library libraries;
/**
* A bit flag used by [LibraryInfo] indicating that a library is used by dart2js
*/
const int DART2JS_PLATFORM = 1;
/**
* A bit flag used by [LibraryInfo] indicating that a library is used by the VM
*/
const int VM_PLATFORM = 2;
/**
* Mapping of "dart:" library name (e.g. "core") to information about that library.
* This information is structured such that Dart Editor can parse this file
* and extract the necessary information without executing it
* while other tools can access via execution.
*/
const Map<String, LibraryInfo> LIBRARIES = const {
"async": const LibraryInfo(
"async/async.dart",
maturity: Maturity.STABLE,
dart2jsPatchPath: "_internal/compiler/js_lib/async_patch.dart"),
"_blink": const LibraryInfo(
"_blink/dartium/_blink_dartium.dart",
category: "Client",
implementation: true,
documented: false,
platforms: VM_PLATFORM),
"_chrome": const LibraryInfo(
"_chrome/dart2js/chrome_dart2js.dart",
documented: false,
category: "Client"),
"collection": const LibraryInfo(
"collection/collection.dart",
maturity: Maturity.STABLE,
dart2jsPatchPath: "_internal/compiler/js_lib/collection_patch.dart"),
"convert": const LibraryInfo(
"convert/convert.dart",
maturity: Maturity.STABLE,
dart2jsPatchPath: "_internal/compiler/js_lib/convert_patch.dart"),
"core": const LibraryInfo(
"core/core.dart",
maturity: Maturity.STABLE,
dart2jsPatchPath: "_internal/compiler/js_lib/core_patch.dart"),
"developer": const LibraryInfo(
"developer/developer.dart",
maturity: Maturity.UNSTABLE,
dart2jsPatchPath: "_internal/compiler/js_lib/developer_patch.dart"),
"html": const LibraryInfo(
"html/dartium/html_dartium.dart",
category: "Client",
maturity: Maturity.WEB_STABLE,
dart2jsPath: "html/dart2js/html_dart2js.dart"),
"html_common": const LibraryInfo(
"html/html_common/html_common.dart",
category: "Client",
maturity: Maturity.WEB_STABLE,
dart2jsPath: "html/html_common/html_common_dart2js.dart",
documented: false,
implementation: true),
"indexed_db": const LibraryInfo(
"indexed_db/dartium/indexed_db_dartium.dart",
category: "Client",
maturity: Maturity.WEB_STABLE,
dart2jsPath: "indexed_db/dart2js/indexed_db_dart2js.dart"),
"io": const LibraryInfo(
"io/io.dart",
category: "Server",
maturity: Maturity.STABLE,
dart2jsPatchPath: "_internal/compiler/js_lib/io_patch.dart"),
"isolate": const LibraryInfo(
"isolate/isolate.dart",
maturity: Maturity.STABLE,
dart2jsPatchPath: "_internal/compiler/js_lib/isolate_patch.dart"),
"js": const LibraryInfo(
"js/dartium/js_dartium.dart",
category: "Client",
maturity: Maturity.STABLE,
dart2jsPath: "js/dart2js/js_dart2js.dart"),
"math": const LibraryInfo(
"math/math.dart",
maturity: Maturity.STABLE,
dart2jsPatchPath: "_internal/compiler/js_lib/math_patch.dart"),
"mirrors": const LibraryInfo(
"mirrors/mirrors.dart",
maturity: Maturity.UNSTABLE,
dart2jsPatchPath: "_internal/compiler/js_lib/mirrors_patch.dart"),
"profiler": const LibraryInfo(
"profiler/profiler.dart",
maturity: Maturity.UNSTABLE),
"nativewrappers": const LibraryInfo(
"html/dartium/nativewrappers.dart",
category: "Client",
implementation: true,
documented: false,
platforms: VM_PLATFORM),
"typed_data": const LibraryInfo(
"typed_data/typed_data.dart",
maturity: Maturity.STABLE,
dart2jsPatchPath: "_internal/compiler/js_lib/typed_data_patch.dart"),
"_native_typed_data": const LibraryInfo(
"_internal/compiler/js_lib/native_typed_data.dart",
category: "Internal",
implementation: true,
documented: false,
platforms: DART2JS_PLATFORM),
"svg": const LibraryInfo(
"svg/dartium/svg_dartium.dart",
category: "Client",
maturity: Maturity.WEB_STABLE,
dart2jsPath: "svg/dart2js/svg_dart2js.dart"),
"web_audio": const LibraryInfo(
"web_audio/dartium/web_audio_dartium.dart",
category: "Client",
maturity: Maturity.WEB_STABLE,
dart2jsPath: "web_audio/dart2js/web_audio_dart2js.dart"),
"web_gl": const LibraryInfo(
"web_gl/dartium/web_gl_dartium.dart",
category: "Client",
maturity: Maturity.WEB_STABLE,
dart2jsPath: "web_gl/dart2js/web_gl_dart2js.dart"),
"web_sql": const LibraryInfo(
"web_sql/dartium/web_sql_dartium.dart",
category: "Client",
maturity: Maturity.WEB_STABLE,
dart2jsPath: "web_sql/dart2js/web_sql_dart2js.dart"),
"_internal": const LibraryInfo(
"internal/internal.dart",
category: "Internal",
documented: false,
dart2jsPatchPath:
"_internal/compiler/js_lib/internal_patch.dart"),
"_js_helper": const LibraryInfo(
"_internal/compiler/js_lib/js_helper.dart",
category: "Internal",
documented: false,
platforms: DART2JS_PLATFORM),
"_interceptors": const LibraryInfo(
"_internal/compiler/js_lib/interceptors.dart",
category: "Internal",
documented: false,
platforms: DART2JS_PLATFORM),
"_foreign_helper": const LibraryInfo(
"_internal/compiler/js_lib/foreign_helper.dart",
category: "Internal",
documented: false,
platforms: DART2JS_PLATFORM),
"_isolate_helper": const LibraryInfo(
"_internal/compiler/js_lib/isolate_helper.dart",
category: "Internal",
documented: false,
platforms: DART2JS_PLATFORM),
"_js_mirrors": const LibraryInfo(
"_internal/compiler/js_lib/js_mirrors.dart",
category: "Internal",
documented: false,
platforms: DART2JS_PLATFORM),
"_js_names": const LibraryInfo(
"_internal/compiler/js_lib/js_names.dart",
category: "Internal",
documented: false,
platforms: DART2JS_PLATFORM),
"_js_primitives": const LibraryInfo(
"_internal/compiler/js_lib/js_primitives.dart",
category: "Internal",
documented: false,
platforms: DART2JS_PLATFORM),
// TODO(ahe): This library is only for dart2dart, perhaps it should use a
// different platform.
"_mirror_helper": const LibraryInfo(
"_internal/compiler/js_lib/mirror_helper.dart",
category: "Internal",
documented: false,
platforms: DART2JS_PLATFORM),
"_js_embedded_names": const LibraryInfo(
"_internal/compiler/js_lib/shared/embedded_names.dart",
category: "Internal",
documented: false,
platforms: DART2JS_PLATFORM),
"_async_await_error_codes": const LibraryInfo(
"_internal/compiler/js_lib/shared/async_await_error_codes.dart",
category: "Internal",
documented: false,
platforms: DART2JS_PLATFORM),
"_metadata": const LibraryInfo(
"html/html_common/metadata.dart",
category: "Internal",
documented: false,
platforms: DART2JS_PLATFORM),
};
/**
* Information about a "dart:" library.
*/
class LibraryInfo {
/**
* Path to the library's *.dart file relative to this file.
*/
final String path;
/**
* The category in which the library should appear in the editor
* (e.g. "Shared", "Client", "Server", ...).
* If a category is not specified it defaults to "Shared".
*/
final String category;
/**
* Path to the dart2js library's *.dart file relative to this file
* or null if dart2js uses the common library path defined above.
* Access using the [#getDart2JsPath()] method.
*/
final String dart2jsPath;
/**
* Path to the dart2js library's patch file relative to this file
* or null if no dart2js patch file associated with this library.
* Access using the [#getDart2JsPatchPath()] method.
*/
final String dart2jsPatchPath;
/**
* True if this library is documented and should be shown to the user.
*/
final bool documented;
/**
* Bit flags indicating which platforms consume this library.
* See [DART2JS_LIBRARY] and [VM_LIBRARY].
*/
final int platforms;
/**
* True if the library contains implementation details for another library.
* The implication is that these libraries are less commonly used
* and that tools like Dart Editor should not show these libraries
* in a list of all libraries unless the user specifically asks the tool to
* do so.
*/
final bool implementation;
/**
* States the current maturity of this library.
*/
final Maturity maturity;
const LibraryInfo(this.path, {
this.category: "Shared",
this.dart2jsPath,
this.dart2jsPatchPath,
this.implementation: false,
this.documented: true,
this.maturity: Maturity.UNSPECIFIED,
this.platforms: DART2JS_PLATFORM | VM_PLATFORM});
bool get isDart2jsLibrary => (platforms & DART2JS_PLATFORM) != 0;
bool get isVmLibrary => (platforms & VM_PLATFORM) != 0;
}
/**
* Abstraction to capture the maturity of a library.
*/
class Maturity {
final int level;
final String name;
final String description;
const Maturity(this.level, this.name, this.description);
String toString() => "$name: $level\n$description\n";
static const Maturity DEPRECATED = const Maturity(0, "Deprecated",
"This library will be remove before next major release.");
static const Maturity EXPERIMENTAL = const Maturity(1, "Experimental",
"This library is experimental and will likely change or be removed\n"
"in future versions.");
static const Maturity UNSTABLE = const Maturity(2, "Unstable",
"This library is in still changing and have not yet endured\n"
"sufficient real-world testing.\n"
"Backwards-compatibility is NOT guaranteed.");
static const Maturity WEB_STABLE = const Maturity(3, "Web Stable",
"This library is tracking the DOM evolution as defined by WC3.\n"
"Backwards-compatibility is NOT guaranteed.");
static const Maturity STABLE = const Maturity(4, "Stable",
"The library is stable. API backwards-compatibility is guaranteed.\n"
"However implementation details might change.");
static const Maturity LOCKED = const Maturity(5, "Locked",
"This library will not change except when serious bugs are encountered.");
static const Maturity UNSPECIFIED = const Maturity(-1, "Unspecified",
"The maturity for this library has not been specified.");
}
export 'sdk_library_metadata/lib/libraries.dart';

View file

@ -0,0 +1,340 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
library libraries;
/**
* A bit flag used by [LibraryInfo] indicating that a library is used by dart2js
*/
const int DART2JS_PLATFORM = 1;
/**
* A bit flag used by [LibraryInfo] indicating that a library is used by the VM
*/
const int VM_PLATFORM = 2;
/**
* Mapping of "dart:" library name (e.g. "core") to information about that library.
* This information is structured such that Dart Editor can parse this file
* and extract the necessary information without executing it
* while other tools can access via execution.
*/
const Map<String, LibraryInfo> LIBRARIES = const {
"async": const LibraryInfo(
"async/async.dart",
maturity: Maturity.STABLE,
dart2jsPatchPath: "_internal/js_runtime/lib/async_patch.dart"),
"_blink": const LibraryInfo(
"_blink/dartium/_blink_dartium.dart",
category: "Client",
implementation: true,
documented: false,
platforms: VM_PLATFORM),
"_chrome": const LibraryInfo(
"_chrome/dart2js/chrome_dart2js.dart",
documented: false,
category: "Client"),
"collection": const LibraryInfo(
"collection/collection.dart",
maturity: Maturity.STABLE,
dart2jsPatchPath: "_internal/js_runtime/lib/collection_patch.dart"),
"convert": const LibraryInfo(
"convert/convert.dart",
maturity: Maturity.STABLE,
dart2jsPatchPath: "_internal/js_runtime/lib/convert_patch.dart"),
"core": const LibraryInfo(
"core/core.dart",
maturity: Maturity.STABLE,
dart2jsPatchPath: "_internal/js_runtime/lib/core_patch.dart"),
"developer": const LibraryInfo(
"developer/developer.dart",
maturity: Maturity.UNSTABLE,
dart2jsPatchPath: "_internal/js_runtime/lib/developer_patch.dart"),
"html": const LibraryInfo(
"html/dartium/html_dartium.dart",
category: "Client",
maturity: Maturity.WEB_STABLE,
dart2jsPath: "html/dart2js/html_dart2js.dart"),
"html_common": const LibraryInfo(
"html/html_common/html_common.dart",
category: "Client",
maturity: Maturity.WEB_STABLE,
dart2jsPath: "html/html_common/html_common_dart2js.dart",
documented: false,
implementation: true),
"indexed_db": const LibraryInfo(
"indexed_db/dartium/indexed_db_dartium.dart",
category: "Client",
maturity: Maturity.WEB_STABLE,
dart2jsPath: "indexed_db/dart2js/indexed_db_dart2js.dart"),
"io": const LibraryInfo(
"io/io.dart",
category: "Server",
maturity: Maturity.STABLE,
dart2jsPatchPath: "_internal/js_runtime/lib/io_patch.dart"),
"isolate": const LibraryInfo(
"isolate/isolate.dart",
maturity: Maturity.STABLE,
dart2jsPatchPath: "_internal/js_runtime/lib/isolate_patch.dart"),
"js": const LibraryInfo(
"js/dartium/js_dartium.dart",
category: "Client",
maturity: Maturity.STABLE,
dart2jsPath: "js/dart2js/js_dart2js.dart"),
"math": const LibraryInfo(
"math/math.dart",
maturity: Maturity.STABLE,
dart2jsPatchPath: "_internal/js_runtime/lib/math_patch.dart"),
"mirrors": const LibraryInfo(
"mirrors/mirrors.dart",
maturity: Maturity.UNSTABLE,
dart2jsPatchPath: "_internal/js_runtime/lib/mirrors_patch.dart"),
"profiler": const LibraryInfo(
"profiler/profiler.dart",
maturity: Maturity.UNSTABLE),
"nativewrappers": const LibraryInfo(
"html/dartium/nativewrappers.dart",
category: "Client",
implementation: true,
documented: false,
platforms: VM_PLATFORM),
"typed_data": const LibraryInfo(
"typed_data/typed_data.dart",
maturity: Maturity.STABLE,
dart2jsPatchPath: "_internal/js_runtime/lib/typed_data_patch.dart"),
"_native_typed_data": const LibraryInfo(
"_internal/js_runtime/lib/native_typed_data.dart",
category: "Internal",
implementation: true,
documented: false,
platforms: DART2JS_PLATFORM),
"svg": const LibraryInfo(
"svg/dartium/svg_dartium.dart",
category: "Client",
maturity: Maturity.WEB_STABLE,
dart2jsPath: "svg/dart2js/svg_dart2js.dart"),
"web_audio": const LibraryInfo(
"web_audio/dartium/web_audio_dartium.dart",
category: "Client",
maturity: Maturity.WEB_STABLE,
dart2jsPath: "web_audio/dart2js/web_audio_dart2js.dart"),
"web_gl": const LibraryInfo(
"web_gl/dartium/web_gl_dartium.dart",
category: "Client",
maturity: Maturity.WEB_STABLE,
dart2jsPath: "web_gl/dart2js/web_gl_dart2js.dart"),
"web_sql": const LibraryInfo(
"web_sql/dartium/web_sql_dartium.dart",
category: "Client",
maturity: Maturity.WEB_STABLE,
dart2jsPath: "web_sql/dart2js/web_sql_dart2js.dart"),
"_internal": const LibraryInfo(
"internal/internal.dart",
category: "Internal",
documented: false,
dart2jsPatchPath:
"_internal/js_runtime/lib/internal_patch.dart"),
"_js_helper": const LibraryInfo(
"_internal/js_runtime/lib/js_helper.dart",
category: "Internal",
documented: false,
platforms: DART2JS_PLATFORM),
"_interceptors": const LibraryInfo(
"_internal/js_runtime/lib/interceptors.dart",
category: "Internal",
documented: false,
platforms: DART2JS_PLATFORM),
"_foreign_helper": const LibraryInfo(
"_internal/js_runtime/lib/foreign_helper.dart",
category: "Internal",
documented: false,
platforms: DART2JS_PLATFORM),
"_isolate_helper": const LibraryInfo(
"_internal/js_runtime/lib/isolate_helper.dart",
category: "Internal",
documented: false,
platforms: DART2JS_PLATFORM),
"_js_mirrors": const LibraryInfo(
"_internal/js_runtime/lib/js_mirrors.dart",
category: "Internal",
documented: false,
platforms: DART2JS_PLATFORM),
"_js_names": const LibraryInfo(
"_internal/js_runtime/lib/js_names.dart",
category: "Internal",
documented: false,
platforms: DART2JS_PLATFORM),
"_js_primitives": const LibraryInfo(
"_internal/js_runtime/lib/js_primitives.dart",
category: "Internal",
documented: false,
platforms: DART2JS_PLATFORM),
// TODO(ahe): This library is only for dart2dart, perhaps it should use a
// different platform.
"_mirror_helper": const LibraryInfo(
"_internal/js_runtime/lib/mirror_helper.dart",
category: "Internal",
documented: false,
platforms: DART2JS_PLATFORM),
"_js_embedded_names": const LibraryInfo(
"_internal/js_runtime/lib/shared/embedded_names.dart",
category: "Internal",
documented: false,
platforms: DART2JS_PLATFORM),
"_async_await_error_codes": const LibraryInfo(
"_internal/js_runtime/lib/shared/async_await_error_codes.dart",
category: "Internal",
documented: false,
platforms: DART2JS_PLATFORM),
"_metadata": const LibraryInfo(
"html/html_common/metadata.dart",
category: "Internal",
documented: false,
platforms: DART2JS_PLATFORM),
};
/**
* Information about a "dart:" library.
*/
class LibraryInfo {
/**
* Path to the library's *.dart file relative to this file.
*/
final String path;
/**
* The category in which the library should appear in the editor
* (e.g. "Shared", "Client", "Server", ...).
* If a category is not specified it defaults to "Shared".
*/
final String category;
/**
* Path to the dart2js library's *.dart file relative to this file
* or null if dart2js uses the common library path defined above.
* Access using the [#getDart2JsPath()] method.
*/
final String dart2jsPath;
/**
* Path to the dart2js library's patch file relative to this file
* or null if no dart2js patch file associated with this library.
* Access using the [#getDart2JsPatchPath()] method.
*/
final String dart2jsPatchPath;
/**
* True if this library is documented and should be shown to the user.
*/
final bool documented;
/**
* Bit flags indicating which platforms consume this library.
* See [DART2JS_LIBRARY] and [VM_LIBRARY].
*/
final int platforms;
/**
* True if the library contains implementation details for another library.
* The implication is that these libraries are less commonly used
* and that tools like Dart Editor should not show these libraries
* in a list of all libraries unless the user specifically asks the tool to
* do so.
*/
final bool implementation;
/**
* States the current maturity of this library.
*/
final Maturity maturity;
const LibraryInfo(this.path, {
this.category: "Shared",
this.dart2jsPath,
this.dart2jsPatchPath,
this.implementation: false,
this.documented: true,
this.maturity: Maturity.UNSPECIFIED,
this.platforms: DART2JS_PLATFORM | VM_PLATFORM});
bool get isDart2jsLibrary => (platforms & DART2JS_PLATFORM) != 0;
bool get isVmLibrary => (platforms & VM_PLATFORM) != 0;
}
/**
* Abstraction to capture the maturity of a library.
*/
class Maturity {
final int level;
final String name;
final String description;
const Maturity(this.level, this.name, this.description);
String toString() => "$name: $level\n$description\n";
static const Maturity DEPRECATED = const Maturity(0, "Deprecated",
"This library will be remove before next major release.");
static const Maturity EXPERIMENTAL = const Maturity(1, "Experimental",
"This library is experimental and will likely change or be removed\n"
"in future versions.");
static const Maturity UNSTABLE = const Maturity(2, "Unstable",
"This library is in still changing and have not yet endured\n"
"sufficient real-world testing.\n"
"Backwards-compatibility is NOT guaranteed.");
static const Maturity WEB_STABLE = const Maturity(3, "Web Stable",
"This library is tracking the DOM evolution as defined by WC3.\n"
"Backwards-compatibility is NOT guaranteed.");
static const Maturity STABLE = const Maturity(4, "Stable",
"The library is stable. API backwards-compatibility is guaranteed.\n"
"However implementation details might change.");
static const Maturity LOCKED = const Maturity(5, "Locked",
"This library will not change except when serious bugs are encountered.");
static const Maturity UNSPECIFIED = const Maturity(-1, "Unspecified",
"The maturity for this library has not been specified.");
}

View file

@ -0,0 +1,4 @@
# Note: This package is not meant to be uploaded to pub. This file is used to
# make it easer to depend on libraries.dart from sdk packages like dart2js.
name: sdk_library_metadata
# version: do-not-upload

View file

@ -4,7 +4,7 @@
library analyze_api;
import '../../../sdk/lib/_internal/libraries.dart';
import 'package:sdk_library_metadata/libraries.dart';
import 'analyze_helper.dart';
import "package:async_helper/async_helper.dart";

View file

@ -24,7 +24,7 @@ import 'package:compiler/src/dart2jslib.dart' show
MessageKind,
NullSink;
import 'package:_internal/libraries.dart' show
import 'package:sdk_library_metadata/libraries.dart' show
DART2JS_PLATFORM,
LibraryInfo;

View file

@ -154,7 +154,7 @@ async_await_syntax_test/a05h: Fail # 23716
async_await_syntax_test/c11a: Fail # 23716
async_await_syntax_test/c11b: Fail # 23716
malformed_test/none: Fail # Expect failure in lib/_internal/compiler/js_lib/preambles/d8.js
malformed_test/none: Fail # Expect failure in lib/_internal/js_runtime/lib/preambles/d8.js
type_variable_conflict2_test/01: RuntimeError # Issue 19725

View file

@ -204,7 +204,8 @@ def Main():
for library in [join('_blink', 'dartium'),
join('_chrome', 'dart2js'), join('_chrome', 'dartium'),
join('_internal', 'compiler'),
join('_internal', 'js_runtime'),
join('_internal', 'sdk_library_metadata'),
'async', 'collection', 'convert', 'core', 'developer',
'internal', 'io', 'isolate',
join('html', 'dart2js'), join('html', 'dartium'),
@ -219,10 +220,6 @@ def Main():
ignore=ignore_patterns('*.svn', 'doc', '*.py', '*.gypi', '*.sh',
'.gitignore'))
# Copy lib/_internal/libraries.dart.
copyfile(join(HOME, 'sdk', 'lib', '_internal', 'libraries.dart'),
join(LIB, '_internal', 'libraries.dart'))
# Create and copy tools.
UTIL = join(SDK_tmp, 'util')
os.makedirs(UTIL)

View file

@ -279,7 +279,8 @@ class Dart2jsCompilerConfiguration extends Dart2xCompilerConfiguration {
Uri sdk = useSdk ?
nativeDirectoryToUri(buildDir).resolve('dart-sdk/') :
nativeDirectoryToUri(TestUtils.dartDir.toNativePath()).resolve('sdk/');
Uri preambleDir = sdk.resolve('lib/_internal/compiler/js_lib/preambles/');
Uri preambleDir = sdk.resolve(
'lib/_internal/js_runtime/lib/preambles/');
return runtimeConfiguration.dart2jsPreambles(preambleDir)
..add(artifact.filename);
}

View file

@ -1897,7 +1897,7 @@ class AnalyzeLibraryTestSuite extends DartcCompilationTestSuite {
// NOTE: We exclude tests and patch files for now.
return filename.endsWith(".dart") &&
!filename.endsWith("_test.dart") &&
!filename.contains("_internal/compiler/js_lib");
!filename.contains("_internal/js_runtime/lib");
}
bool get listRecursively => true;

View file

@ -17,7 +17,7 @@
'action_name': 'generate_analysis_server_snapshot',
'inputs': [
'<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)dart<(EXECUTABLE_SUFFIX)',
'../../sdk/lib/_internal/libraries.dart',
'../../sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart',
'<(SHARED_INTERMEDIATE_DIR)/packages.stamp',
'<(SHARED_INTERMEDIATE_DIR)/pkg_files.stamp',
],

View file

@ -20,12 +20,11 @@ import 'dart:io';
import 'html_diff.dart';
// TODO(rnystrom): Use "package:" URL (#4968).
import '../../pkg/compiler/lib/src/mirrors/source_mirrors.dart';
import '../../pkg/compiler/lib/src/mirrors/mirrors_util.dart';
import '../../pkg/compiler/lib/src/filenames.dart';
import '../../sdk/lib/_internal/dartdoc/lib/dartdoc.dart';
import '../../sdk/lib/_internal/libraries.dart';
import 'package:compiler/src/mirrors/source_mirrors.dart';
import 'package:compiler/src/mirrors/mirrors_util.dart';
import 'package:compiler/src/filenames.dart';
import 'package:dartdoc/dartdoc.dart';
import 'package:sdk_library_metadata/libraries.dart';
import 'package:path/path.dart' as path;
HtmlDiff _diff;

View file

@ -20,7 +20,7 @@
'action_name': 'generate_snapshots',
'inputs': [
'<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)dart<(EXECUTABLE_SUFFIX)',
'../../sdk/lib/_internal/libraries.dart',
'../../sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart',
'<!@(["python", "../../tools/list_files.py", "\\.dart$", "../../runtime/lib", "../../sdk/lib/_internal/dartdoc"])',
'create_snapshot.dart',
'<(SHARED_INTERMEDIATE_DIR)/dart2js_files.stamp',

View file

@ -16,7 +16,7 @@
'action_name': 'generate_dartfmt_snapshot',
'inputs': [
'<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)dart<(EXECUTABLE_SUFFIX)',
'../../sdk/lib/_internal/libraries.dart',
'../../sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart',
'<(SHARED_INTERMEDIATE_DIR)/packages.stamp',
'<!@(["python", "../../tools/list_files.py", "\\.dart$", "../../third_party/pkg_tested/dart_style"])',
],

View file

@ -18,7 +18,7 @@
'action_name': 'generate_pub_snapshot',
'inputs': [
'<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)dart<(EXECUTABLE_SUFFIX)',
'../../sdk/lib/_internal/libraries.dart',
'../../sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart',
'<(SHARED_INTERMEDIATE_DIR)/dart2js_files.stamp',
'<(SHARED_INTERMEDIATE_DIR)/pkg_files.stamp',
'<(SHARED_INTERMEDIATE_DIR)/packages.stamp',