[dart2js] Add --nnbd-strong SDK.

Change-Id: I31bfdfd3f2cfe04a940bc9374d88da53dbfc0090
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148150
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
This commit is contained in:
Mayank Patke 2020-05-15 00:37:45 +00:00 committed by commit-bot@chromium.org
parent f36ea511be
commit e16b45c550
5 changed files with 65 additions and 4 deletions

View file

@ -59,7 +59,11 @@ class KernelLoaderTask extends CompilerTask {
return measure(() async {
String targetName =
_options.compileForServer ? "dart2js_server" : "dart2js";
String platform = '${targetName}_platform.dill';
String platform = targetName;
if (_options.useNullSafety && !_options.useWeakNullSafetySemantics) {
platform += "_nnbd_strong";
}
platform += "_platform.dill";
var isDill = resolvedUri.path.endsWith('.dill');
ir.Component component;
if (isDill) {

View file

@ -345,13 +345,13 @@ class CompilerOptions implements DiagnosticOptions {
/// When null-safety is enabled, whether the compiler should emit code with
/// weak or strong semantics.
bool _useWeakNullSafetySemantics = true;
bool useWeakNullSafetySemantics = true;
/// Whether to use legacy subtype semantics rather than null-safe semantics.
/// This is `true` if null-safety is disabled, i.e. all code is legacy code,
/// or if weak null-safety semantics are being used, since we do not emit
/// warnings.
bool get useLegacySubtyping => !useNullSafety || _useWeakNullSafetySemantics;
bool get useLegacySubtyping => !useNullSafety || useWeakNullSafetySemantics;
/// The path to the file that contains the profiled allocations.
///
@ -469,7 +469,7 @@ class CompilerOptions implements DiagnosticOptions {
..codegenShards = _extractIntOption(options, '${Flags.codegenShards}=')
..cfeOnly = _hasOption(options, Flags.cfeOnly)
..debugGlobalInference = _hasOption(options, Flags.debugGlobalInference)
.._useWeakNullSafetySemantics = !_hasOption(options, Flags.nullSafety);
..useWeakNullSafetySemantics = !_hasOption(options, Flags.nullSafety);
}
void validate() {

View file

@ -619,11 +619,15 @@ copy("copy_dart2js_dill_files") {
deps = [
":copy_libraries",
"../utils/compiler:compile_dart2js_platform",
"../utils/compiler:compile_dart2js_nnbd_strong_platform",
"../utils/compiler:compile_dart2js_server_platform",
"../utils/compiler:compile_dart2js_server_nnbd_strong_platform",
]
sources = [
"$root_out_dir/dart2js_platform.dill",
"$root_out_dir/dart2js_nnbd_strong_platform.dill",
"$root_out_dir/dart2js_server_platform.dill",
"$root_out_dir/dart2js_server_nnbd_strong_platform.dill",
]
outputs = [ "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}" ]
}

View file

@ -203,6 +203,7 @@
".dart_tool/package_config.json",
"out/ReleaseX64/dart",
"out/ReleaseX64/dart2js_platform.dill",
"out/ReleaseX64/dart2js_nnbd_strong_platform.dill",
"out/ReleaseX64/dart2js_platform_strong.dill",
"pkg/",
"runtime/tests/",
@ -234,6 +235,7 @@
"tools/",
"xcodebuild/ReleaseX64/dart",
"xcodebuild/ReleaseX64/dart2js_platform.dill",
"xcodebuild/ReleaseX64/dart2js_nnbd_strong_platform.dill",
"xcodebuild/ReleaseX64/dart2js_platform_strong.dill"
],
"front-end": [

View file

@ -55,11 +55,14 @@ if (dont_use_nnbd) {
application_snapshot("dart2js") {
deps = [
":compile_dart2js_platform",
":compile_dart2js_nnbd_strong_platform",
":dart2js_create_snapshot_entry",
]
inputs = [
"$root_out_dir/dart2js_platform.dill",
"$root_out_dir/dart2js_outline.dill",
"$root_out_dir/dart2js_nnbd_strong_platform.dill",
"$root_out_dir/dart2js_nnbd_strong_outline.dill",
]
vm_args = []
main_dart = "$target_gen_dir/dart2js.dart"
@ -95,6 +98,30 @@ compile_platform("compile_dart2js_platform") {
args += [ "--enable-experiment=non-nullable" ]
}
}
compile_platform("compile_dart2js_nnbd_strong_platform") {
single_root_scheme = "org-dartlang-sdk"
single_root_base = rebase_path("../../")
libraries_specification_uri =
"org-dartlang-sdk:///$libraries_specification_path"
outputs = [
"$root_out_dir/dart2js_nnbd_strong_platform.dill",
"$root_out_dir/dart2js_nnbd_strong_outline.dill",
]
args = [
"--target=dart2js",
"--no-defines",
"dart:core",
]
if (!dont_use_nnbd) {
args += [
"--enable-experiment=non-nullable",
"--nnbd-strong",
]
}
}
compile_platform("compile_dart2js_server_platform") {
single_root_scheme = "org-dartlang-sdk"
single_root_base = rebase_path("../../")
@ -116,3 +143,27 @@ compile_platform("compile_dart2js_server_platform") {
args += [ "--enable-experiment=non-nullable" ]
}
}
compile_platform("compile_dart2js_server_nnbd_strong_platform") {
single_root_scheme = "org-dartlang-sdk"
single_root_base = rebase_path("../../")
libraries_specification_uri =
"org-dartlang-sdk:///$libraries_specification_path"
outputs = [
"$root_out_dir/dart2js_server_nnbd_strong_platform.dill",
"$root_out_dir/dart2js_server_nnbd_strong_outline.dill",
]
args = [
"--target=dart2js_server",
"--no-defines",
"dart:core",
]
if (!dont_use_nnbd) {
args += [
"--enable-experiment=non-nullable",
"--nnbd-strong",
]
}
}