Refactor the code and incorporated the review comment

pull/12198/head
Rajkumar Kanagaraj 2020-01-15 04:51:45 -08:00
parent de3c737581
commit 816516e23c
2 changed files with 12 additions and 19 deletions

View File

@ -47,7 +47,7 @@ from .targets import TARGET_NAMES, TARGET_MAP, CORE_ARCH, Target
from .libraries import Library
from .toolchains import TOOLCHAIN_CLASSES, TOOLCHAIN_PATHS
from .toolchains.arm import ARMC5_MIGRATION_WARNING
from .toolchains.arm import UARM_TOOLCHAIN_WARNING, UARM_DEFAULT_TOOLCHAIN_WARNING
from .toolchains.arm import UARM_TOOLCHAIN_WARNING
from .config import Config
RELEASE_VERSIONS = ['2', '5']
@ -233,11 +233,7 @@ def find_valid_toolchain(target, toolchain):
toolchain_names = get_valid_toolchain_names(target, toolchain)
last_error = None
for index, toolchain_name in enumerate(toolchain_names):
internal_tc_name = get_toolchain_name(target, toolchain_name)
if toolchain_name == "ARMC5":
end_warnings.append(ARMC5_MIGRATION_WARNING)
if target.default_toolchain == "uARM":
end_warnings.append(UARM_DEFAULT_TOOLCHAIN_WARNING)
internal_tc_name = get_toolchain_name(target, toolchain_name)
if not TOOLCHAIN_CLASSES[internal_tc_name].check_executable():
search_path = TOOLCHAIN_PATHS[internal_tc_name] or "No path set"
last_error = (
@ -245,10 +241,14 @@ def find_valid_toolchain(target, toolchain):
"Currently set search path: {}"
).format(toolchain_name, search_path)
else:
if toolchain_name == "uARM":
end_warnings.append(UARM_TOOLCHAIN_WARNING)
elif toolchain_name == "ARMC6" and target.default_toolchain == "uARM":
end_warnings.append(UARM_DEFAULT_TOOLCHAIN_WARNING)
if toolchain_name in ["uARM", "ARMC5", "ARMC6"]:
if toolchain_name == "ARMC5":
end_warnings.append(ARMC5_MIGRATION_WARNING)
if (
toolchain_name == "uARM"
or target.default_toolchain == "uARM"
):
end_warnings.append(UARM_TOOLCHAIN_WARNING)
return toolchain_name, internal_tc_name, end_warnings
else:
if last_error:

View File

@ -38,15 +38,8 @@ ARMC5_MIGRATION_WARNING = (
)
UARM_TOOLCHAIN_WARNING = (
"Warning: We noticed that you are using uARM Toolchain. "
"We are deprecating the use of uARM Toolchain. "
"For more information on how to use the ARM toolchain with small C libraries, "
"please visit https://os.mbed.com/docs/mbed-os/latest/reference/using-small-c-libraries.html"
)
UARM_DEFAULT_TOOLCHAIN_WARNING = (
"Warning: We noticed that this target default_toolchain overrides --toolchain option with uARM Toolchain. "
"We are deprecating the use of uARM Toolchain. "
"Warning: We noticed that you are using uARM Toolchain either via --toolchain command line or default_toolchain option. "
"We are deprecating the use of the uARM Toolchain. "
"For more information on how to use the ARM toolchain with small C libraries, "
"please visit https://os.mbed.com/docs/mbed-os/latest/reference/using-small-c-libraries.html"
)