Skip to content

Commit

Permalink
[fuchsia] Fixes for the Fuchsia build (flutter#6273)
Browse files Browse the repository at this point in the history
  • Loading branch information
zanderso authored Sep 17, 2018
1 parent dcbc8a8 commit dbfa827
Show file tree
Hide file tree
Showing 2 changed files with 145 additions and 131 deletions.
273 changes: 142 additions & 131 deletions lib/snapshot/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -25,148 +25,150 @@ copy("generate_dart_ui") {
]
}

# Fuchsia's snapshot requires a different platform with extra dart: libraries.
if (!is_fuchsia) {
compiled_action("generate_snapshot_bin") {
tool = "//third_party/dart/runtime/bin:gen_snapshot"
compiled_action("generate_snapshot_bin") {
tool = "//third_party/dart/runtime/bin:gen_snapshot"

if (is_fuchsia || is_fuchsia_host) {
platform_kernel = "$root_out_dir/flutter_runner_patched_sdk/platform_strong.dill"
} else {
platform_kernel = "$root_out_dir/flutter_patched_sdk/platform_strong.dill"
inputs = [
platform_kernel,
]
deps = [
":kernel_platform_files",
]

vm_snapshot_data = "$target_gen_dir/vm_isolate_snapshot.bin"
vm_snapshot_instructions = "$target_gen_dir/vm_snapshot_instructions.bin"
isolate_snapshot_data = "$target_gen_dir/isolate_snapshot.bin"
isolate_snapshot_instructions =
"$target_gen_dir/isolate_snapshot_instructions.bin"
outputs = [
vm_snapshot_data,
vm_snapshot_instructions,
isolate_snapshot_data,
isolate_snapshot_instructions,
]

args = [
"--strong",
"--sync-async",
"--reify-generic-functions",
"--snapshot_kind=core",
"--await_is_keyword",
"--enable_mirrors=false",
"--vm_snapshot_data=" + rebase_path(vm_snapshot_data),
"--vm_snapshot_instructions=" + rebase_path(vm_snapshot_instructions),
"--isolate_snapshot_data=" + rebase_path(isolate_snapshot_data),
"--isolate_snapshot_instructions=" +
rebase_path(isolate_snapshot_instructions),
rebase_path(platform_kernel),
]

if (is_debug) {
args += [
"--enable_asserts",
"--enable_type_checks",
"--error_on_bad_type",
"--error_on_bad_override",
]
}
}

# Generates an assembly file defining a given symbol with the bytes from a
# binary file. Places the symbol in a text section if 'executable' is true,
# otherwise places the symbol in a read-only data section.
template("bin_to_assembly") {
assert(defined(invoker.deps), "Must define deps")
assert(defined(invoker.input), "Must define input binary file")
assert(defined(invoker.output), "Must define output assembly file")
assert(defined(invoker.symbol), "Must define symbol name")
assert(defined(invoker.executable), "Must define boolean executable")

action(target_name) {
deps = invoker.deps
script = "//third_party/dart/runtime/tools/bin_to_assembly.py"
args = [
"--input",
rebase_path(invoker.input),
"--output",
rebase_path(invoker.output),
"--symbol_name",
invoker.symbol,
"--target_os",
current_os,
]
if (invoker.executable) {
args += [ "--executable" ]
}
inputs = [
script,
invoker.input,
]
outputs = [
invoker.output,
]
}
}
inputs = [
platform_kernel,
]
deps = [
":kernel_platform_files",
]

bin_to_assembly("vm_snapshot_data_assembly") {
deps = [
":generate_snapshot_bin",
]
input = "$target_gen_dir/vm_isolate_snapshot.bin"
output = "$target_gen_dir/vm_snapshot_data.S"
symbol = "kDartVmSnapshotData"
executable = false
}
vm_snapshot_data = "$target_gen_dir/vm_isolate_snapshot.bin"
vm_snapshot_instructions = "$target_gen_dir/vm_snapshot_instructions.bin"
isolate_snapshot_data = "$target_gen_dir/isolate_snapshot.bin"
isolate_snapshot_instructions =
"$target_gen_dir/isolate_snapshot_instructions.bin"
outputs = [
vm_snapshot_data,
vm_snapshot_instructions,
isolate_snapshot_data,
isolate_snapshot_instructions,
]

bin_to_assembly("vm_snapshot_instructions_assembly") {
deps = [
":generate_snapshot_bin",
]
input = "$target_gen_dir/vm_snapshot_instructions.bin"
output = "$target_gen_dir/vm_snapshot_instructions.S"
symbol = "kDartVmSnapshotInstructions"
executable = true
}
args = [
"--strong",
"--sync-async",
"--reify-generic-functions",
"--snapshot_kind=core",
"--await_is_keyword",
"--enable_mirrors=false",
"--vm_snapshot_data=" + rebase_path(vm_snapshot_data),
"--vm_snapshot_instructions=" + rebase_path(vm_snapshot_instructions),
"--isolate_snapshot_data=" + rebase_path(isolate_snapshot_data),
"--isolate_snapshot_instructions=" +
rebase_path(isolate_snapshot_instructions),
rebase_path(platform_kernel),
]

bin_to_assembly("isolate_snapshot_data_assembly") {
deps = [
":generate_snapshot_bin",
if (is_debug) {
args += [
"--enable_asserts",
"--enable_type_checks",
"--error_on_bad_type",
"--error_on_bad_override",
]
input = "$target_gen_dir/isolate_snapshot.bin"
output = "$target_gen_dir/isolate_snapshot_data.S"
symbol = "kDartIsolateSnapshotData"
executable = false
}
}

bin_to_assembly("isolate_snapshot_instructions_assembly") {
deps = [
":generate_snapshot_bin",
# Generates an assembly file defining a given symbol with the bytes from a
# binary file. Places the symbol in a text section if 'executable' is true,
# otherwise places the symbol in a read-only data section.
template("bin_to_assembly") {
assert(defined(invoker.deps), "Must define deps")
assert(defined(invoker.input), "Must define input binary file")
assert(defined(invoker.output), "Must define output assembly file")
assert(defined(invoker.symbol), "Must define symbol name")
assert(defined(invoker.executable), "Must define boolean executable")

action(target_name) {
deps = invoker.deps
script = "//third_party/dart/runtime/tools/bin_to_assembly.py"
args = [
"--input",
rebase_path(invoker.input),
"--output",
rebase_path(invoker.output),
"--symbol_name",
invoker.symbol,
"--target_os",
current_os,
]
input = "$target_gen_dir/isolate_snapshot_instructions.bin"
output = "$target_gen_dir/isolate_snapshot_instructions.S"
symbol = "kDartIsolateSnapshotInstructions"
executable = true
}

source_set("snapshot") {
deps = [
":isolate_snapshot_data_assembly",
":isolate_snapshot_instructions_assembly",
":vm_snapshot_data_assembly",
":vm_snapshot_instructions_assembly",
if (invoker.executable) {
args += [ "--executable" ]
}
inputs = [
script,
invoker.input,
]
sources = [
"$target_gen_dir/isolate_snapshot_data.S",
"$target_gen_dir/isolate_snapshot_instructions.S",
"$target_gen_dir/vm_snapshot_data.S",
"$target_gen_dir/vm_snapshot_instructions.S",
outputs = [
invoker.output,
]
}
}

bin_to_assembly("vm_snapshot_data_assembly") {
deps = [
":generate_snapshot_bin",
]
input = "$target_gen_dir/vm_isolate_snapshot.bin"
output = "$target_gen_dir/vm_snapshot_data.S"
symbol = "kDartVmSnapshotData"
executable = false
}

bin_to_assembly("vm_snapshot_instructions_assembly") {
deps = [
":generate_snapshot_bin",
]
input = "$target_gen_dir/vm_snapshot_instructions.bin"
output = "$target_gen_dir/vm_snapshot_instructions.S"
symbol = "kDartVmSnapshotInstructions"
executable = true
}

bin_to_assembly("isolate_snapshot_data_assembly") {
deps = [
":generate_snapshot_bin",
]
input = "$target_gen_dir/isolate_snapshot.bin"
output = "$target_gen_dir/isolate_snapshot_data.S"
symbol = "kDartIsolateSnapshotData"
executable = false
}

bin_to_assembly("isolate_snapshot_instructions_assembly") {
deps = [
":generate_snapshot_bin",
]
input = "$target_gen_dir/isolate_snapshot_instructions.bin"
output = "$target_gen_dir/isolate_snapshot_instructions.S"
symbol = "kDartIsolateSnapshotInstructions"
executable = true
}

source_set("snapshot") {
deps = [
":isolate_snapshot_data_assembly",
":isolate_snapshot_instructions_assembly",
":vm_snapshot_data_assembly",
":vm_snapshot_instructions_assembly",
]
sources = [
"$target_gen_dir/isolate_snapshot_data.S",
"$target_gen_dir/isolate_snapshot_instructions.S",
"$target_gen_dir/vm_snapshot_data.S",
"$target_gen_dir/vm_snapshot_instructions.S",
]
}

compile_platform("non_strong_platform") {
libraries_specification_uri = "libraries.json"

Expand Down Expand Up @@ -196,11 +198,20 @@ compile_platform("strong_platform") {
]
}

group("kernel_platform_files") {
public_deps = [
":non_strong_platform",
":strong_platform",
]
# Fuchsia's snapshot requires a different platform with extra dart: libraries.
if (is_fuchsia || is_fuchsia_host) {
group("kernel_platform_files") {
public_deps = [
"//topaz/runtime/flutter_runner/kernel:kernel_platform_files"
]
}
} else {
group("kernel_platform_files") {
public_deps = [
":non_strong_platform",
":strong_platform",
]
}
}

# Template to generate entry points JSON file using gen_snapshot tool.
Expand Down
3 changes: 3 additions & 0 deletions lib/ui/compositing/scene_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#include "flutter/lib/ui/compositing/scene_builder.h"

#include "flutter/flow/layers/backdrop_filter_layer.h"
#if defined(OS_FUCHSIA)
#include "flutter/flow/layers/child_scene_layer.h"
#endif
#include "flutter/flow/layers/clip_path_layer.h"
#include "flutter/flow/layers/clip_rect_layer.h"
#include "flutter/flow/layers/clip_rrect_layer.h"
Expand Down

0 comments on commit dbfa827

Please sign in to comment.