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

Commit 2a7b34a

Browse files
authored
Exit early on invalid gn CPU argument combos for simulators (#40903)
Exit early on invalid gn CPU argument combos for simulators
1 parent f175a94 commit 2a7b34a

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

tools/gn

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,6 @@ def to_command_line(gn_args):
8585
return [merge(x, y) for x, y in gn_args.items()]
8686

8787

88-
def cpu_for_target_arch(arch):
89-
if arch in ['ia32', 'x86', 'arm', 'armv6', 'armv5te', 'mips', 'simarm',
90-
'simarmv6', 'simarmv5te', 'simmips', 'simdbc', 'armsimdbc']:
91-
return 'x86'
92-
if arch in ['x64', 'arm64', 'simarm64', 'simdbc64', 'armsimdbc64']:
93-
return 'x64'
94-
return None
95-
96-
9788
def is_host_build(args):
9889
# If target_os == None, then this is a host build.
9990
if args.target_os is None:
@@ -1040,8 +1031,29 @@ def parse_args(args):
10401031
return parser.parse_args(args)
10411032

10421033

1034+
def validate_args(args):
1035+
valid = True
1036+
if args.simulator:
1037+
if args.mac_cpu != 'x64':
1038+
print(
1039+
'Specified a non-default mac-cpu for a simulator build. Did you mean '
1040+
'to use `--simulator-cpu`?'
1041+
)
1042+
valid = False
1043+
if args.ios_cpu != 'arm64':
1044+
print(
1045+
'Specified a non-default ios-cpu for a simulator build. Did you mean '
1046+
'to use `--simulator-cpu`?'
1047+
)
1048+
valid = False
1049+
1050+
if not valid:
1051+
sys.exit(-1)
1052+
1053+
10431054
def main(argv):
10441055
args = parse_args(argv)
1056+
validate_args(args)
10451057

10461058
exe = '.exe' if sys.platform.startswith(('cygwin', 'win')) else ''
10471059

0 commit comments

Comments
 (0)