Skip to content

Commit

Permalink
[Tools] Makes build.py --arch more case-tolerant.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Clement Skau authored and commit-bot@chromium.org committed Feb 7, 2020
1 parent 16782e6 commit d765d23
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tools/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@
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]
Expand Down Expand Up @@ -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]
Expand Down
2 changes: 2 additions & 0 deletions tools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,14 @@ def ListDartArgCallback(option, value, parser):
'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',
Expand Down

0 comments on commit d765d23

Please sign in to comment.