From 41d0022e0cca5824c5c1add6543f392e2a18150f Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Tue, 19 Feb 2019 10:18:02 +0900 Subject: [PATCH] Bug 1528860 - Synchronize artifact command --job options with artifacts.JOB_DETAILS. r=ted Differential Revision: https://phabricator.services.mozilla.com/D20227 --- python/mozbuild/mozbuild/mach_commands.py | 46 +++++++++++++++++------ 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/python/mozbuild/mozbuild/mach_commands.py b/python/mozbuild/mozbuild/mach_commands.py index 77169bb7fc39..668eee91d80c 100644 --- a/python/mozbuild/mozbuild/mach_commands.py +++ b/python/mozbuild/mozbuild/mach_commands.py @@ -1194,22 +1194,41 @@ class MachDebug(MachCommandBase): return json.JSONEncoder.default(self, obj) json.dump(self, cls=EnvironmentEncoder, sort_keys=True, fp=out) + +JOB_CHOICES = { + 'android-api-16-opt', + 'android-api-16-debug', + 'android-x86-opt', + 'android-x86_64-opt', + 'android-x86_64-debug', + 'android-aarch64-opt', + 'android-aarch64-debug', + 'linux-opt', + 'linux-pgo', + 'linux-debug', + 'linux64-opt', + 'linux64-pgo', + 'linux64-debug', + 'macosx64-opt', + 'macosx64-debug', + 'win32-opt', + 'win32-pgo', + 'win32-debug', + 'win64-opt', + 'win64-pgo', + 'win64-debug', + 'win64-aarch64-opt', + 'win64-aarch64-debug', +} + + class ArtifactSubCommand(SubCommand): def __call__(self, func): after = SubCommand.__call__(self, func) - jobchoices = { - 'android-api-16', - 'android-x86', - 'linux', - 'linux64', - 'macosx64', - 'win32', - 'win64' - } args = [ CommandArgument('--tree', metavar='TREE', type=str, help='Firefox tree.'), - CommandArgument('--job', metavar='JOB', choices=jobchoices, + CommandArgument('--job', metavar='JOB', choices=JOB_CHOICES, help='Build job.'), CommandArgument('--verbose', '-v', action='store_true', help='Print verbose output.'), @@ -1251,7 +1270,12 @@ class PackageFrontend(MachCommandBase): if conditions.is_git(self): git = self.substs['GIT'] - from mozbuild.artifacts import Artifacts + from mozbuild.artifacts import (Artifacts, JOB_DETAILS) + # We can't derive JOB_CHOICES from JOB_DETAILS because we don't want to + # import the artifacts module globally ; and this module can't be + # imported in unit tests, so do the check here. + assert set(JOB_DETAILS.keys()) == JOB_CHOICES + artifacts = Artifacts(tree, self.substs, self.defines, job, log=self.log, cache_dir=cache_dir, skip_cache=skip_cache, hg=hg, git=git,