diff --git a/tools/build.py b/tools/build.py index 6c65c7190d..d988a0a649 100644 --- a/tools/build.py +++ b/tools/build.py @@ -36,7 +36,7 @@ from tools.build_api import mcu_toolchain_matrix from tools.build_api import static_analysis_scan, static_analysis_scan_lib, static_analysis_scan_library from tools.build_api import print_build_results from tools.settings import CPPCHECK_CMD, CPPCHECK_MSG_FORMAT -from utils import argparse_filestring_type +from utils import argparse_filestring_type, args_error from tools.settings import CPPCHECK_CMD, CPPCHECK_MSG_FORMAT, CLI_COLOR_MAP from utils import argparse_filestring_type, argparse_dir_not_parent @@ -167,6 +167,9 @@ if __name__ == '__main__': # Get toolchains list toolchains = options.tool if options.tool else TOOLCHAINS + if options.source_dir and not options.build_dir: + args_error(parser, "argument --build is required by argument --source") + if options.color: # This import happens late to prevent initializing colorization when we don't need it import colorize diff --git a/tools/make.py b/tools/make.py index 1505cae125..7cf7ca4a48 100644 --- a/tools/make.py +++ b/tools/make.py @@ -212,9 +212,15 @@ if __name__ == '__main__': # Toolchain if options.tool is None: - args_error(parser, "argument -t/--toolchain is required") + args_error(parser, "argument -t/--tool is required") toolchain = options.tool[0] + if (options.program is None) and (not options.source_dir): + args_error(parser, "one of -p, -n, or --source is required") + + if options.source_dir and not options.build_dir: + args_error(parser, "argument --build is required when argument --source is provided") + if options.color: # This import happens late to prevent initializing colorization when we don't need it import colorize diff --git a/tools/project.py b/tools/project.py index 530def4093..873e7fbe50 100644 --- a/tools/project.py +++ b/tools/project.py @@ -13,7 +13,7 @@ from tools.tests import TESTS, TEST_MAP from tools.tests import test_known, test_name_known from tools.targets import TARGET_NAMES from tools.libraries import LIBRARIES -from utils import argparse_filestring_type, argparse_many +from utils import argparse_filestring_type, argparse_many, args_error from utils import argparse_force_lowercase_type, argparse_force_uppercase_type, argparse_dir_not_parent from project_api import setup_project, perform_export, print_results, get_lib_symbols @@ -131,6 +131,16 @@ if __name__ == '__main__': # source_dir = use relative paths, otherwise sources are copied sources_relative = True if options.source_dir else False + # Target + if not options.mcu: + args_error(parser, "argument -m/--mcu is required") + + # Toolchain + if not options.ide: + args_error(parser, "argument -i is required") + + if (options.program is None) and (not options.source_dir): + args_error(parser, "one of -p, -n, or --source is required") for mcu in options.mcu: # Program Number or name diff --git a/tools/test.py b/tools/test.py index ee009ea3bb..f96bd12f6d 100644 --- a/tools/test.py +++ b/tools/test.py @@ -112,7 +112,7 @@ if __name__ == '__main__': # Toolchain if options.tool is None: - args_error(parser, "argument -t/--toolchain is required") + args_error(parser, "argument -t/--tool is required") toolchain = options.tool[0] # Find all tests in the relevant paths @@ -152,8 +152,7 @@ if __name__ == '__main__': else: # Build all tests if not options.build_dir: - print "[ERROR] You must specify a build path" - sys.exit(1) + args_error(parser, "argument --build is required") base_source_paths = options.source_dir