Skip to content

Commit

Permalink
Revert "[fuchsia] Use the patched sdk to generate the flutter jit run…
Browse files Browse the repository at this point in the history
…ner far (flutter#10122)" (flutter#10140)

This reverts commit fcd6732.
  • Loading branch information
gaaclarke committed Jul 25, 2019
1 parent 89142b5 commit 876eff6
Show file tree
Hide file tree
Showing 5 changed files with 305 additions and 203 deletions.
2 changes: 1 addition & 1 deletion lib/snapshot/libraries.yaml
Expand Up @@ -5,7 +5,7 @@
# Note: if you edit this file, you must also edit libraries.json in this
# directory:
#
# python third_party/dart/tools/yaml2json.py flutter/lib/snapshot/libraries.yaml flutter/lib/snapshot/libraries.json
#. python third_party/dart/tools/yaml2json.py flutter/lib/snapshot/libraries.yaml flutter/lib/snapshot/libraries.json
#
# We currently have several different files that needs to be updated when
# changing libraries, sources, and patch files. See
Expand Down
5 changes: 2 additions & 3 deletions shell/platform/fuchsia/flutter/BUILD.gn
Expand Up @@ -155,12 +155,11 @@ template("jit_runner") {
}

package_dir(target_name) {
snapshot_gen_dir =
"$root_build_dir/gen/flutter/shell/platform/fuchsia/flutter/kernel"
snapshot_gen_dir = "$root_build_dir/gen/flutter/lib/snapshot"

deps = [
":jit${product_suffix}",
"kernel:kernel_core_snapshot",
"$flutter_root/lib/snapshot:generate_snapshot_bin",
]

binary = "flutter_jit${product_suffix}_runner"
Expand Down
123 changes: 109 additions & 14 deletions shell/platform/fuchsia/flutter/kernel/BUILD.gn
Expand Up @@ -2,15 +2,19 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/compiled_action.gni")
import("//build/fuchsia/sdk.gni")
import("//build/dart/dart_tool.gni")
import("//build/host.gni")
import("//third_party/dart/utils/compile_platform.gni")
import("//topaz/runtime/dart/dart_component.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"
single_root_base = rebase_path("../../../../../../")
single_root_base = rebase_path("../../../../")

libraries_specification_uri = "org-dartlang-sdk:///flutter/shell/platform/fuchsia/flutter/kernel/libraries.json"
libraries_specification_uri =
"org-dartlang-sdk:///topaz/runtime/flutter_runner/kernel/libraries.json"

outputs = [
"$root_out_dir/flutter_runner_patched_sdk/platform_strong.dill",
Expand All @@ -26,25 +30,42 @@ compile_platform("kernel_platform_files") {
]
}

dart_kernel("framework_shim") {
platform_name = "flutter_runner"
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
args = []

main_dart = "framework_shim.dart"
deps = [
"//third_party/dart-pkg/git/flutter/packages/flutter",
]
manifest = "$target_gen_dir/framework_shim.dilpmanifest"
}

template("core_snapshot") {
suffix = ""
assert(defined(invoker.product),
"core_snapshot requires 'product' to be defined")
assert(defined(invoker.framework),
"core_snapshot requires 'framework' to be defined")

suffix = ""
if (invoker.product) {
suffix = "${suffix}_product"
}
if (invoker.framework) {
suffix = "${suffix}_framework"
}

compiled_action(target_name) {
deps = [
":kernel_platform_files",
]
action(target_name) {
deps = gen_snapshot_deps + [ ":kernel_platform_files" ]

platform_dill =
"$root_out_dir/flutter_runner_patched_sdk/platform_strong.dill"
compilation_trace =
"$flutter_root/shell/platform/fuchsia/flutter/compilation_trace.txt"
compilation_trace = "//topaz/runtime/flutter_runner/compilation_trace.txt"
inputs = [
platform_dill,
compilation_trace,
Expand All @@ -65,8 +86,11 @@ template("core_snapshot") {
snapshot_profile,
]

tool = "//third_party/dart/runtime/bin:gen_snapshot"

if (invoker.product) {
script = gen_snapshot_product
} else {
script = gen_snapshot
}
args = [
# TODO(FL-117): Re-enable causal async stack traces when this issue is
# addressed.
Expand All @@ -88,8 +112,29 @@ template("core_snapshot") {
rebase_path(snapshot_profile, root_build_dir),
]

args += [ "--enable_asserts" ]
# No asserts in debug or release product.
# No asserts in release with flutter_profile=true (non-product)
# Yes asserts in non-product debug.
if (!invoker.product && (!flutter_profile || is_debug)) {
args += [ "--enable_asserts" ]
}
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" ]
}
}
}
}
}

Expand All @@ -112,3 +157,53 @@ core_snapshot("kernel_core_snapshot_product_framework") {
product = true
framework = true
}

dart_tool("extract_far") {
main_dart = "extract_far.dart"

force_prebuilt_dart = true
disable_analysis = 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" ]
}
}

0 comments on commit 876eff6

Please sign in to comment.