Skip to content

Commit dbfa827

Browse files
authored
[fuchsia] Fixes for the Fuchsia build (flutter#6273)
1 parent dcbc8a8 commit dbfa827

File tree

2 files changed

+145
-131
lines changed

2 files changed

+145
-131
lines changed

lib/snapshot/BUILD.gn

Lines changed: 142 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -25,148 +25,150 @@ copy("generate_dart_ui") {
2525
]
2626
}
2727

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

31+
if (is_fuchsia || is_fuchsia_host) {
32+
platform_kernel = "$root_out_dir/flutter_runner_patched_sdk/platform_strong.dill"
33+
} else {
3334
platform_kernel = "$root_out_dir/flutter_patched_sdk/platform_strong.dill"
34-
inputs = [
35-
platform_kernel,
36-
]
37-
deps = [
38-
":kernel_platform_files",
39-
]
40-
41-
vm_snapshot_data = "$target_gen_dir/vm_isolate_snapshot.bin"
42-
vm_snapshot_instructions = "$target_gen_dir/vm_snapshot_instructions.bin"
43-
isolate_snapshot_data = "$target_gen_dir/isolate_snapshot.bin"
44-
isolate_snapshot_instructions =
45-
"$target_gen_dir/isolate_snapshot_instructions.bin"
46-
outputs = [
47-
vm_snapshot_data,
48-
vm_snapshot_instructions,
49-
isolate_snapshot_data,
50-
isolate_snapshot_instructions,
51-
]
52-
53-
args = [
54-
"--strong",
55-
"--sync-async",
56-
"--reify-generic-functions",
57-
"--snapshot_kind=core",
58-
"--await_is_keyword",
59-
"--enable_mirrors=false",
60-
"--vm_snapshot_data=" + rebase_path(vm_snapshot_data),
61-
"--vm_snapshot_instructions=" + rebase_path(vm_snapshot_instructions),
62-
"--isolate_snapshot_data=" + rebase_path(isolate_snapshot_data),
63-
"--isolate_snapshot_instructions=" +
64-
rebase_path(isolate_snapshot_instructions),
65-
rebase_path(platform_kernel),
66-
]
67-
68-
if (is_debug) {
69-
args += [
70-
"--enable_asserts",
71-
"--enable_type_checks",
72-
"--error_on_bad_type",
73-
"--error_on_bad_override",
74-
]
75-
}
7635
}
7736

78-
# Generates an assembly file defining a given symbol with the bytes from a
79-
# binary file. Places the symbol in a text section if 'executable' is true,
80-
# otherwise places the symbol in a read-only data section.
81-
template("bin_to_assembly") {
82-
assert(defined(invoker.deps), "Must define deps")
83-
assert(defined(invoker.input), "Must define input binary file")
84-
assert(defined(invoker.output), "Must define output assembly file")
85-
assert(defined(invoker.symbol), "Must define symbol name")
86-
assert(defined(invoker.executable), "Must define boolean executable")
87-
88-
action(target_name) {
89-
deps = invoker.deps
90-
script = "//third_party/dart/runtime/tools/bin_to_assembly.py"
91-
args = [
92-
"--input",
93-
rebase_path(invoker.input),
94-
"--output",
95-
rebase_path(invoker.output),
96-
"--symbol_name",
97-
invoker.symbol,
98-
"--target_os",
99-
current_os,
100-
]
101-
if (invoker.executable) {
102-
args += [ "--executable" ]
103-
}
104-
inputs = [
105-
script,
106-
invoker.input,
107-
]
108-
outputs = [
109-
invoker.output,
110-
]
111-
}
112-
}
37+
inputs = [
38+
platform_kernel,
39+
]
40+
deps = [
41+
":kernel_platform_files",
42+
]
11343

114-
bin_to_assembly("vm_snapshot_data_assembly") {
115-
deps = [
116-
":generate_snapshot_bin",
117-
]
118-
input = "$target_gen_dir/vm_isolate_snapshot.bin"
119-
output = "$target_gen_dir/vm_snapshot_data.S"
120-
symbol = "kDartVmSnapshotData"
121-
executable = false
122-
}
44+
vm_snapshot_data = "$target_gen_dir/vm_isolate_snapshot.bin"
45+
vm_snapshot_instructions = "$target_gen_dir/vm_snapshot_instructions.bin"
46+
isolate_snapshot_data = "$target_gen_dir/isolate_snapshot.bin"
47+
isolate_snapshot_instructions =
48+
"$target_gen_dir/isolate_snapshot_instructions.bin"
49+
outputs = [
50+
vm_snapshot_data,
51+
vm_snapshot_instructions,
52+
isolate_snapshot_data,
53+
isolate_snapshot_instructions,
54+
]
12355

124-
bin_to_assembly("vm_snapshot_instructions_assembly") {
125-
deps = [
126-
":generate_snapshot_bin",
127-
]
128-
input = "$target_gen_dir/vm_snapshot_instructions.bin"
129-
output = "$target_gen_dir/vm_snapshot_instructions.S"
130-
symbol = "kDartVmSnapshotInstructions"
131-
executable = true
132-
}
56+
args = [
57+
"--strong",
58+
"--sync-async",
59+
"--reify-generic-functions",
60+
"--snapshot_kind=core",
61+
"--await_is_keyword",
62+
"--enable_mirrors=false",
63+
"--vm_snapshot_data=" + rebase_path(vm_snapshot_data),
64+
"--vm_snapshot_instructions=" + rebase_path(vm_snapshot_instructions),
65+
"--isolate_snapshot_data=" + rebase_path(isolate_snapshot_data),
66+
"--isolate_snapshot_instructions=" +
67+
rebase_path(isolate_snapshot_instructions),
68+
rebase_path(platform_kernel),
69+
]
13370

134-
bin_to_assembly("isolate_snapshot_data_assembly") {
135-
deps = [
136-
":generate_snapshot_bin",
71+
if (is_debug) {
72+
args += [
73+
"--enable_asserts",
74+
"--enable_type_checks",
75+
"--error_on_bad_type",
76+
"--error_on_bad_override",
13777
]
138-
input = "$target_gen_dir/isolate_snapshot.bin"
139-
output = "$target_gen_dir/isolate_snapshot_data.S"
140-
symbol = "kDartIsolateSnapshotData"
141-
executable = false
14278
}
79+
}
14380

144-
bin_to_assembly("isolate_snapshot_instructions_assembly") {
145-
deps = [
146-
":generate_snapshot_bin",
81+
# Generates an assembly file defining a given symbol with the bytes from a
82+
# binary file. Places the symbol in a text section if 'executable' is true,
83+
# otherwise places the symbol in a read-only data section.
84+
template("bin_to_assembly") {
85+
assert(defined(invoker.deps), "Must define deps")
86+
assert(defined(invoker.input), "Must define input binary file")
87+
assert(defined(invoker.output), "Must define output assembly file")
88+
assert(defined(invoker.symbol), "Must define symbol name")
89+
assert(defined(invoker.executable), "Must define boolean executable")
90+
91+
action(target_name) {
92+
deps = invoker.deps
93+
script = "//third_party/dart/runtime/tools/bin_to_assembly.py"
94+
args = [
95+
"--input",
96+
rebase_path(invoker.input),
97+
"--output",
98+
rebase_path(invoker.output),
99+
"--symbol_name",
100+
invoker.symbol,
101+
"--target_os",
102+
current_os,
147103
]
148-
input = "$target_gen_dir/isolate_snapshot_instructions.bin"
149-
output = "$target_gen_dir/isolate_snapshot_instructions.S"
150-
symbol = "kDartIsolateSnapshotInstructions"
151-
executable = true
152-
}
153-
154-
source_set("snapshot") {
155-
deps = [
156-
":isolate_snapshot_data_assembly",
157-
":isolate_snapshot_instructions_assembly",
158-
":vm_snapshot_data_assembly",
159-
":vm_snapshot_instructions_assembly",
104+
if (invoker.executable) {
105+
args += [ "--executable" ]
106+
}
107+
inputs = [
108+
script,
109+
invoker.input,
160110
]
161-
sources = [
162-
"$target_gen_dir/isolate_snapshot_data.S",
163-
"$target_gen_dir/isolate_snapshot_instructions.S",
164-
"$target_gen_dir/vm_snapshot_data.S",
165-
"$target_gen_dir/vm_snapshot_instructions.S",
111+
outputs = [
112+
invoker.output,
166113
]
167114
}
168115
}
169116

117+
bin_to_assembly("vm_snapshot_data_assembly") {
118+
deps = [
119+
":generate_snapshot_bin",
120+
]
121+
input = "$target_gen_dir/vm_isolate_snapshot.bin"
122+
output = "$target_gen_dir/vm_snapshot_data.S"
123+
symbol = "kDartVmSnapshotData"
124+
executable = false
125+
}
126+
127+
bin_to_assembly("vm_snapshot_instructions_assembly") {
128+
deps = [
129+
":generate_snapshot_bin",
130+
]
131+
input = "$target_gen_dir/vm_snapshot_instructions.bin"
132+
output = "$target_gen_dir/vm_snapshot_instructions.S"
133+
symbol = "kDartVmSnapshotInstructions"
134+
executable = true
135+
}
136+
137+
bin_to_assembly("isolate_snapshot_data_assembly") {
138+
deps = [
139+
":generate_snapshot_bin",
140+
]
141+
input = "$target_gen_dir/isolate_snapshot.bin"
142+
output = "$target_gen_dir/isolate_snapshot_data.S"
143+
symbol = "kDartIsolateSnapshotData"
144+
executable = false
145+
}
146+
147+
bin_to_assembly("isolate_snapshot_instructions_assembly") {
148+
deps = [
149+
":generate_snapshot_bin",
150+
]
151+
input = "$target_gen_dir/isolate_snapshot_instructions.bin"
152+
output = "$target_gen_dir/isolate_snapshot_instructions.S"
153+
symbol = "kDartIsolateSnapshotInstructions"
154+
executable = true
155+
}
156+
157+
source_set("snapshot") {
158+
deps = [
159+
":isolate_snapshot_data_assembly",
160+
":isolate_snapshot_instructions_assembly",
161+
":vm_snapshot_data_assembly",
162+
":vm_snapshot_instructions_assembly",
163+
]
164+
sources = [
165+
"$target_gen_dir/isolate_snapshot_data.S",
166+
"$target_gen_dir/isolate_snapshot_instructions.S",
167+
"$target_gen_dir/vm_snapshot_data.S",
168+
"$target_gen_dir/vm_snapshot_instructions.S",
169+
]
170+
}
171+
170172
compile_platform("non_strong_platform") {
171173
libraries_specification_uri = "libraries.json"
172174

@@ -196,11 +198,20 @@ compile_platform("strong_platform") {
196198
]
197199
}
198200

199-
group("kernel_platform_files") {
200-
public_deps = [
201-
":non_strong_platform",
202-
":strong_platform",
203-
]
201+
# Fuchsia's snapshot requires a different platform with extra dart: libraries.
202+
if (is_fuchsia || is_fuchsia_host) {
203+
group("kernel_platform_files") {
204+
public_deps = [
205+
"//topaz/runtime/flutter_runner/kernel:kernel_platform_files"
206+
]
207+
}
208+
} else {
209+
group("kernel_platform_files") {
210+
public_deps = [
211+
":non_strong_platform",
212+
":strong_platform",
213+
]
214+
}
204215
}
205216

206217
# Template to generate entry points JSON file using gen_snapshot tool.

lib/ui/compositing/scene_builder.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
#include "flutter/lib/ui/compositing/scene_builder.h"
66

77
#include "flutter/flow/layers/backdrop_filter_layer.h"
8+
#if defined(OS_FUCHSIA)
9+
#include "flutter/flow/layers/child_scene_layer.h"
10+
#endif
811
#include "flutter/flow/layers/clip_path_layer.h"
912
#include "flutter/flow/layers/clip_rect_layer.h"
1013
#include "flutter/flow/layers/clip_rrect_layer.h"

0 commit comments

Comments
 (0)