Skip to content

Commit a610505

Browse files
authored
option for --no-lto for fuchsia (flutter#12010)
1 parent be39820 commit a610505

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

tools/fuchsia/build_fuchsia_artifacts.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ def RunExecutable(command):
5252

5353

5454
def RunGN(variant_dir, flags):
55+
print('Running gn for variant "%s" with flags: %s' % (variant_dir,
56+
','.join(flags)))
5557
RunExecutable([
5658
os.path.join('flutter', 'tools', 'gn'),
5759
] + flags)
@@ -192,16 +194,19 @@ def GetTargetsToBuild(product=False):
192194
return targets_to_build
193195

194196

195-
def BuildTarget(runtime_mode, arch, product):
197+
def BuildTarget(runtime_mode, arch, product, enable_lto):
196198
out_dir = 'fuchsia_%s_%s' % (runtime_mode, arch)
197199
flags = [
198200
'--fuchsia',
199201
'--fuchsia-cpu',
200202
arch,
201203
'--runtime-mode',
202-
runtime_mode
204+
runtime_mode,
203205
]
204206

207+
if not enable_lto:
208+
flags.append('--no-lto')
209+
205210
RunGN(out_dir, flags)
206211
BuildNinjaTargets(out_dir, GetTargetsToBuild(product))
207212

@@ -228,6 +233,12 @@ def main():
228233
choices=['debug', 'profile', 'release', 'all'],
229234
default='all')
230235

236+
parser.add_argument(
237+
'--no-lto',
238+
action='store_true',
239+
default=False,
240+
help='If set, disables LTO for the build.')
241+
231242
args = parser.parse_args()
232243
RemoveDirectoryIfExists(_bucket_directory)
233244
build_mode = args.runtime_mode
@@ -236,12 +247,14 @@ def main():
236247
runtime_modes = ['debug', 'profile', 'release']
237248
product_modes = [False, False, True]
238249

250+
enable_lto = not args.no_lto
251+
239252
for arch in archs:
240253
for i in range(3):
241254
runtime_mode = runtime_modes[i]
242255
product = product_modes[i]
243256
if build_mode == 'all' or runtime_mode == build_mode:
244-
BuildTarget(runtime_mode, arch, product)
257+
BuildTarget(runtime_mode, arch, product, enable_lto)
245258
BuildBucket(runtime_mode, arch, product)
246259

247260
ProcessCIPDPakcage(args.upload, args.engine_version)

0 commit comments

Comments
 (0)