[Tools] Makes build.py --arch more case-tolerant.

This allows us to do both:
  tools/build.py -a ia32
and
  tools/build.py -a IA32,ARMx64,x64

Also fixes missing arch option in utils.py.

Change-Id: I6f911397dbf52437f5347d41d71cdd3254a29476
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134700
Reviewed-by: Teagan Strickland <sstrickl@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
Auto-Submit: Clement Skau <cskau@google.com>
This commit is contained in:
Clement Skau 2020-02-07 08:26:35 +00:00 committed by commit-bot@chromium.org
parent 16782e6c17
commit d765d23746
2 changed files with 9 additions and 5 deletions

View file

@ -16,10 +16,7 @@ HOST_OS = utils.GuessOS()
HOST_CPUS = utils.GuessCpus()
SCRIPT_DIR = os.path.dirname(sys.argv[0])
DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..'))
AVAILABLE_ARCHS = [
'ia32', 'x64', 'simarm', 'arm', 'arm_x64', 'simarmv6', 'armv6', 'simarm64',
'arm64', 'simarm_x64'
]
AVAILABLE_ARCHS = utils.ARCH_FAMILY.keys()
usage = """\
usage: %%prog [options] [targets]
@ -107,8 +104,13 @@ def ProcessOptions(options, args):
if not mode in ['debug', 'release', 'product']:
print("Unknown mode %s" % mode)
return False
for arch in options.arch:
for i, arch in enumerate(options.arch):
if not arch in AVAILABLE_ARCHS:
# Normalise to lower case form to make it less case-picky.
arch_lower = arch.lower()
if arch_lower in AVAILABLE_ARCHS:
options.arch[i] = arch_lower
continue
print("Unknown arch %s" % arch)
return False
options.os = [ProcessOsOption(os_name) for os_name in options.os]

View file

@ -272,12 +272,14 @@ BUILD_ROOT = {
'macos': os.path.join('xcodebuild'),
}
# Note: gn expects these to be lower case.
ARCH_FAMILY = {
'ia32': 'ia32',
'x64': 'ia32',
'arm': 'arm',
'armv6': 'arm',
'arm64': 'arm',
'arm_x64': 'arm',
'simarm': 'ia32',
'simarmv6': 'ia32',
'simarm64': 'ia32',