Support running sound null safe kernels from flutter_jit_runner (flutter/engine#50002)
- use core vm snapshot instead of core-jit, which does not seem to support sound null safety agnostic mode - remove hardcoded `--no-sound-null-safety` flags from native code and ninja args - add `sound_null_safety` attribute to `flutter_component` in ninja, which propagates to `dart_kernel` - migrate one integration test to sound null safety, so that there are integration tests in both modes [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
@@ -349,21 +349,11 @@ template("jit_runner") {
|
||||
"$snapshot_gen_dir/vm_isolate_snapshot${product_suffix}.bin")
|
||||
dest = "vm_snapshot_data.bin"
|
||||
},
|
||||
{
|
||||
path = rebase_path(
|
||||
"$snapshot_gen_dir/vm_snapshot_instructions${product_suffix}.bin")
|
||||
dest = "vm_snapshot_instructions.bin"
|
||||
},
|
||||
{
|
||||
path = rebase_path(
|
||||
"$snapshot_gen_dir/isolate_snapshot${product_suffix}.bin")
|
||||
dest = "isolate_core_snapshot_data.bin"
|
||||
},
|
||||
{
|
||||
path = rebase_path(
|
||||
"$snapshot_gen_dir/isolate_snapshot_instructions${product_suffix}.bin")
|
||||
dest = "isolate_core_snapshot_instructions.bin"
|
||||
},
|
||||
]
|
||||
|
||||
_vulkan_icds = []
|
||||
|
||||
@@ -409,19 +409,10 @@ ComponentV2::ComponentV2(
|
||||
return MakeFileMapping("/pkg/data/vm_snapshot_data.bin",
|
||||
false /* executable */);
|
||||
};
|
||||
settings_.vm_snapshot_instr = []() {
|
||||
return MakeFileMapping("/pkg/data/vm_snapshot_instructions.bin",
|
||||
true /* executable */);
|
||||
};
|
||||
|
||||
settings_.isolate_snapshot_data = []() {
|
||||
return MakeFileMapping("/pkg/data/isolate_core_snapshot_data.bin",
|
||||
false /* executable */);
|
||||
};
|
||||
settings_.isolate_snapshot_instr = [] {
|
||||
return MakeFileMapping("/pkg/data/isolate_core_snapshot_instructions.bin",
|
||||
true /* executable */);
|
||||
};
|
||||
}
|
||||
|
||||
#if defined(DART_PRODUCT)
|
||||
@@ -487,10 +478,6 @@ ComponentV2::ComponentV2(
|
||||
|
||||
settings_.dart_flags = {};
|
||||
|
||||
// Run in unsound null safety mode as some packages used in Integration
|
||||
// testing have not been migrated yet.
|
||||
settings_.dart_flags.push_back("--no-sound-null-safety");
|
||||
|
||||
// Don't collect CPU samples from Dart VM C++ code.
|
||||
settings_.dart_flags.push_back("--no_profile_vm");
|
||||
|
||||
|
||||
@@ -44,17 +44,11 @@ template("core_snapshot") {
|
||||
inputs = [ platform_dill ]
|
||||
|
||||
vm_snapshot_data = "$target_gen_dir/vm_isolate_snapshot${suffix}.bin"
|
||||
vm_snapshot_instructions =
|
||||
"$target_gen_dir/vm_snapshot_instructions${suffix}.bin"
|
||||
isolate_snapshot_data = "$target_gen_dir/isolate_snapshot${suffix}.bin"
|
||||
isolate_snapshot_instructions =
|
||||
"$target_gen_dir/isolate_snapshot_instructions${suffix}.bin"
|
||||
snapshot_profile = "$target_gen_dir/snapshot_profile${suffix}.json"
|
||||
outputs = [
|
||||
vm_snapshot_data,
|
||||
vm_snapshot_instructions,
|
||||
isolate_snapshot_data,
|
||||
isolate_snapshot_instructions,
|
||||
snapshot_profile,
|
||||
]
|
||||
|
||||
@@ -68,14 +62,10 @@ template("core_snapshot") {
|
||||
args = [
|
||||
"--enable_mirrors=false",
|
||||
"--deterministic",
|
||||
"--snapshot_kind=core-jit",
|
||||
"--snapshot_kind=core",
|
||||
"--vm_snapshot_data=" + rebase_path(vm_snapshot_data, root_build_dir),
|
||||
"--vm_snapshot_instructions=" +
|
||||
rebase_path(vm_snapshot_instructions, root_build_dir),
|
||||
"--isolate_snapshot_data=" +
|
||||
rebase_path(isolate_snapshot_data, root_build_dir),
|
||||
"--isolate_snapshot_instructions=" +
|
||||
rebase_path(isolate_snapshot_instructions, root_build_dir),
|
||||
"--write_v8_snapshot_profile_to=" +
|
||||
rebase_path(snapshot_profile, root_build_dir),
|
||||
]
|
||||
|
||||
@@ -13,6 +13,7 @@ dart_library("lib") {
|
||||
package_name = "text-input-view"
|
||||
sources = [ "text_input_view.dart" ]
|
||||
deps = [ "//flutter/shell/platform/fuchsia/dart:args" ]
|
||||
null_safe = true
|
||||
}
|
||||
|
||||
flutter_component("component") {
|
||||
@@ -21,7 +22,7 @@ flutter_component("component") {
|
||||
manifest = rebase_path("meta/text-input-view.cml")
|
||||
main_package = "text-input-view"
|
||||
main_dart = "text_input_view.dart"
|
||||
|
||||
sound_null_safety = true
|
||||
deps = [ ":lib" ]
|
||||
}
|
||||
|
||||
|
||||
@@ -26,9 +26,11 @@ final Map<int, String> hidToKey = {
|
||||
};
|
||||
|
||||
int main() {
|
||||
print('Launching text-input-view');
|
||||
final bool soundNullSafety = <int?>[null] is! List<int>;
|
||||
print('Launching text-input-view. Sound null safety: $soundNullSafety');
|
||||
TestApp app = TestApp();
|
||||
app.run();
|
||||
return 0;
|
||||
}
|
||||
|
||||
class TestApp {
|
||||
@@ -37,8 +39,9 @@ class TestApp {
|
||||
|
||||
void run() {
|
||||
// Set up window callbacks
|
||||
window.onPlatformMessage = (String name, ByteData data, PlatformMessageResponseCallback callback) {
|
||||
this.decodeAndReportPlatformMessage(name, data);
|
||||
window.onPlatformMessage =
|
||||
(String name, ByteData? data, PlatformMessageResponseCallback? callback) {
|
||||
this.decodeAndReportPlatformMessage(name, data!);
|
||||
};
|
||||
window.onMetricsChanged = () {
|
||||
window.scheduleFrame();
|
||||
@@ -81,7 +84,7 @@ class TestApp {
|
||||
|
||||
if (name == "flutter/keyevent" && decodedJson["type"] == "keydown") {
|
||||
if (hidToKey[decodedJson["hidUsage"]] != null) {
|
||||
_reportTextInput(hidToKey[decodedJson["hidUsage"]]);
|
||||
_reportTextInput(hidToKey[decodedJson["hidUsage"]!]!);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,10 +94,14 @@ class TestApp {
|
||||
void _reportTextInput(String text) {
|
||||
print('text-input-view reporting keyboard input to KeyboardInputListener');
|
||||
|
||||
final message = utf8.encode(json.encode({
|
||||
'method': 'KeyboardInputListener.ReportTextInput',
|
||||
'text': text,
|
||||
})).buffer.asByteData();
|
||||
PlatformDispatcher.instance.sendPlatformMessage('fuchsia/input_test', message, null);
|
||||
final message = utf8
|
||||
.encode(json.encode({
|
||||
'method': 'KeyboardInputListener.ReportTextInput',
|
||||
'text': text,
|
||||
}))
|
||||
.buffer
|
||||
.asByteData();
|
||||
PlatformDispatcher.instance
|
||||
.sendPlatformMessage('fuchsia/input_test', message, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +134,10 @@ template("_convert_kernel_manifest") {
|
||||
# link_platform (optional)
|
||||
# Whether the kernel compiler should link the current platform.dill into
|
||||
# the build. If false, the --no-link-platform flag will be passed to the
|
||||
# compiler. Defaults to false
|
||||
# compiler. Defaults to false.
|
||||
#
|
||||
# sound_null_safety (optional)
|
||||
# Whether to generate sound null safe kernel.
|
||||
template("dart_kernel") {
|
||||
assert(defined(invoker.platform_name), "dart_kernel() requires platform_name")
|
||||
assert(defined(invoker.packages_path),
|
||||
@@ -258,7 +261,6 @@ template("dart_kernel") {
|
||||
}
|
||||
args += [
|
||||
"--verbosity=warning",
|
||||
"--no-sound-null-safety",
|
||||
"--target",
|
||||
invoker.platform_name,
|
||||
"--platform",
|
||||
@@ -278,6 +280,10 @@ template("dart_kernel") {
|
||||
rebase_path(_kernel_path, root_build_dir),
|
||||
]
|
||||
|
||||
if (!defined(invoker.sound_null_safety) || !invoker.sound_null_safety) {
|
||||
args += [ "--no-sound-null-safety" ]
|
||||
}
|
||||
|
||||
# TODO(richkadel): It should be possible to remove all of the build rules
|
||||
# related to `generate_manifest`. Without the following two flags, the
|
||||
# `gen_kernel` step will produce one large `.dil` file, instead of multiple
|
||||
|
||||
@@ -84,6 +84,9 @@ import("//flutter/tools/fuchsia/flutter/internal/flutter_dart_component.gni")
|
||||
# Specifies the parameters for building the component.
|
||||
# See //flutter/tools/fuchsia/flutter/flutter_build_config.gni for predefined configs.
|
||||
#
|
||||
# sound_null_safety (optional)
|
||||
# Whether to generate sound null safe Dart kernel.
|
||||
#
|
||||
# deps
|
||||
# testonly
|
||||
# visibility
|
||||
|
||||
@@ -48,6 +48,9 @@ import("//flutter/tools/fuchsia/gn-sdk/component.gni")
|
||||
# Type: boolean
|
||||
# Default: false
|
||||
#
|
||||
# sound_null_safety (optional)
|
||||
# If true, generate sound null safe Dart kernel.
|
||||
#
|
||||
# deps
|
||||
# testonly
|
||||
# visibility
|
||||
@@ -144,6 +147,7 @@ template("flutter_dart_component") {
|
||||
"visibility",
|
||||
"main_dart",
|
||||
"main_package",
|
||||
"sound_null_safety",
|
||||
])
|
||||
|
||||
deps = [ ":$_dart_package_config_target_name" ]
|
||||
|
||||
Reference in New Issue
Block a user