Skip to content

Commit

Permalink
Add GN arguments that disable building host artifacts (flutter#40242)
Browse files Browse the repository at this point in the history
  • Loading branch information
zanderso authored Mar 12, 2023
1 parent 04e8d54 commit 57f7120
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
8 changes: 6 additions & 2 deletions common/config.gni
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ declare_args() {

# Whether to use a prebuilt Dart SDK instead of building one.
flutter_prebuilt_dart_sdk = false

# Whether to build host-side development artifacts.
flutter_build_engine_artifacts = true
}

# feature_defines_list ---------------------------------------------------------
Expand Down Expand Up @@ -122,5 +125,6 @@ if (flutter_prebuilt_dart_sdk) {
# TODO: We can't build the engine artifacts for arm (32-bit) right now;
# see https://github.com/flutter/flutter/issues/74322
build_engine_artifacts =
current_toolchain == host_toolchain ||
(is_linux && !is_chromeos && current_cpu != "arm") || is_mac || is_win
flutter_build_engine_artifacts &&
(current_toolchain == host_toolchain ||
(is_linux && !is_chromeos && current_cpu != "arm") || is_mac || is_win)
33 changes: 31 additions & 2 deletions tools/gn
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,9 @@ def to_gn_args(args):
gn_args['full_dart_sdk'] = args.full_dart_sdk

if args.enable_unittests:
gn_args['enable_unittests'] = args.enable_unittests
gn_args['enable_unittests'] = True
if args.no_enable_unittests:
gn_args['enable_unittests'] = False

# Skia GN args.
gn_args['skia_enable_flutter_defines'
Expand Down Expand Up @@ -323,6 +325,9 @@ def to_gn_args(args):
gn_args['target_cpu'] = get_target_cpu(args)
gn_args['dart_target_arch'] = gn_args['target_cpu']

if not args.build_engine_artifacts:
gn_args['flutter_build_engine_artifacts'] = False

# We cannot cross-compile for 32 bit arm on a Windows host. We work around
# this by leaving 'target_cpu' and 'dart_target_arch' set to 'arm' so that
# Dart tools such as gen_snapshot that are built for the host will correctly
Expand Down Expand Up @@ -660,7 +665,18 @@ def parse_args(args):

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

parser.add_argument('--enable-unittests', action='store_true', default=False)
parser.add_argument(
'--enable-unittests',
action='store_true',
default=False,
help='Force enable building unit test binaries.'
)
parser.add_argument(
'--no-enable-unittests',
default=False,
action='store_true',
help='Force disable building unit test binaries.'
)

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

parser.add_argument(
'--build-engine-artifacts',
default=True,
action='store_true',
help='Build the host-side development artifacts.'
)
parser.add_argument(
'--no-build-engine-artifacts',
dest='build_engine_artifacts',
action='store_false',
help='Do not build the host-side development artifacts.'
)

parser.add_argument('--goma', default=True, action='store_true')
parser.add_argument('--no-goma', dest='goma', action='store_false')
parser.add_argument(
Expand Down

0 comments on commit 57f7120

Please sign in to comment.