Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 90a9750

Browse files
committed
[fuchsia] make dart_runner work with cfv2
Adds support for running the dart runner as a CFv2 component. The runner has been refactored to launch in both a v1 environemnt as well as a v2 environment.
1 parent e0426af commit 90a9750

File tree

15 files changed

+645
-198
lines changed

15 files changed

+645
-198
lines changed

shell/platform/fuchsia/dart-pkg/fuchsia/sdk_ext/fuchsia.cc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,13 @@ void Initialize(fidl::InterfaceHandle<fuchsia::sys::Environment> environment,
117117
dart_state->class_library().add_provider("fuchsia",
118118
std::move(fuchsia_class_provider));
119119

120-
result = Dart_SetField(
121-
library, ToDart("_environment"),
122-
ToDart(zircon::dart::Handle::Create(environment.TakeChannel())));
123-
FML_CHECK(!tonic::LogIfError(result));
120+
// v2 components do not use the environment
121+
if (environment) {
122+
result = Dart_SetField(
123+
library, ToDart("_environment"),
124+
ToDart(zircon::dart::Handle::Create(environment.TakeChannel())));
125+
FML_CHECK(!tonic::LogIfError(result));
126+
}
124127

125128
if (directory_request) {
126129
result = Dart_SetField(

shell/platform/fuchsia/dart_runner/BUILD.gn

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ template("runner") {
5858
"//flutter/fml",
5959
"//flutter/shell/platform/fuchsia/dart-pkg/fuchsia",
6060
"//flutter/shell/platform/fuchsia/dart-pkg/zircon",
61+
"$fuchsia_sdk_root/fidl:fuchsia.component.runner",
6162
"$fuchsia_sdk_root/pkg:async",
6263
"$fuchsia_sdk_root/pkg:async-cpp",
6364
"$fuchsia_sdk_root/pkg:async-default",
@@ -209,6 +210,7 @@ template("jit_runner_package") {
209210
binary = "dart_jit${product_suffix}_runner"
210211

211212
cmx_file = rebase_path("meta/dart_jit${product_suffix}_runner.cmx")
213+
cml_file = rebase_path("meta/dart_jit${product_suffix}_runner.cml")
212214

213215
libraries = common_libs
214216

0 commit comments

Comments
 (0)