mirror of https://github.com/ARMmbed/mbed-os.git
Added ability to list targets and toolchains in a non matrix form.
This is super helpful for the tab completion generation script as we no longer have to parse the matrix output.pull/3993/head
parent
067fe9b0e5
commit
f142939937
|
@ -1098,6 +1098,75 @@ def get_unique_supported_toolchains(release_targets=None):
|
|||
|
||||
return unique_supported_toolchains
|
||||
|
||||
def mcu_toolchain_list(release_version='5'):
|
||||
""" Shows list of toolchains
|
||||
|
||||
"""
|
||||
|
||||
if isinstance(release_version, basestring):
|
||||
# Force release_version to lowercase if it is a string
|
||||
release_version = release_version.lower()
|
||||
else:
|
||||
# Otherwise default to printing all known targets and toolchains
|
||||
release_version = 'all'
|
||||
|
||||
|
||||
version_release_targets = {}
|
||||
version_release_target_names = {}
|
||||
|
||||
for version in RELEASE_VERSIONS:
|
||||
version_release_targets[version] = get_mbed_official_release(version)
|
||||
version_release_target_names[version] = [x[0] for x in
|
||||
version_release_targets[
|
||||
version]]
|
||||
|
||||
if release_version in RELEASE_VERSIONS:
|
||||
release_targets = version_release_targets[release_version]
|
||||
else:
|
||||
release_targets = None
|
||||
|
||||
unique_supported_toolchains = get_unique_supported_toolchains(
|
||||
release_targets)
|
||||
columns = ["mbed OS %s" % x for x in RELEASE_VERSIONS] + unique_supported_toolchains
|
||||
return "\n".join(columns)
|
||||
|
||||
|
||||
def mcu_target_list(release_version='5'):
|
||||
""" Shows target list
|
||||
|
||||
"""
|
||||
|
||||
if isinstance(release_version, basestring):
|
||||
# Force release_version to lowercase if it is a string
|
||||
release_version = release_version.lower()
|
||||
else:
|
||||
# Otherwise default to printing all known targets and toolchains
|
||||
release_version = 'all'
|
||||
|
||||
|
||||
version_release_targets = {}
|
||||
version_release_target_names = {}
|
||||
|
||||
for version in RELEASE_VERSIONS:
|
||||
version_release_targets[version] = get_mbed_official_release(version)
|
||||
version_release_target_names[version] = [x[0] for x in
|
||||
version_release_targets[
|
||||
version]]
|
||||
|
||||
if release_version in RELEASE_VERSIONS:
|
||||
release_targets = version_release_targets[release_version]
|
||||
else:
|
||||
release_targets = None
|
||||
|
||||
target_names = []
|
||||
|
||||
if release_targets:
|
||||
target_names = [x[0] for x in release_targets]
|
||||
else:
|
||||
target_names = TARGET_NAMES
|
||||
|
||||
return "\n".join(target_names)
|
||||
|
||||
|
||||
def mcu_toolchain_matrix(verbose_html=False, platform_filter=None,
|
||||
release_version='5'):
|
||||
|
|
|
@ -46,6 +46,8 @@ from tools.options import get_default_options_parser
|
|||
from tools.options import extract_profile
|
||||
from tools.build_api import build_project
|
||||
from tools.build_api import mcu_toolchain_matrix
|
||||
from tools.build_api import mcu_toolchain_list
|
||||
from tools.build_api import mcu_target_list
|
||||
from utils import argparse_filestring_type
|
||||
from utils import argparse_many
|
||||
from utils import argparse_dir_not_parent
|
||||
|
@ -90,9 +92,11 @@ if __name__ == '__main__':
|
|||
help="Add a macro definition")
|
||||
|
||||
group.add_argument("-S", "--supported-toolchains",
|
||||
action="store_true",
|
||||
dest="supported_toolchains",
|
||||
default=False,
|
||||
const="matrix",
|
||||
choices=["matrix", "toolchains", "targets"],
|
||||
nargs="?",
|
||||
help="Displays supported matrix of MCUs and toolchains")
|
||||
|
||||
parser.add_argument('-f', '--filter',
|
||||
|
@ -182,7 +186,12 @@ if __name__ == '__main__':
|
|||
|
||||
# Only prints matrix of supported toolchains
|
||||
if options.supported_toolchains:
|
||||
print mcu_toolchain_matrix(platform_filter=options.general_filter_regex)
|
||||
if options.supported_toolchains == "matrix":
|
||||
print mcu_toolchain_matrix(platform_filter=options.general_filter_regex)
|
||||
elif options.supported_toolchains == "toolchains":
|
||||
print mcu_toolchain_list()
|
||||
elif options.supported_toolchains == "targets":
|
||||
print mcu_target_list()
|
||||
exit(0)
|
||||
|
||||
# Print available tests in order and exit
|
||||
|
|
Loading…
Reference in New Issue