Remove Observatory build rules and remaining references from the engine (#169945)

Work towards https://github.com/dart-lang/sdk/issues/50233

FYI @a-siva
This commit is contained in:
Ben Konyi 2025-06-03 17:09:30 -04:00 committed by GitHub
parent 2c51fce799
commit 51eef3db10
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 5 additions and 103 deletions

View File

@ -118,12 +118,6 @@ source_set("runtime") {
"//flutter/third_party/tonic",
"//flutter/txt",
]
if (flutter_runtime_mode != "release" && !is_fuchsia) {
# Only link in Observatory in non-release modes on non-Fuchsia. Fuchsia
# instead puts Observatory into the runner's package.
deps += [ "$dart_src/runtime/observatory:embedded_observatory_archive" ]
}
}
if (enable_unittests) {

View File

@ -28,23 +28,6 @@
#include "third_party/tonic/logging/dart_error.h"
#include "third_party/tonic/typed_data/typed_list.h"
namespace dart {
namespace observatory {
#if !OS_FUCHSIA && !FLUTTER_RELEASE
// These two symbols are defined in |observatory_archive.cc| which is generated
// by the |//third_party/dart/runtime/observatory:archive_observatory| rule.
// Both of these symbols will be part of the data segment and therefore are read
// only.
extern unsigned int observatory_assets_archive_len;
extern const uint8_t* observatory_assets_archive;
#endif // !OS_FUCHSIA && !FLUTTER_RELEASE
} // namespace observatory
} // namespace dart
namespace flutter {
// Arguments passed to the Dart VM in all configurations.
@ -158,26 +141,6 @@ bool DartFileModifiedCallback(const char* source_url, int64_t since_ms) {
void ThreadExitCallback() {}
Dart_Handle GetVMServiceAssetsArchiveCallback() {
#if FLUTTER_RELEASE
return nullptr;
#elif OS_FUCHSIA
fml::UniqueFD fd = fml::OpenFile("pkg/data/observatory.tar", false,
fml::FilePermission::kRead);
fml::FileMapping mapping(fd, {fml::FileMapping::Protection::kRead});
if (mapping.GetSize() == 0 || mapping.GetMapping() == nullptr) {
FML_LOG(ERROR) << "Fail to load Observatory archive";
return nullptr;
}
return tonic::DartConverter<tonic::Uint8List>::ToDart(mapping.GetMapping(),
mapping.GetSize());
#else
return tonic::DartConverter<tonic::Uint8List>::ToDart(
::dart::observatory::observatory_assets_archive,
::dart::observatory::observatory_assets_archive_len);
#endif
}
static const char kStdoutStreamId[] = "Stdout";
static const char kStderrStreamId[] = "Stderr";
@ -472,7 +435,6 @@ DartVM::DartVM(const std::shared_ptr<const DartVMData>& vm_data,
params.file_write = dart::bin::WriteFile;
params.file_close = dart::bin::CloseFile;
params.entropy_source = dart::bin::GetEntropy;
params.get_service_assets = GetVMServiceAssetsArchiveCallback;
DartVMInitializer::Initialize(&params,
settings_.enable_timeline_event_handler,
settings_.trace_systrace);

View File

@ -169,10 +169,6 @@ template("aot_runner_package") {
deps += [
"vmservice:vmservice_snapshot",
"//flutter/shell/platform/fuchsia/runtime/dart/profiler_symbols:dart_aot_runner",
# TODO(kaushikiska): Figure out how to get the profiler symbols for `libdart_aotruntime`
# "$dart_src/runtime:libdart_aotruntime",
observatory_target,
]
}
@ -195,10 +191,6 @@ template("aot_runner_package") {
path = vmservice_snapshot
dest = "vmservice_snapshot.so"
},
{
path = rebase_path(observatory_archive_file)
dest = "observatory.tar"
},
{
path = dart_profiler_symbols
dest = "dart_aot_runner.dartprofilersymbols"
@ -222,10 +214,7 @@ template("jit_runner_package") {
]
if (!invoker.product) {
deps += [
"//flutter/shell/platform/fuchsia/runtime/dart/profiler_symbols:dart_jit_runner",
observatory_target,
]
deps += [ "//flutter/shell/platform/fuchsia/runtime/dart/profiler_symbols:dart_jit_runner" ]
}
binary = "dart_jit${product_suffix}_runner"
@ -247,10 +236,6 @@ template("jit_runner_package") {
if (!invoker.product) {
resources += [
{
path = rebase_path(observatory_archive_file)
dest = "observatory.tar"
},
{
path = rebase_path(
get_label_info(

View File

@ -228,9 +228,6 @@ DartRunner::DartRunner(sys::ComponentContext* context) : context_(context) {
params.shutdown_isolate = IsolateShutdownCallback;
params.cleanup_group = IsolateGroupCleanupCallback;
params.entropy_source = EntropySource;
#if !defined(DART_PRODUCT)
params.get_service_assets = GetVMServiceAssetsArchiveCallback;
#endif
error = Dart_Initialize(&params);
if (error)
FML_LOG(FATAL) << "Dart_Initialize failed: " << error;

View File

@ -197,18 +197,4 @@ Dart_Isolate CreateServiceIsolate(
return isolate;
} // namespace dart_runner
Dart_Handle GetVMServiceAssetsArchiveCallback() {
dart_utils::MappedResource vm_service_tar;
if (!dart_utils::MappedResource::LoadFromNamespace(
nullptr, "/pkg/data/observatory.tar", vm_service_tar)) {
FML_LOG(ERROR) << "Failed to load Observatory assets";
return nullptr;
}
// TODO(rmacnak): Should we avoid copying the tar? Or does the service
// library not hold onto it anyway?
return tonic::DartConverter<tonic::Uint8List>::ToDart(
reinterpret_cast<const uint8_t*>(vm_service_tar.address()),
vm_service_tar.size());
}
} // namespace dart_runner

View File

@ -13,8 +13,6 @@ Dart_Isolate CreateServiceIsolate(const char* uri,
Dart_IsolateFlags* flags,
char** error);
Dart_Handle GetVMServiceAssetsArchiveCallback();
} // namespace dart_runner
#endif // FLUTTER_SHELL_PLATFORM_FUCHSIA_DART_RUNNER_SERVICE_ISOLATE_H_

View File

@ -312,10 +312,7 @@ template("jit_runner") {
]
if (!product) {
deps += [
"//flutter/shell/platform/fuchsia/runtime/dart/profiler_symbols:flutter_jit_runner",
observatory_target,
]
deps += [ "//flutter/shell/platform/fuchsia/runtime/dart/profiler_symbols:flutter_jit_runner" ]
}
binary = "flutter_jit${product_suffix}_runner"
@ -329,10 +326,6 @@ template("jit_runner") {
if (!product) {
resources += [
{
path = rebase_path(observatory_archive_file)
dest = "observatory.tar"
},
{
path = rebase_path(
get_label_info(
@ -381,10 +374,7 @@ template("aot_runner") {
deps = [ ":aot${product_suffix}" ]
if (!product) {
deps += [
"//flutter/shell/platform/fuchsia/runtime/dart/profiler_symbols:flutter_aot_runner",
observatory_target,
]
deps += [ "//flutter/shell/platform/fuchsia/runtime/dart/profiler_symbols:flutter_aot_runner" ]
}
binary = "flutter_aot${product_suffix}_runner"
@ -398,10 +388,6 @@ template("aot_runner") {
if (!product) {
resources += [
{
path = rebase_path(observatory_archive_file)
dest = "observatory.tar"
},
{
path = rebase_path(
get_label_info(

View File

@ -72,7 +72,7 @@ foreach(test, tests) {
group("dart") {
testonly = true
deps = [ "//flutter/testing/dart/observatory" ]
deps = [ "//flutter/testing/dart/vm_service" ]
foreach(test, tests) {
deps += [ ":compile_$test" ]
}

View File

@ -18,7 +18,7 @@ foreach(test, tests) {
}
}
group("observatory") {
group("vm_service") {
testonly = true
deps = []
foreach(test, tests) {

View File

@ -8,9 +8,3 @@ gen_snapshot = "$dart_src/runtime/bin:gen_snapshot"
gen_snapshot_product = "$dart_src/runtime/bin:gen_snapshot_product"
prebuilt_dart = "$dart_src/tools/sdks/dart-sdk/bin/dart"
observatory_target = "$dart_src/runtime/observatory:observatory_archive"
observatory_archive_dir = get_label_info(observatory_target, "target_gen_dir")
observatory_archive_name = get_label_info(observatory_target, "name")
observatory_archive_file =
"${observatory_archive_dir}/${observatory_archive_name}.tar"