Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Add --unoptimized and --asan to Fuchsia builds #20427

Merged
merged 1 commit into from
Aug 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions shell/platform/fuchsia/dart_runner/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ template("runner") {
invoker_output_name = invoker.output_name
extra_defines = invoker.extra_defines
extra_deps = invoker.extra_deps
if (is_debug) {
extra_defines += [ "DEBUG" ] # Needed due to direct dart dependencies.
}

executable(target_name) {
output_name = invoker_output_name
Expand Down
3 changes: 3 additions & 0 deletions shell/platform/fuchsia/flutter/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ template("flutter_runner") {
if (defined(invoker.extra_defines)) {
extra_defines += invoker.extra_defines
}
if (is_debug) {
extra_defines += [ "DEBUG" ] # Needed due to direct dart dependencies.
}

executable(target_name) {
output_name = invoker_output_name
Expand Down
34 changes: 27 additions & 7 deletions tools/fuchsia/build_fuchsia_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,10 @@ def CopyIcuDepsToBucket(src, dst):
deps_bucket_path = os.path.join(_bucket_directory, dst)
FindFileAndCopyTo('icudtl.dat', source_root, deps_bucket_path)

def BuildBucket(runtime_mode, arch, product):
out_dir = 'fuchsia_%s_%s/' % (runtime_mode, arch)
bucket_dir = 'flutter/%s/%s/' % (arch, runtime_mode)
def BuildBucket(runtime_mode, arch, optimized, product):
unopt = "_unopt" if not optimized else ""
out_dir = 'fuchsia_%s%s_%s/' % (runtime_mode, unopt, arch)
bucket_dir = 'flutter/%s/%s%s/' % (arch, runtime_mode, unopt)
deps_dir = 'flutter/%s/deps/' % (arch)
CopyToBucket(out_dir, bucket_dir, product)
CopyVulkanDepsToBucket(out_dir, deps_dir, arch)
Expand Down Expand Up @@ -244,8 +245,9 @@ def GetRunnerTarget(runner_type, product, aot):
target += 'runner'
return base + target

def BuildTarget(runtime_mode, arch, enable_lto, additional_targets=[]):
out_dir = 'fuchsia_%s_%s' % (runtime_mode, arch)
def BuildTarget(runtime_mode, arch, optimized, enable_lto, asan, additional_targets=[]):
unopt = "_unopt" if not optimized else ""
out_dir = 'fuchsia_%s%s_%s' % (runtime_mode, unopt, arch)
flags = [
'--fuchsia',
'--fuchsia-cpu',
Expand All @@ -254,8 +256,13 @@ def BuildTarget(runtime_mode, arch, enable_lto, additional_targets=[]):
runtime_mode,
]

if not optimized:
flags.append('--unoptimized')

if not enable_lto:
flags.append('--no-lto')
if asan:
flags.append('--asan')

RunGN(out_dir, flags)
BuildNinjaTargets(out_dir, [ 'flutter' ] + additional_targets)
Expand All @@ -277,6 +284,12 @@ def main():
required=False,
help='Specifies the flutter engine SHA.')

parser.add_argument(
'--unoptimized',
action='store_true',
default=False,
help='If set, disables compiler optimization for the build.')

parser.add_argument(
'--runtime-mode',
type=str,
Expand All @@ -286,6 +299,12 @@ def main():
parser.add_argument(
'--archs', type=str, choices=['x64', 'arm64', 'all'], default='all')

parser.add_argument(
'--asan',
action='store_true',
default=False,
help='If set, enables address sanitization (including leak sanitization) for the build.')

parser.add_argument(
'--no-lto',
action='store_true',
Expand All @@ -312,6 +331,7 @@ def main():
runtime_modes = ['debug', 'profile', 'release']
product_modes = [False, False, True]

optimized = not args.unoptimized
enable_lto = not args.no_lto

for arch in archs:
Expand All @@ -320,8 +340,8 @@ def main():
product = product_modes[i]
if build_mode == 'all' or runtime_mode == build_mode:
if not args.skip_build:
BuildTarget(runtime_mode, arch, enable_lto, args.targets.split(","))
BuildBucket(runtime_mode, arch, product)
BuildTarget(runtime_mode, arch, optimized, enable_lto, args.asan, args.targets.split(","))
BuildBucket(runtime_mode, arch, optimized, product)

if args.upload:
if args.engine_version is None:
Expand Down