@@ -25,197 +25,143 @@ copy("generate_dart_ui") {
25
25
]
26
26
}
27
27
28
- action (" generate_snapshot_bin" ) {
29
- if (is_fuchsia ) {
30
- snapshot_dart = " snapshot_fuchsia.dart"
31
-
32
- # TODO(rmacnak ): Fuchsia cross builds use the wrong Dart target
33
- # architecture, and have added steps that depend on this error for
34
- # reasonable build times (e.g., invoking the analyzer).
35
- if (target_cpu == host_cpu ) {
36
- snapshot_kind = " core-jit"
37
- } else {
38
- snapshot_kind = " core"
39
- }
40
- } else {
41
- snapshot_dart = " snapshot.dart"
42
- snapshot_kind = " core"
43
- }
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"
44
32
45
- deps = [
46
- " :generate_dart_ui" ,
47
- " //third_party/dart/runtime/bin:gen_snapshot($host_toolchain )" ,
48
- ]
49
- depfile = " $target_gen_dir /core_snapshot.d"
50
-
51
- inputs = [
52
- " //third_party/dart/runtime/tools/create_snapshot_bin.py" ,
53
- snapshot_dart ,
54
- ] + dart_ui_files
55
- if (is_fuchsia ) {
56
- inputs += [ " fuchsia_compilation_trace.txt" ]
57
- }
33
+ platform_kernel = " $root_out_dir /flutter_patched_sdk/platform_strong.dill"
34
+ inputs = [
35
+ platform_kernel ,
36
+ ]
37
+ deps = [
38
+ " :kernel_platform_files" ,
39
+ ]
58
40
59
- vm_snapshot_data = " $target_gen_dir /vm_isolate_snapshot.bin"
60
- vm_snapshot_instructions = " $target_gen_dir /vm_snapshot_instructions.bin"
61
- isolate_snapshot_data = " $target_gen_dir /isolate_snapshot.bin"
62
- isolate_snapshot_instructions =
63
- " $target_gen_dir /isolate_snapshot_instructions.bin"
64
- outputs = [
65
- vm_snapshot_data ,
66
- vm_snapshot_instructions ,
67
- isolate_snapshot_data ,
68
- isolate_snapshot_instructions ,
69
- ]
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
+ ]
70
52
71
- rebased_dart_ui_path = rebase_path (dart_ui_path )
53
+ args = [
54
+ " --snapshot_kind=core" ,
55
+ " --await_is_keyword" ,
56
+ " --enable_mirrors=false" ,
57
+ " --vm_snapshot_data=" + rebase_path (vm_snapshot_data ),
58
+ " --vm_snapshot_instructions=" + rebase_path (vm_snapshot_instructions ),
59
+ " --isolate_snapshot_data=" + rebase_path (isolate_snapshot_data ),
60
+ " --isolate_snapshot_instructions=" +
61
+ rebase_path (isolate_snapshot_instructions ),
62
+ rebase_path (platform_kernel ),
63
+ ]
72
64
73
- gen_snapshot_dir = get_label_info (
74
- " //third_party/dart/runtime/bin:gen_snapshot($host_toolchain )" ,
75
- " root_out_dir" )
76
- script = " //third_party/dart/runtime/tools/create_snapshot_bin.py"
65
+ if (is_debug ) {
66
+ args += [
67
+ " --enable_asserts" ,
68
+ " --enable_type_checks" ,
69
+ " --error_on_bad_type" ,
70
+ " --error_on_bad_override" ,
71
+ ]
72
+ }
73
+ }
77
74
78
- args = [
79
- " --executable" ,
80
- rebase_path (" $gen_snapshot_dir /gen_snapshot" ),
81
- " --script" ,
82
- rebase_path (snapshot_dart ),
83
- " --snapshot_kind" ,
84
- snapshot_kind ,
85
- " --vm_flag" ,
86
- " --await_is_keyword" ,
87
- " --vm_flag" ,
88
- " --enable_mirrors=false" ,
89
- " --vm_output_bin" ,
90
- rebase_path (vm_snapshot_data , root_build_dir ),
91
- " --vm_instructions_output_bin" ,
92
- rebase_path (vm_snapshot_instructions , root_build_dir ),
93
- " --isolate_output_bin" ,
94
- rebase_path (isolate_snapshot_data , root_build_dir ),
95
- " --isolate_instructions_output_bin" ,
96
- rebase_path (isolate_snapshot_instructions , root_build_dir ),
97
- " --url_mapping=dart:ui,$rebased_dart_ui_path " ,
98
- " --vm_flag" ,
99
- " --dependencies=" + rebase_path (depfile ),
100
- ]
75
+ # Generates an assembly file defining a given symbol with the bytes from a
76
+ # binary file. Places the symbol in a text section if 'executable' is true,
77
+ # otherwise places the symbol in a read-only data section.
78
+ template (" bin_to_assembly" ) {
79
+ assert (defined (invoker .deps ), " Must define deps" )
80
+ assert (defined (invoker .input ), " Must define input binary file" )
81
+ assert (defined (invoker .output ), " Must define output assembly file" )
82
+ assert (defined (invoker .symbol ), " Must define symbol name" )
83
+ assert (defined (invoker .executable ), " Must define boolean executable" )
84
+
85
+ action (target_name ) {
86
+ deps = invoker .deps
87
+ script = " //third_party/dart/runtime/tools/bin_to_assembly.py"
88
+ args = [
89
+ " --input" ,
90
+ rebase_path (invoker .input ),
91
+ " --output" ,
92
+ rebase_path (invoker .output ),
93
+ " --symbol_name" ,
94
+ invoker .symbol ,
95
+ " --target_os" ,
96
+ current_os ,
97
+ ]
98
+ if (invoker .executable ) {
99
+ args += [ " --executable" ]
100
+ }
101
+ inputs = [
102
+ script ,
103
+ invoker .input ,
104
+ ]
105
+ outputs = [
106
+ invoker .output ,
107
+ ]
108
+ }
109
+ }
101
110
102
- if (is_debug ) {
103
- args += [
104
- " --vm_flag" ,
105
- " --enable_asserts" ,
106
- " --vm_flag" ,
107
- " --enable_type_checks" ,
108
- " --vm_flag" ,
109
- " --error_on_bad_type" ,
110
- " --vm_flag" ,
111
- " --error_on_bad_override" ,
111
+ bin_to_assembly (" vm_snapshot_data_assembly" ) {
112
+ deps = [
113
+ " :generate_snapshot_bin" ,
112
114
]
115
+ input = " $target_gen_dir /vm_isolate_snapshot.bin"
116
+ output = " $target_gen_dir /vm_snapshot_data.S"
117
+ symbol = " kDartVmSnapshotData"
118
+ executable = false
113
119
}
114
120
115
- if (is_fuchsia ) {
116
- inputs += zircon_sdk_ext_files + mozart_dart_sdk_ext_files
117
- zircon_path = rebase_path (zircon_sdk_ext_lib )
118
- fuchsia_path = rebase_path (fuchsia_sdk_ext_lib )
119
- mozart_internal_path = rebase_path (mozart_dart_sdk_ext_lib )
120
- args += [
121
- " --url_mapping=dart:zircon,$zircon_path " ,
122
- " --url_mapping=dart:fuchsia,$fuchsia_path " ,
123
- " --url_mapping=dart:mozart.internal,$mozart_internal_path " ,
124
- " --load_compilation_trace" ,
125
- rebase_path (" fuchsia_compilation_trace.txt" ),
121
+ bin_to_assembly (" vm_snapshot_instructions_assembly" ) {
122
+ deps = [
123
+ " :generate_snapshot_bin" ,
126
124
]
125
+ input = " $target_gen_dir /vm_snapshot_instructions.bin"
126
+ output = " $target_gen_dir /vm_snapshot_instructions.S"
127
+ symbol = " kDartVmSnapshotInstructions"
128
+ executable = true
127
129
}
128
- }
129
130
130
- # Generates an assembly file defining a given symbol with the bytes from a
131
- # binary file. Places the symbol in a text section if 'executable' is true,
132
- # otherwise places the symbol in a read-only data section.
133
- template (" bin_to_assembly" ) {
134
- assert (defined (invoker .deps ), " Must define deps" )
135
- assert (defined (invoker .input ), " Must define input binary file" )
136
- assert (defined (invoker .output ), " Must define output assembly file" )
137
- assert (defined (invoker .symbol ), " Must define symbol name" )
138
- assert (defined (invoker .executable ), " Must define boolean executable" )
139
-
140
- action (target_name ) {
141
- deps = invoker .deps
142
- script = " //third_party/dart/runtime/tools/bin_to_assembly.py"
143
- args = [
144
- " --input" ,
145
- rebase_path (invoker .input ),
146
- " --output" ,
147
- rebase_path (invoker .output ),
148
- " --symbol_name" ,
149
- invoker .symbol ,
150
- " --target_os" ,
151
- current_os ,
152
- ]
153
- if (invoker .executable ) {
154
- args += [ " --executable" ]
155
- }
156
- inputs = [
157
- script ,
158
- invoker .input ,
159
- ]
160
- outputs = [
161
- invoker .output ,
131
+ bin_to_assembly (" isolate_snapshot_data_assembly" ) {
132
+ deps = [
133
+ " :generate_snapshot_bin" ,
162
134
]
135
+ input = " $target_gen_dir /isolate_snapshot.bin"
136
+ output = " $target_gen_dir /isolate_snapshot_data.S"
137
+ symbol = " kDartIsolateSnapshotData"
138
+ executable = false
163
139
}
164
- }
165
-
166
- bin_to_assembly (" vm_snapshot_data_assembly" ) {
167
- deps = [
168
- " :generate_snapshot_bin" ,
169
- ]
170
- input = " $target_gen_dir /vm_isolate_snapshot.bin"
171
- output = " $target_gen_dir /vm_snapshot_data.S"
172
- symbol = " kDartVmSnapshotData"
173
- executable = false
174
- }
175
-
176
- bin_to_assembly (" vm_snapshot_instructions_assembly" ) {
177
- deps = [
178
- " :generate_snapshot_bin" ,
179
- ]
180
- input = " $target_gen_dir /vm_snapshot_instructions.bin"
181
- output = " $target_gen_dir /vm_snapshot_instructions.S"
182
- symbol = " kDartVmSnapshotInstructions"
183
- executable = true
184
- }
185
-
186
- bin_to_assembly (" isolate_snapshot_data_assembly" ) {
187
- deps = [
188
- " :generate_snapshot_bin" ,
189
- ]
190
- input = " $target_gen_dir /isolate_snapshot.bin"
191
- output = " $target_gen_dir /isolate_snapshot_data.S"
192
- symbol = " kDartIsolateSnapshotData"
193
- executable = false
194
- }
195
140
196
- bin_to_assembly (" isolate_snapshot_instructions_assembly" ) {
197
- deps = [
198
- " :generate_snapshot_bin" ,
199
- ]
200
- input = " $target_gen_dir /isolate_snapshot_instructions.bin"
201
- output = " $target_gen_dir /isolate_snapshot_instructions.S"
202
- symbol = " kDartIsolateSnapshotInstructions"
203
- executable = true
204
- }
141
+ bin_to_assembly (" isolate_snapshot_instructions_assembly" ) {
142
+ deps = [
143
+ " :generate_snapshot_bin" ,
144
+ ]
145
+ input = " $target_gen_dir /isolate_snapshot_instructions.bin"
146
+ output = " $target_gen_dir /isolate_snapshot_instructions.S"
147
+ symbol = " kDartIsolateSnapshotInstructions"
148
+ executable = true
149
+ }
205
150
206
- source_set (" snapshot" ) {
207
- deps = [
208
- " :isolate_snapshot_data_assembly" ,
209
- " :isolate_snapshot_instructions_assembly" ,
210
- " :vm_snapshot_data_assembly" ,
211
- " :vm_snapshot_instructions_assembly" ,
212
- ]
213
- sources = [
214
- " $target_gen_dir /isolate_snapshot_data.S" ,
215
- " $target_gen_dir /isolate_snapshot_instructions.S" ,
216
- " $target_gen_dir /vm_snapshot_data.S" ,
217
- " $target_gen_dir /vm_snapshot_instructions.S" ,
218
- ]
151
+ source_set (" snapshot" ) {
152
+ deps = [
153
+ " :isolate_snapshot_data_assembly" ,
154
+ " :isolate_snapshot_instructions_assembly" ,
155
+ " :vm_snapshot_data_assembly" ,
156
+ " :vm_snapshot_instructions_assembly" ,
157
+ ]
158
+ sources = [
159
+ " $target_gen_dir /isolate_snapshot_data.S" ,
160
+ " $target_gen_dir /isolate_snapshot_instructions.S" ,
161
+ " $target_gen_dir /vm_snapshot_data.S" ,
162
+ " $target_gen_dir /vm_snapshot_instructions.S" ,
163
+ ]
164
+ }
219
165
}
220
166
221
167
compile_platform (" non_strong_platform" ) {
@@ -282,22 +228,28 @@ template("generate_entry_points_json_with_gen_snapshot") {
282
228
output = invoker .output
283
229
284
230
tool = " //third_party/dart/runtime/bin:gen_snapshot"
285
- inputs = [
286
- input ,
287
- ] + extra_inputs
231
+ inputs = [ input ] + extra_inputs
288
232
outputs = [
289
233
output ,
234
+
235
+ # Though they are not consumed, GN needs to know to create the output directory.
236
+ " $target_gen_dir /dummy.vm_data.snapshot" ,
237
+ " $target_gen_dir /dummy.vm_instr.snapshot" ,
238
+ " $target_gen_dir /dummy.isolate_data.snapshot" ,
239
+ " $target_gen_dir /dummy.isolate_instr.snapshot" ,
290
240
]
291
241
args = [
292
- " --print-precompiler-entry-points=" + rebase_path (output ),
293
- " --snapshot-kind=app-aot-blobs" ,
294
- " --vm_snapshot_data=" + rebase_path (" $target_gen_dir /dummy.vm_data.snapshot" ),
295
- " --vm_snapshot_instructions=" + rebase_path (" $target_gen_dir /dummy.vm_instr.snapshot" ),
296
- " --isolate_snapshot_data=" + rebase_path (" $target_gen_dir /dummy.isolate_data.snapshot" ),
297
- " --isolate_snapshot_instructions=" + rebase_path (" $target_gen_dir /dummy.isolate_instr.snapshot" ),
298
- ] + extra_args + [
299
- rebase_path (input ),
300
- ]
242
+ " --print-precompiler-entry-points=" + rebase_path (output ),
243
+ " --snapshot-kind=app-aot-blobs" ,
244
+ " --vm_snapshot_data=" +
245
+ rebase_path (" $target_gen_dir /dummy.vm_data.snapshot" ),
246
+ " --vm_snapshot_instructions=" +
247
+ rebase_path (" $target_gen_dir /dummy.vm_instr.snapshot" ),
248
+ " --isolate_snapshot_data=" +
249
+ rebase_path (" $target_gen_dir /dummy.isolate_data.snapshot" ),
250
+ " --isolate_snapshot_instructions=" +
251
+ rebase_path (" $target_gen_dir /dummy.isolate_instr.snapshot" ),
252
+ ] + extra_args + [ rebase_path (input ) ]
301
253
}
302
254
}
303
255
0 commit comments