mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #9401 from loverdeg-ep/custom-targets-option
tools: adds and implements a --custom-targets command line switchpull/9421/head
commit
091fe2bed4
|
|
@ -68,6 +68,7 @@ class MbedExtendedArgs(MainArgumentParser):
|
||||||
parser.add_argument('-m', '--mcu')
|
parser.add_argument('-m', '--mcu')
|
||||||
parser.add_argument('-t', '--toolchain')
|
parser.add_argument('-t', '--toolchain')
|
||||||
parser.add_argument('--source', nargs='+', dest='source_dir')
|
parser.add_argument('--source', nargs='+', dest='source_dir')
|
||||||
|
parser.add_argument('--custom-targets', dest='custom_targets_directory')
|
||||||
parser.add_argument('--build')
|
parser.add_argument('--build')
|
||||||
exclusions.append('payload')
|
exclusions.append('payload')
|
||||||
super(MbedExtendedArgs, self)._addCreateArgs(parser, exclusions)
|
super(MbedExtendedArgs, self)._addCreateArgs(parser, exclusions)
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,13 @@ def get_default_options_parser(add_clean=True, add_options=True,
|
||||||
', '.join(targetnames)),
|
', '.join(targetnames)),
|
||||||
metavar="MCU")
|
metavar="MCU")
|
||||||
|
|
||||||
|
parser.add_argument("--custom-targets",
|
||||||
|
help="Specify directory containing custom_targets.json",
|
||||||
|
type=argparse_filestring_type,
|
||||||
|
dest="custom_targets_directory",
|
||||||
|
action="append",
|
||||||
|
default=None)
|
||||||
|
|
||||||
parser.add_argument("-t", "--tool",
|
parser.add_argument("-t", "--tool",
|
||||||
help=("build using the given TOOLCHAIN (%s)" %
|
help=("build using the given TOOLCHAIN (%s)" %
|
||||||
', '.join(toolchainlist)),
|
', '.join(toolchainlist)),
|
||||||
|
|
@ -123,7 +130,11 @@ def extract_profile(parser, options, toolchain, fallback="develop"):
|
||||||
|
|
||||||
def extract_mcus(parser, options):
|
def extract_mcus(parser, options):
|
||||||
try:
|
try:
|
||||||
if options.source_dir:
|
if options.custom_targets_directory:
|
||||||
|
for custom_targets_directory in options.custom_targets_directory:
|
||||||
|
Target.add_extra_targets(custom_targets_directory)
|
||||||
|
update_target_data()
|
||||||
|
elif options.source_dir:
|
||||||
for source_dir in options.source_dir:
|
for source_dir in options.source_dir:
|
||||||
Target.add_extra_targets(source_dir)
|
Target.add_extra_targets(source_dir)
|
||||||
update_target_data()
|
update_target_data()
|
||||||
|
|
@ -135,4 +146,3 @@ def extract_mcus(parser, options):
|
||||||
return argparse_many(argparse_force_uppercase_type(targetnames, "MCU"))(options.mcu)
|
return argparse_many(argparse_force_uppercase_type(targetnames, "MCU"))(options.mcu)
|
||||||
except ArgumentTypeError as exc:
|
except ArgumentTypeError as exc:
|
||||||
args_error(parser, "argument -m/--mcu: {}".format(str(exc)))
|
args_error(parser, "argument -m/--mcu: {}".format(str(exc)))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -270,6 +270,15 @@ def get_args(argv):
|
||||||
help="The source (input) directory"
|
help="The source (input) directory"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"--custom-targets",
|
||||||
|
action="append",
|
||||||
|
type=argparse_filestring_type,
|
||||||
|
dest="custom_targets_directory",
|
||||||
|
default=[],
|
||||||
|
help="Specify directory containing custom_targets.json"
|
||||||
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-D",
|
"-D",
|
||||||
action="append",
|
action="append",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue