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

Commit 57f7120

Browse files
authored
Add GN arguments that disable building host artifacts (#40242)
1 parent 04e8d54 commit 57f7120

2 files changed

Lines changed: 37 additions & 4 deletions

File tree

common/config.gni

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ declare_args() {
1616

1717
# Whether to use a prebuilt Dart SDK instead of building one.
1818
flutter_prebuilt_dart_sdk = false
19+
20+
# Whether to build host-side development artifacts.
21+
flutter_build_engine_artifacts = true
1922
}
2023

2124
# feature_defines_list ---------------------------------------------------------
@@ -122,5 +125,6 @@ if (flutter_prebuilt_dart_sdk) {
122125
# TODO: We can't build the engine artifacts for arm (32-bit) right now;
123126
# see https://github.com/flutter/flutter/issues/74322
124127
build_engine_artifacts =
125-
current_toolchain == host_toolchain ||
126-
(is_linux && !is_chromeos && current_cpu != "arm") || is_mac || is_win
128+
flutter_build_engine_artifacts &&
129+
(current_toolchain == host_toolchain ||
130+
(is_linux && !is_chromeos && current_cpu != "arm") || is_mac || is_win)

tools/gn

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,9 @@ def to_gn_args(args):
264264
gn_args['full_dart_sdk'] = args.full_dart_sdk
265265

266266
if args.enable_unittests:
267-
gn_args['enable_unittests'] = args.enable_unittests
267+
gn_args['enable_unittests'] = True
268+
if args.no_enable_unittests:
269+
gn_args['enable_unittests'] = False
268270

269271
# Skia GN args.
270272
gn_args['skia_enable_flutter_defines'
@@ -323,6 +325,9 @@ def to_gn_args(args):
323325
gn_args['target_cpu'] = get_target_cpu(args)
324326
gn_args['dart_target_arch'] = gn_args['target_cpu']
325327

328+
if not args.build_engine_artifacts:
329+
gn_args['flutter_build_engine_artifacts'] = False
330+
326331
# We cannot cross-compile for 32 bit arm on a Windows host. We work around
327332
# this by leaving 'target_cpu' and 'dart_target_arch' set to 'arm' so that
328333
# Dart tools such as gen_snapshot that are built for the host will correctly
@@ -660,7 +665,18 @@ def parse_args(args):
660665

661666
parser.add_argument('--unoptimized', default=False, action='store_true')
662667

663-
parser.add_argument('--enable-unittests', action='store_true', default=False)
668+
parser.add_argument(
669+
'--enable-unittests',
670+
action='store_true',
671+
default=False,
672+
help='Force enable building unit test binaries.'
673+
)
674+
parser.add_argument(
675+
'--no-enable-unittests',
676+
default=False,
677+
action='store_true',
678+
help='Force disable building unit test binaries.'
679+
)
664680

665681
parser.add_argument(
666682
'--runtime-mode',
@@ -755,6 +771,19 @@ def parse_args(args):
755771
'--arm-float-abi', type=str, choices=['hard', 'soft', 'softfp']
756772
)
757773

774+
parser.add_argument(
775+
'--build-engine-artifacts',
776+
default=True,
777+
action='store_true',
778+
help='Build the host-side development artifacts.'
779+
)
780+
parser.add_argument(
781+
'--no-build-engine-artifacts',
782+
dest='build_engine_artifacts',
783+
action='store_false',
784+
help='Do not build the host-side development artifacts.'
785+
)
786+
758787
parser.add_argument('--goma', default=True, action='store_true')
759788
parser.add_argument('--no-goma', dest='goma', action='store_false')
760789
parser.add_argument(

0 commit comments

Comments
 (0)