Revert "[flutter_runner] Optionally create the framework snapshot from a prebuilt Flutter program."
This reverts commit 8fb95d8614092fdfe1abe8d1ab8af33f57e9da2c.
Reason for revert: Doesn't work when enabled with use_prebuilt_dart_sdk = true
Original change's description:
> [flutter_runner] Optionally create the framework snapshot from a prebuilt Flutter program.
>
> Change-Id: I168fe5b7f321c8ca897f35b17a0b104f0554aefb
TBR=zra@google.com,rmacnak@google.com,fmeawad@google.com
Change-Id: I3627a323f4f8cb0b410fa51ff1f56ffb2281946d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
diff --git a/runtime/flutter_runner/BUILD.gn b/runtime/flutter_runner/BUILD.gn
index 24efc8b..dd5373f 100644
--- a/runtime/flutter_runner/BUILD.gn
+++ b/runtime/flutter_runner/BUILD.gn
@@ -4,12 +4,10 @@
assert(is_fuchsia)
-import("//build/package.gni")
import("//build/test/test_package.gni")
import("//build/testing/environments.gni")
import("//build/vulkan/config.gni")
import("//garnet/bin/ui/scenic/config.gni")
-import("//topaz/runtime/flutter_runner/prebuilt_framework.gni")
import("$flutter_root/shell/gpu/gpu.gni")
shell_gpu_configuration("fuchsia_gpu_configuration") {
@@ -172,11 +170,9 @@
"-fno-omit-frame-pointer",
]
- if (!invoker.product) {
- # This flag is needed so that the call to dladdr() in Dart's native symbol
- # resolver can report good symbol information for the CPU profiler.
- ldflags = [ "-rdynamic" ]
- }
+ # This flag is needed so that the call to dladdr() in Dart's native symbol
+ # resolver can report good symbol information for the CPU profiler.
+ ldflags = [ "-rdynamic" ]
}
}
@@ -218,6 +214,8 @@
]
}
+import("//build/package.gni")
+
observatory_target =
"//third_party/dart/runtime/observatory:observatory_archive"
observatory_archive_dir = get_label_info(observatory_target, "target_gen_dir")
@@ -282,6 +280,7 @@
deps = [
":jit${product_suffix}",
+ "//topaz/runtime/flutter_runner/kernel:framework_shim_kernel",
snapshot_framework_label,
snapshot_label,
]
@@ -334,32 +333,16 @@
dest = "framework_isolate_core_snapshot_instructions.bin"
},
{
+ path = rebase_path(
+ "$snapshot_gen_dir/framework_shim.dilpmanifest.frameworkversion")
+ dest = "runner.frameworkversion"
+ },
+ {
path = rebase_path("//third_party/icu/common/icudtl.dat")
dest = "icudtl.dat"
},
]
- if (prebuilt_framework_path == "") {
- deps += [ "//topaz/runtime/flutter_runner/kernel:framework_shim_kernel" ]
- resources += [
- {
- path = rebase_path(
- "$snapshot_gen_dir/framework_shim.dilpmanifest.frameworkversion")
- dest = "runner.frameworkversion"
- },
- ]
- } else {
- deps +=
- [ "//topaz/runtime/flutter_runner/kernel:extract_prebuilt_framework" ]
- resources += [
- {
- path = rebase_path(
- "$snapshot_gen_dir/data/$prebuilt_framework_name/app.frameworkversion")
- dest = "runner.frameworkversion"
- },
- ]
- }
-
if (!product) {
resources += [
{
diff --git a/runtime/flutter_runner/kernel/BUILD.gn b/runtime/flutter_runner/kernel/BUILD.gn
index 671a8e3..b040b32 100644
--- a/runtime/flutter_runner/kernel/BUILD.gn
+++ b/runtime/flutter_runner/kernel/BUILD.gn
@@ -3,10 +3,8 @@
# found in the LICENSE file.
import("//build/dart/dart_tool.gni")
-import("//build/host.gni")
import("//third_party/dart/utils/compile_platform.gni")
import("//topaz/runtime/dart/dart_kernel.gni")
-import("//topaz/runtime/flutter_runner/prebuilt_framework.gni")
compile_platform("kernel_platform_files") {
single_root_scheme = "org-dartlang-sdk"
@@ -31,8 +29,7 @@
dart_kernel("framework_shim") {
platform_name = "flutter_runner"
- platform_deps =
- [ "//topaz/runtime/flutter_runner/kernel:kernel_platform_files" ]
+ platform_deps = [ "//topaz/runtime/flutter_runner/kernel:kernel_platform_files" ]
platform_path = "$root_out_dir/flutter_runner_patched_sdk"
disable_analysis = true
gen_bytecode = true
@@ -62,21 +59,23 @@
action(target_name) {
deps = gen_snapshot_deps + [ ":kernel_platform_files" ]
- platform_dill =
- "$root_out_dir/flutter_runner_patched_sdk/platform_strong.dill"
+ platform_dill = "$root_out_dir/flutter_runner_patched_sdk/platform_strong.dill"
compilation_trace = "//topaz/runtime/flutter_runner/compilation_trace.txt"
inputs = [
platform_dill,
compilation_trace,
]
- vm_snapshot_data = "$target_gen_dir/vm_isolate_snapshot${suffix}.bin"
+ 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_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"
+ snapshot_profile =
+ "$target_gen_dir/snapshot_profile${suffix}.json"
outputs = [
vm_snapshot_data,
vm_snapshot_instructions,
@@ -116,19 +115,9 @@
args += [ rebase_path(platform_dill) ]
if (invoker.framework) {
- if (prebuilt_framework_path == "") {
- deps += [ ":framework_shim_kernel" ]
- inputs += [ "$target_gen_dir/framework_shim_kernel.dil" ]
- args += [ rebase_path("$target_gen_dir/framework_shim_kernel.dil") ]
- } else {
- deps += [ ":extract_prebuilt_framework" ]
- foreach(package, framework_packages) {
- args += [ rebase_path(
- "$target_gen_dir/data/$prebuilt_framework_name/$package.dilp") ]
- inputs +=
- [ "$target_gen_dir/data/$prebuilt_framework_name/$package.dilp" ]
- }
- }
+ deps += [ ":framework_shim_kernel" ]
+ inputs += [ "$target_gen_dir/framework_shim_kernel.dil" ]
+ args += [ rebase_path("$target_gen_dir/framework_shim_kernel.dil") ]
}
}
}
@@ -152,52 +141,3 @@
product = true
framework = true
}
-
-dart_tool("extract_far") {
- main_dart = "extract_far.dart"
-
- force_prebuilt_dart = true
-
- source_dir = "."
- sources = [
- "extract_far.dart",
- ]
-
- deps = [
- "//third_party/dart-pkg/pub/args",
- ]
-}
-
-if (prebuilt_framework_path != "") {
- action("extract_prebuilt_framework") {
- deps = [
- ":extract_far",
- "//garnet/bin/far:host",
- ]
-
- inputs = [
- prebuilt_framework_path,
- ]
-
- script = get_label_info(":extract_far", "root_out_dir") +
- "/dart-tools/extract_far"
- args = [
- "--far-tool",
- rebase_path("$host_tools_dir/far"),
- "--archive",
- rebase_path(prebuilt_framework_path),
- "--out-dir",
- rebase_path(target_gen_dir),
- ]
-
- outputs = []
- foreach(package, framework_packages) {
- args += [ "data/$prebuilt_framework_name/$package.dilp" ]
- outputs +=
- [ "$target_gen_dir/data/$prebuilt_framework_name/$package.dilp" ]
- }
- args += [ "data/$prebuilt_framework_name/app.frameworkversion" ]
- outputs +=
- [ "$target_gen_dir/data/$prebuilt_framework_name/app.frameworkversion" ]
- }
-}
diff --git a/runtime/flutter_runner/kernel/extract_far.dart b/runtime/flutter_runner/kernel/extract_far.dart
deleted file mode 100644
index 077dbca..0000000
--- a/runtime/flutter_runner/kernel/extract_far.dart
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2019 The Fuchsia Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-import "dart:io";
-
-import "package:args/args.dart";
-
-main(List<String> args) async {
- final parser = new ArgParser();
- parser.addOption("far-tool", help: "Path to `far` tool");
- parser.addOption("archive", help: "Path to the far archive to extract from");
- parser.addOption("out-dir", help: "Path to output directory");
- final usage = """
-Usage: extract_far.dart [options] {paths}
-
-Options:
-${parser.usage};
-""";
-
- ArgResults options;
- try {
- options = parser.parse(args);
- if (options["far-tool"] == null) {
- throw new Exception("Must specify --far-tool");
- }
- if (options["archive"] == null) {
- throw new Exception("Must specify --archive");
- }
- if (options["out-dir"] == null) {
- throw new Exception("Must specify --out-dir");
- }
- } catch (e) {
- print('ERROR: $e\n');
- print(usage);
- exitCode = 1;
- return;
- }
- run(options);
-}
-
-run(ArgResults options) async {
- final far = options["far-tool"];
-
- extract(String archive, String file, String output) async {
- await new File(output).parent.create(recursive: true);
- final args = ["extract-file", "--archive=$archive", "--file=$file", "--output=$output"];
- final result = await Process.run(far, args);
- if (result.exitCode != 0) {
- print(result.stdout);
- print(result.stderr);
- throw "Command failed: $far $args";
- }
- }
-
- final outerArchive = options["archive"];
- final outDir = options["out-dir"];
-
- final innerArchive = "$outDir/meta.far";
- await extract(outerArchive, "meta.far", innerArchive);
-
- final manifest = "$outDir/meta/contents";
- await extract(innerArchive, "meta/contents", manifest);
-
- final blobNames = new Map<String, String>();
- for (final line in await new File(manifest).readAsLines()) {
- final pivot = line.lastIndexOf("=");
- blobNames[line.substring(0, pivot)] = line.substring(pivot + 1, line.length);
- }
-
- for (final path in options.rest) {
- final blobName = blobNames[path];
- if (blobName == null) {
- print("Archive contents: ");
- for (final key in blobNames.keys) {
- print(key);
- }
- throw "$outerArchive does not contain $path";
- }
- await extract(outerArchive, blobName, "$outDir/$path");
- }
-}
diff --git a/runtime/flutter_runner/prebuilt_framework.gni b/runtime/flutter_runner/prebuilt_framework.gni
deleted file mode 100644
index edc389c..0000000
--- a/runtime/flutter_runner/prebuilt_framework.gni
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright 2019 The Fuchsia Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-declare_args() {
- prebuilt_framework_path = ""
- prebuilt_framework_name = ""
- framework_packages = [
- "collection",
- "flutter",
- "meta",
- "typed_data",
- "vector_math",
- ]
-}