@@ -167,9 +167,10 @@ def CopyIcuDepsToBucket(src, dst):
167
167
deps_bucket_path = os .path .join (_bucket_directory , dst )
168
168
FindFileAndCopyTo ('icudtl.dat' , source_root , deps_bucket_path )
169
169
170
- def BuildBucket (runtime_mode , arch , product ):
171
- out_dir = 'fuchsia_%s_%s/' % (runtime_mode , arch )
172
- bucket_dir = 'flutter/%s/%s/' % (arch , runtime_mode )
170
+ def BuildBucket (runtime_mode , arch , optimized , product ):
171
+ unopt = "_unopt" if not optimized else ""
172
+ out_dir = 'fuchsia_%s%s_%s/' % (runtime_mode , unopt , arch )
173
+ bucket_dir = 'flutter/%s/%s%s/' % (arch , runtime_mode , unopt )
173
174
deps_dir = 'flutter/%s/deps/' % (arch )
174
175
CopyToBucket (out_dir , bucket_dir , product )
175
176
CopyVulkanDepsToBucket (out_dir , deps_dir , arch )
@@ -244,8 +245,9 @@ def GetRunnerTarget(runner_type, product, aot):
244
245
target += 'runner'
245
246
return base + target
246
247
247
- def BuildTarget (runtime_mode , arch , enable_lto , additional_targets = []):
248
- out_dir = 'fuchsia_%s_%s' % (runtime_mode , arch )
248
+ def BuildTarget (runtime_mode , arch , optimized , enable_lto , asan , additional_targets = []):
249
+ unopt = "_unopt" if not optimized else ""
250
+ out_dir = 'fuchsia_%s%s_%s' % (runtime_mode , unopt , arch )
249
251
flags = [
250
252
'--fuchsia' ,
251
253
'--fuchsia-cpu' ,
@@ -254,8 +256,13 @@ def BuildTarget(runtime_mode, arch, enable_lto, additional_targets=[]):
254
256
runtime_mode ,
255
257
]
256
258
259
+ if not optimized :
260
+ flags .append ('--unoptimized' )
261
+
257
262
if not enable_lto :
258
263
flags .append ('--no-lto' )
264
+ if asan :
265
+ flags .append ('--asan' )
259
266
260
267
RunGN (out_dir , flags )
261
268
BuildNinjaTargets (out_dir , [ 'flutter' ] + additional_targets )
@@ -277,6 +284,12 @@ def main():
277
284
required = False ,
278
285
help = 'Specifies the flutter engine SHA.' )
279
286
287
+ parser .add_argument (
288
+ '--unoptimized' ,
289
+ action = 'store_true' ,
290
+ default = False ,
291
+ help = 'If set, disables compiler optimization for the build.' )
292
+
280
293
parser .add_argument (
281
294
'--runtime-mode' ,
282
295
type = str ,
@@ -286,6 +299,12 @@ def main():
286
299
parser .add_argument (
287
300
'--archs' , type = str , choices = ['x64' , 'arm64' , 'all' ], default = 'all' )
288
301
302
+ parser .add_argument (
303
+ '--asan' ,
304
+ action = 'store_true' ,
305
+ default = False ,
306
+ help = 'If set, enables address sanitization (including leak sanitization) for the build.' )
307
+
289
308
parser .add_argument (
290
309
'--no-lto' ,
291
310
action = 'store_true' ,
@@ -312,6 +331,7 @@ def main():
312
331
runtime_modes = ['debug' , 'profile' , 'release' ]
313
332
product_modes = [False , False , True ]
314
333
334
+ optimized = not args .unoptimized
315
335
enable_lto = not args .no_lto
316
336
317
337
for arch in archs :
@@ -320,8 +340,8 @@ def main():
320
340
product = product_modes [i ]
321
341
if build_mode == 'all' or runtime_mode == build_mode :
322
342
if not args .skip_build :
323
- BuildTarget (runtime_mode , arch , enable_lto , args .targets .split ("," ))
324
- BuildBucket (runtime_mode , arch , product )
343
+ BuildTarget (runtime_mode , arch , optimized , enable_lto , args . asan , args .targets .split ("," ))
344
+ BuildBucket (runtime_mode , arch , optimized , product )
325
345
326
346
if args .upload :
327
347
if args .engine_version is None :
0 commit comments