Add profile argument to mbed-os example build tools to allow non-default build profiles to be passed in

pull/5247/head
Kevin Gilbert 2017-09-01 11:25:39 -05:00 committed by Kevin Gilbert
parent 003dd7c47f
commit 310f833f52
2 changed files with 15 additions and 4 deletions

View File

@ -54,6 +54,11 @@ def main():
argparse_force_uppercase_type(
official_target_names, "MCU")),
default=official_target_names)
compile_cmd.add_argument("-p", "--profile",
help=("build profile file"),
metavar="profile")
export_cmd = subparsers.add_parser("export")
export_cmd.set_defaults(fn=do_export),
export_cmd.add_argument(
@ -111,7 +116,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, examples)
results = lib.compile_repos(config, args.toolchains, args.mcu, args.profile, examples)
lib.print_summary(results)
failures = lib.get_num_failures(results)

View File

@ -311,7 +311,7 @@ def export_repos(config, ides, targets, examples):
return results
def compile_repos(config, toolchains, targets, examples):
def compile_repos(config, toolchains, targets, profile, examples):
"""Compiles combinations of example programs, targets and compile chains.
The results are returned in a [key: value] dictionary format:
@ -355,8 +355,14 @@ def compile_repos(config, toolchains, targets, examples):
valid_choices(example['toolchains'], toolchains),
example['features']):
print("Compiling %s for %s, %s" % (name, target, toolchain))
proc = subprocess.Popen(["mbed-cli", "compile", "-t", toolchain,
"-m", target, "-v"])
build_command = ["mbed-cli", "compile", "-t", toolchain, "-m", target, "-v"]
if profile:
build_command.append("--profile")
build_command.append(profile)
proc = subprocess.Popen(build_command)
proc.wait()
example_summary = "{} {} {}".format(name, target, toolchain)
if proc.returncode: