Allow filtering by target as well as by features

pull/2576/head
Jimmy Brisson 2016-08-31 13:40:03 -05:00
parent 1f0afebbbc
commit 4b1dcd398c
2 changed files with 17 additions and 11 deletions

View File

@ -1,8 +1,12 @@
{
"https://developer.mbed.org/teams/mbed/code/mbed_blinky" : [],
"https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-ble-Beacon" : ["BLE"],
"https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-ble-HeartRate" : ["BLE"],
"https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-mesh-minimal" :["IPV4"],
"https://github.com/ARMmbed/mbed-os-example-client" : ["IPV4"],
"https://github.com/ARMmbed/mbed-os-example-sockets" : ["IPV4"]
"https://developer.mbed.org/teams/mbed/code/mbed_blinky" : {},
"https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-ble-Beacon" :
{"features": ["BLE"]},
"https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-ble-HeartRate" :
{"features": ["BLE"]},
"https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-mesh-minimal" :
{"features": ["IPV4"]},
"https://github.com/ARMmbed/mbed-os-example-client" : {"features": ["IPV4"]},
"https://github.com/ARMmbed/mbed-os-example-sockets" : {"features": ["IPV4"]},
"https://github.com/ARMmbed/mbed-os-example-uvisor" : {"targets": ["K64F"]}
}

View File

@ -31,7 +31,8 @@ def print_stuff(name, lst):
SUPPORTED_TOOLCHAINS = ["ARM", "IAR", "GCC_ARM"]
def target_cross_toolchain(required_features, allowed_toolchains):
def target_cross_toolchain(allowed_toolchains,
features=[], targets=TARGET_MAP.keys()):
"""Generate pairs of target and toolchains
Args:
@ -42,8 +43,9 @@ def target_cross_toolchain(required_features, allowed_toolchains):
for target, toolchains in get_mbed_official_release("5"):
for toolchain in toolchains:
if (toolchain in allowed_toolchains and
target in targets and
all(feature in TARGET_MAP[target].features
for feature in required_features)):
for feature in features)):
yield target, toolchain
@ -59,11 +61,11 @@ def main():
failures = []
sucesses = []
for example, build_features in EXAMPLES.iteritems():
for example, requirements in EXAMPLES.iteritems():
subprocess.call(["mbed-cli", "import", example])
os.chdir(basename(example))
for target, toolchain in target_cross_toolchain(build_features,
args.toolchains):
for target, toolchain in target_cross_toolchain(args.toolchains,
**requirements):
proc = subprocess.Popen(["mbed-cli", "compile", "-t",
toolchain, "-m", target])
proc.wait()