[fuchsia] Remove explicit LogSink and InspectSink routing and use dictionaries instead (#162780)

This is a Fuchsia change to prepare for future changes to the SDK.
LogSink and InspectSink will soon be routed through dictionaries, rather
than explicitly. For RealmBuilders, we need to route both the dictionary
and the protocol (to preserve compatibility). For CML files, we need to
use the shards in the SDK instead of using explicit routes. Once the SDK
shard is updated, then all SDK consumers should receive new routes.
However, not everyone will necessarily be updated at the same time,
which is the reason for keeping compatibility routes in RealmBuilder (to
prepare for the soft transition).

b/394681733

## Pre-launch Checklist

- [X] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [X] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [X] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [(Google employee)] I signed the [CLA].
- [X] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [X (exempt, SDK mechanical change only)] I added new tests to check
the change I am making, or this PR is [test-exempt].
- [X] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [X (unable to test on Fuchsia, I believe it has to be merged to be
tested)] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

---------

Co-authored-by: Chinmay Garde <chinmaygarde@google.com>
This commit is contained in:
gbbosak 2025-03-31 14:24:26 -05:00 committed by GitHub
parent b4543b7bf2
commit 8e3fee85a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 42 additions and 18 deletions

View File

@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
{
// TODO(https://fxbug.dev/404543928): Remove this shard usage when possible
// and replace with explicit routes.
include: [ "syslog/client.shard.cml" ],
use: [
// This is used by the Dart VM to communicate from Dart code to C++ code.
{
@ -26,9 +29,7 @@
protocol: [
"fuchsia.device.NameProvider", // For fdio uname()
"fuchsia.feedback.CrashReporter",
"fuchsia.inspect.InspectSink", // For inspect
"fuchsia.intl.PropertyProvider", // For dartVM timezone support
"fuchsia.logger.LogSink", // For syslog
"fuchsia.net.name.Lookup", // For fdio sockets
"fuchsia.posix.socket.Provider", // For fdio sockets
],

View File

@ -17,6 +17,7 @@ namespace {
// Types imported for the realm_builder library
using component_testing::ChildOptions;
using component_testing::ChildRef;
using component_testing::Dictionary;
using component_testing::Directory;
using component_testing::ParentRef;
using component_testing::Protocol;
@ -88,6 +89,11 @@ TEST_F(RealmBuilderTest, DartRunnerStartsUp) {
.source = ParentRef(),
.targets = {kDartAotRunnerRef, kDartAotEchoServerRef}});
realm_builder.AddRoute(
Route{.capabilities = {Dictionary{"diagnostics"}},
.source = ParentRef(),
.targets = {kDartAotRunnerRef, kDartAotEchoServerRef}});
// Route the Echo FIDL protocol, this allows the Dart echo server to
// communicate with the Realm Builder
realm_builder.AddRoute(Route{.capabilities = {Protocol{"dart.test.Echo"}},

View File

@ -10,6 +10,8 @@
// This test needs both the vulkan facet and the hermetic-tier-2 facet,
// so we are forced to make it a system test.
"sys/testing/system-test.shard.cml",
"syslog/client.shard.cml",
"inspect/client.shard.cml",
],
program: {
binary: "bin/app",
@ -19,8 +21,6 @@
// Offer capabilities needed by components in this test realm.
// Keep it minimal, describe only what's actually needed.
protocol: [
"fuchsia.inspect.InspectSink",
"fuchsia.logger.LogSink",
"fuchsia.sysmem.Allocator",
"fuchsia.sysmem2.Allocator",
"fuchsia.tracing.provider.Registry",

View File

@ -3,7 +3,7 @@
// found in the LICENSE file.
{
include: [ "syslog/client.shard.cml" ],
include: [ "syslog/client.shard.cml", "inspect/client.shard.cml" ],
program: {
data: "data/dart-aot-echo-server",
runner: "dart_aot_runner",

View File

@ -17,6 +17,7 @@ namespace {
// Types imported for the realm_builder library
using component_testing::ChildOptions;
using component_testing::ChildRef;
using component_testing::Dictionary;
using component_testing::Directory;
using component_testing::ParentRef;
using component_testing::Protocol;
@ -86,6 +87,11 @@ TEST_F(RealmBuilderTest, DartRunnerStartsUp) {
.source = ParentRef(),
.targets = {kDartJitRunnerRef, kDartJitEchoServerRef}});
realm_builder.AddRoute(
Route{.capabilities = {Dictionary{"diagnostics"}},
.source = ParentRef(),
.targets = {kDartJitRunnerRef, kDartJitEchoServerRef}});
// Route the Echo FIDL protocol, this allows the Dart echo server to
// communicate with the Realm Builder
realm_builder.AddRoute(Route{.capabilities = {Protocol{"dart.test.Echo"}},

View File

@ -19,8 +19,6 @@
// Offer capabilities needed by components in this test realm.
// Keep it minimal, describe only what's actually needed.
protocol: [
"fuchsia.inspect.InspectSink",
"fuchsia.logger.LogSink",
"fuchsia.sysmem.Allocator",
"fuchsia.sysmem2.Allocator",
"fuchsia.tracing.provider.Registry",

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file
{
include: [ "syslog/client.shard.cml", "inspect/client.shard.cml" ],
use: [
// This is used by the Dart VM to communicate from Dart code to C++ code.
{
@ -33,9 +34,7 @@
"fuchsia.device.NameProvider",
"fuchsia.feedback.CrashReporter",
"fuchsia.fonts.Provider",
"fuchsia.inspect.InspectSink", // Copied from inspect/client.shard.cml.
"fuchsia.intl.PropertyProvider",
"fuchsia.logger.LogSink", // Copied from syslog/client.shard.cml.
"fuchsia.media.ProfileProvider",
"fuchsia.memorypressure.Provider",
"fuchsia.scheduler.RoleManager",

View File

@ -9,6 +9,10 @@
// This test needs both the vulkan facet and the hermetic-tier-2 facet,
// so we are forced to make it a system test.
"sys/testing/system-test.shard.cml",
// TODO(https://fxbug.dev/404543928): Remove this shard usage when possible
// and replace with explicit routes.
"syslog/client.shard.cml",
"inspect/client.shard.cml",
],
program: {
binary: "bin/app",
@ -18,8 +22,6 @@
// Offer capabilities needed by components in this test realm.
// Keep it minimal, describe only what's actually needed.
protocol: [
"fuchsia.inspect.InspectSink",
"fuchsia.logger.LogSink",
"fuchsia.sysmem.Allocator",
"fuchsia.sysmem2.Allocator",
"fuchsia.tracing.provider.Registry",

View File

@ -9,6 +9,11 @@
// This test needs both the vulkan facet and the hermetic-tier-2 facet,
// so we are forced to make it a system test.
"sys/testing/system-test.shard.cml",
// TODO(https://fxbug.dev/404543928): Remove this shard usage when possible
// and replace with explicit routes.
"syslog/client.shard.cml",
"inspect/client.shard.cml",
],
program: {
binary: "bin/app",
@ -25,10 +30,8 @@
// Offer capabilities needed by components in this test realm.
// Keep it minimal, describe only what's actually needed.
protocol: [
"fuchsia.inspect.InspectSink",
"fuchsia.kernel.RootJobForInspect",
"fuchsia.kernel.Stats",
"fuchsia.logger.LogSink",
"fuchsia.scheduler.ProfileProvider",
"fuchsia.sysmem.Allocator",
"fuchsia.sysmem2.Allocator",

View File

@ -10,6 +10,10 @@
// so we are forced to make it a system test.
"sys/testing/system-test.shard.cml",
// TODO(https://fxbug.dev/404543928): Remove this shard usage when possible
// and replace with explicit routes.
"syslog/client.shard.cml",
"inspect/client.shard.cml",
],
program: {
binary: "bin/app",
@ -24,10 +28,8 @@
offer: [
{
protocol: [
"fuchsia.inspect.InspectSink",
"fuchsia.kernel.RootJobForInspect",
"fuchsia.kernel.Stats",
"fuchsia.logger.LogSink",
"fuchsia.scheduler.ProfileProvider",
"fuchsia.sysmem.Allocator",
"fuchsia.sysmem2.Allocator",

View File

@ -9,6 +9,11 @@
// This test needs both the vulkan facet and the hermetic-tier-2 facet,
// so we are forced to make it a system test.
"sys/testing/system-test.shard.cml",
// TODO(https://fxbug.dev/404543928): Remove this shard usage when possible
// and replace with explicit routes.
"syslog/client.shard.cml",
"inspect/client.shard.cml",
],
program: {
binary: "bin/app",
@ -25,10 +30,8 @@
// Offer capabilities needed by components in this test realm.
// Keep it minimal, describe only what's actually needed.
protocol: [
"fuchsia.inspect.InspectSink",
"fuchsia.kernel.RootJobForInspect",
"fuchsia.kernel.Stats",
"fuchsia.logger.LogSink",
"fuchsia.scheduler.ProfileProvider",
"fuchsia.sysmem.Allocator",
"fuchsia.sysmem2.Allocator",

View File

@ -1,6 +1,11 @@
{
include: [
"sys/component/realm_builder_absolute.shard.cml",
// TODO(https://fxbug.dev/404543928): Remove this shard usage when possible
// and replace with explicit routes.
"syslog/client.shard.cml",
"inspect/client.shard.cml",
],
facets: {
// shell_unittests and embedder_unittests require vulkan to function.
@ -31,7 +36,6 @@
use: [
{
protocol: [
"fuchsia.logger.LogSink",
"fuchsia.process.Launcher",
"fuchsia.tracing.provider.Registry",
"fuchsia.vulkan.loader.Loader",