Make able to define build jobs amount when building examples

pull/11696/head
Olli-Pekka Puolitaival 2019-09-16 13:29:21 +03:00 committed by adbridge
parent 318f686ffc
commit 95f04e104a
2 changed files with 10 additions and 4 deletions

View File

@ -77,6 +77,13 @@ def main():
help=("build profile file"),
metavar="profile")
compile_cmd.add_argument("-j", "--jobs",
dest='jobs',
metavar="NUMBER",
type=int,
default=0,
help="Number of concurrent jobs. Default: 0/auto (based on host machine's number of CPUs)")
compile_cmd.add_argument("-v", "--verbose",
action="store_true",
dest="verbose",
@ -136,8 +143,7 @@ def do_deploy(_, config, examples):
def do_compile(args, config, examples):
"""Do the compile step"""
results = {}
results = lib.compile_repos(config, args.toolchains, args.mcu, args.profile, args.verbose, examples)
results = lib.compile_repos(config, args.toolchains, args.mcu, args.profile, args.verbose, examples, args.jobs)
lib.print_summary(results)
failures = lib.get_num_failures(results)
print("Number of failures = %d" % failures)

View File

@ -349,7 +349,7 @@ def export_repos(config, ides, targets, examples):
return results
def compile_repos(config, toolchains, targets, profile, verbose, examples):
def compile_repos(config, toolchains, targets, profile, verbose, examples, jobs=0):
"""Compiles combinations of example programs, targets and compile chains.
The results are returned in a [key: value] dictionary format:
@ -398,7 +398,7 @@ def compile_repos(config, toolchains, targets, profile, verbose, examples):
valid_choices(example['toolchains'], toolchains),
example['features']):
build_command = ["mbed-cli", "compile", "-t", toolchain, "-m", target] + (['-vv'] if verbose else [])
build_command = ["mbed-cli", "compile", "-t", toolchain, "-m", target, "-j", str(jobs)] + (['-vv'] if verbose else [])
if profile:
build_command.append("--profile")
build_command.append(profile)