Disallow using ./tools/gn --enable-unittests --android (or --ios) (flutter/engine#44930)

Closes https://github.com/flutter/flutter/issues/132611.

As seen on https://github.com/flutter/flutter/issues/132611, this will
never succeed compiling.

I tried to update the Wiki as well:

https://github.com/flutter/flutter/wiki/Setting-up-the-Engine-development-environment#vscode-with-cc-intellisense-cc
This commit is contained in:
Matan Lurey
2023-08-21 20:20:01 -07:00
committed by GitHub
parent 2a284a676e
commit af5d8338a9
2 changed files with 19 additions and 0 deletions

View File

@@ -299,6 +299,17 @@ def to_gn_args(args):
gn_args['full_dart_sdk'] = args.full_dart_sdk
if args.enable_unittests:
# Ensure that Android and iOS are *not* used with --enable-unittests.
# https://github.com/flutter/flutter/issues/132611
if args.target_os == 'android' or args.target_os == 'ios':
raise Exception(
'Cannot use --enable-unittests with --target-os=android or ios. If ' +
'you are trying to create an output directory to use for clangd ' +
'(i.e. for VSCode integration), use a host build instead.\n\n' +
'See https://github.com/flutter/flutter/wiki/' +
'Setting-up-the-Engine-development-environment' +
'#vscode-with-cc-intellisense-cc'
)
gn_args['enable_unittests'] = True
if args.no_enable_unittests:
gn_args['enable_unittests'] = False

View File

@@ -35,6 +35,14 @@ class GNTestCase(unittest.TestCase):
)
self.assertEquals(self._gn_args(['--ios'])['target_cpu'], 'arm')
def test_cannot_use_android_and_enable_unittests(self):
with self.assertRaises(SystemExit):
self._gn_args(['--android', '--enable-unittests'])
def test_cannot_use_ios_and_enable_unittests(self):
with self.assertRaises(SystemExit):
self._gn_args(['--ios', '--enable-unittests'])
if __name__ == '__main__':
unittest.main()