mirror of https://github.com/ARMmbed/mbed-os.git
Added new switch --silet to build.py to avoid endless screens of Copy / Compile. In silent mode only warnings / erros / build product will be displayed
parent
027a6bc35d
commit
0c848f8290
|
@ -122,6 +122,12 @@ if __name__ == '__main__':
|
|||
default=False,
|
||||
help="Verbose diagnostic output")
|
||||
|
||||
parser.add_option("-s", "--silent",
|
||||
action="store_true",
|
||||
dest="silent",
|
||||
default=False,
|
||||
help="Silent diagnostic output (no copy, compile notification)")
|
||||
|
||||
parser.add_option("-x", "--extra-verbose-notifications",
|
||||
action="store_true",
|
||||
dest="extra_verbose_notify",
|
||||
|
@ -213,14 +219,24 @@ if __name__ == '__main__':
|
|||
tt_id = "%s::%s" % (toolchain, target)
|
||||
try:
|
||||
mcu = TARGET_MAP[target]
|
||||
lib_build_res = build_mbed_libs(mcu, toolchain, options=options.options,
|
||||
notify=notify, verbose=options.verbose, jobs=options.jobs, clean=options.clean,
|
||||
lib_build_res = build_mbed_libs(mcu, toolchain,
|
||||
options=options.options,
|
||||
notify=notify,
|
||||
verbose=options.verbose,
|
||||
silent=options.silent,
|
||||
jobs=options.jobs,
|
||||
clean=options.clean,
|
||||
macros=options.macros)
|
||||
for lib_id in libraries:
|
||||
notify = print_notify_verbose if options.extra_verbose_notify else None # Special notify for CI (more verbose)
|
||||
build_lib(lib_id, mcu, toolchain, options=options.options,
|
||||
notify=notify, verbose=options.verbose, clean=options.clean,
|
||||
macros=options.macros, jobs=options.jobs)
|
||||
build_lib(lib_id, mcu, toolchain,
|
||||
options=options.options,
|
||||
notify=notify,
|
||||
verbose=options.verbose,
|
||||
silent=options.silent,
|
||||
clean=options.clean,
|
||||
macros=options.macros,
|
||||
jobs=options.jobs)
|
||||
if lib_build_res:
|
||||
successes.append(tt_id)
|
||||
else:
|
||||
|
@ -234,6 +250,7 @@ if __name__ == '__main__':
|
|||
print e
|
||||
|
||||
# Write summary of the builds
|
||||
print
|
||||
print "Completed in: (%.2f)s" % (time() - start)
|
||||
print
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ def build_project(src_path, build_path, target, toolchain_name,
|
|||
|
||||
def build_library(src_paths, build_path, target, toolchain_name,
|
||||
dependencies_paths=None, options=None, name=None, clean=False,
|
||||
notify=None, verbose=False, macros=None, inc_dirs=None, inc_dirs_ext=None, jobs=1):
|
||||
notify=None, verbose=False, macros=None, inc_dirs=None, inc_dirs_ext=None, jobs=1, silent=False):
|
||||
""" src_path: the path of the source directory
|
||||
build_path: the path of the build directory
|
||||
target: ['LPC1768', 'LPC11U24', 'LPC2368']
|
||||
|
@ -112,7 +112,7 @@ def build_library(src_paths, build_path, target, toolchain_name,
|
|||
raise Exception("The library source folder does not exist: %s", src_path)
|
||||
|
||||
# Toolchain instance
|
||||
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, macros=macros, notify=notify)
|
||||
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, macros=macros, notify=notify, silent=silent)
|
||||
toolchain.VERBOSE = verbose
|
||||
toolchain.jobs = jobs
|
||||
toolchain.build_all = clean
|
||||
|
@ -162,7 +162,7 @@ def build_library(src_paths, build_path, target, toolchain_name,
|
|||
toolchain.build_library(objects, bin_path, name)
|
||||
|
||||
|
||||
def build_lib(lib_id, target, toolchain, options=None, verbose=False, clean=False, macros=None, notify=None, jobs=1):
|
||||
def build_lib(lib_id, target, toolchain, options=None, verbose=False, clean=False, macros=None, notify=None, jobs=1, silent=False):
|
||||
""" Wrapper for build_library function.
|
||||
Function builds library in proper directory using all dependencies and macros defined by user.
|
||||
"""
|
||||
|
@ -175,6 +175,7 @@ def build_lib(lib_id, target, toolchain, options=None, verbose=False, clean=Fals
|
|||
|
||||
build_library(lib.source_dir, lib.build_dir, target, toolchain, lib.dependencies, options,
|
||||
verbose=verbose,
|
||||
silent=silent,
|
||||
clean=clean,
|
||||
macros=MACROS,
|
||||
notify=notify,
|
||||
|
@ -186,7 +187,7 @@ def build_lib(lib_id, target, toolchain, options=None, verbose=False, clean=Fals
|
|||
|
||||
|
||||
# We do have unique legacy conventions about how we build and package the mbed library
|
||||
def build_mbed_libs(target, toolchain_name, options=None, verbose=False, clean=False, macros=None, notify=None, jobs=1):
|
||||
def build_mbed_libs(target, toolchain_name, options=None, verbose=False, clean=False, macros=None, notify=None, jobs=1, silent=False):
|
||||
""" Function returns True is library was built and false if building was skipped """
|
||||
# Check toolchain support
|
||||
if toolchain_name not in target.supported_toolchains:
|
||||
|
@ -196,7 +197,7 @@ def build_mbed_libs(target, toolchain_name, options=None, verbose=False, clean=F
|
|||
return False
|
||||
|
||||
# Toolchain
|
||||
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, macros=macros, notify=notify)
|
||||
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, macros=macros, notify=notify, silent=silent)
|
||||
toolchain.VERBOSE = verbose
|
||||
toolchain.jobs = jobs
|
||||
toolchain.build_all = clean
|
||||
|
|
|
@ -16,6 +16,7 @@ limitations under the License.
|
|||
"""
|
||||
|
||||
import re
|
||||
import sys
|
||||
from os import stat, walk
|
||||
from copy import copy
|
||||
from time import time, sleep
|
||||
|
@ -33,9 +34,16 @@ import workspace_tools.hooks as hooks
|
|||
#Disables multiprocessing if set to higher number than the host machine CPUs
|
||||
CPU_COUNT_MIN = 1
|
||||
|
||||
def print_notify(event):
|
||||
# Default command line notification
|
||||
def print_notify(event, silent=False):
|
||||
""" Default command line notification
|
||||
"""
|
||||
if "counter" not in print_notify.__dict__:
|
||||
print_notify.counter = event['type']
|
||||
|
||||
if event['type'] in ['info', 'debug']:
|
||||
if silent:
|
||||
if print_notify.counter == 'progress':
|
||||
print
|
||||
print event['message']
|
||||
|
||||
elif event['type'] == 'cc':
|
||||
|
@ -44,11 +52,15 @@ def print_notify(event):
|
|||
print '[%(severity)s] %(file)s@%(line)s: %(message)s' % event
|
||||
|
||||
elif event['type'] == 'progress':
|
||||
if not silent:
|
||||
print '%s: %s' % (event['action'].title(), basename(event['file']))
|
||||
else:
|
||||
sys.stdout.write('-' if event['action'].title() == 'Copy' else '=')
|
||||
print_notify.counter = event['type']
|
||||
|
||||
|
||||
def print_notify_verbose(event):
|
||||
""" Default command line notification with more verbose mode """
|
||||
def print_notify_verbose(event, silent=False):
|
||||
""" Default command line notification with more verbose mode
|
||||
"""
|
||||
if event['type'] in ['info', 'debug']:
|
||||
print_notify(event) # standard handle
|
||||
|
||||
|
@ -204,22 +216,16 @@ class mbedToolchain:
|
|||
GOANNA_FORMAT = "[Goanna] warning [%FILENAME%:%LINENO%] - [%CHECKNAME%(%SEVERITY%)] %MESSAGE%"
|
||||
GOANNA_DIAGNOSTIC_PATTERN = re.compile(r'"\[Goanna\] (?P<severity>warning) \[(?P<file>[^:]+):(?P<line>\d+)\] \- (?P<message>.*)"')
|
||||
|
||||
def __init__(self, target, options=None, notify=None, macros=None):
|
||||
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
|
||||
self.target = target
|
||||
self.name = self.__class__.__name__
|
||||
self.hook = hooks.Hook(target, self)
|
||||
self.silent = silent
|
||||
|
||||
self.legacy_ignore_dirs = LEGACY_IGNORE_DIRS - set([target.name, LEGACY_TOOLCHAIN_NAMES[self.name]])
|
||||
|
||||
if notify is not None:
|
||||
self.notify = notify
|
||||
else:
|
||||
self.notify = print_notify
|
||||
|
||||
if options is None:
|
||||
self.options = []
|
||||
else:
|
||||
self.options = options
|
||||
self.notify_fun = notify if notify is not None else print_notify
|
||||
self.options = options if options is not None else []
|
||||
|
||||
self.macros = macros or []
|
||||
self.options.extend(BUILD_OPTIONS)
|
||||
|
@ -240,6 +246,11 @@ class mbedToolchain:
|
|||
|
||||
self.mp_pool = None
|
||||
|
||||
def notify(self, event):
|
||||
""" Little closure for notify functions
|
||||
"""
|
||||
return self.notify_fun(event, self.silent)
|
||||
|
||||
def __exit__(self):
|
||||
if self.mp_pool is not None:
|
||||
self.mp_pool.terminate()
|
||||
|
|
|
@ -30,8 +30,8 @@ class ARM(mbedToolchain):
|
|||
DIAGNOSTIC_PATTERN = re.compile('"(?P<file>[^"]+)", line (?P<line>\d+): (?P<severity>Warning|Error): (?P<message>.+)')
|
||||
DEP_PATTERN = re.compile('\S+:\s(?P<file>.+)\n')
|
||||
|
||||
def __init__(self, target, options=None, notify=None, macros=None):
|
||||
mbedToolchain.__init__(self, target, options, notify, macros)
|
||||
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
|
||||
mbedToolchain.__init__(self, target, options, notify, macros, silent)
|
||||
|
||||
if target.core == "Cortex-M0+":
|
||||
cpu = "Cortex-M0"
|
||||
|
@ -147,8 +147,8 @@ class ARM(mbedToolchain):
|
|||
self.default_cmd(args)
|
||||
|
||||
class ARM_STD(ARM):
|
||||
def __init__(self, target, options=None, notify=None, macros=None):
|
||||
ARM.__init__(self, target, options, notify, macros)
|
||||
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
|
||||
ARM.__init__(self, target, options, notify, macros, silent)
|
||||
self.cc += ["-D__ASSERT_MSG"]
|
||||
self.cppc += ["-D__ASSERT_MSG"]
|
||||
self.ld.append("--libpath=%s" % ARM_LIB)
|
||||
|
@ -157,8 +157,8 @@ class ARM_STD(ARM):
|
|||
class ARM_MICRO(ARM):
|
||||
PATCHED_LIBRARY = False
|
||||
|
||||
def __init__(self, target, options=None, notify=None, macros=None):
|
||||
ARM.__init__(self, target, options, notify, macros)
|
||||
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
|
||||
ARM.__init__(self, target, options, notify, macros, silent)
|
||||
|
||||
# Compiler
|
||||
self.asm += ["-D__MICROLIB"]
|
||||
|
|
|
@ -30,8 +30,8 @@ class GCC(mbedToolchain):
|
|||
CIRCULAR_DEPENDENCIES = True
|
||||
DIAGNOSTIC_PATTERN = re.compile('((?P<line>\d+):)(\d+:)? (?P<severity>warning|error): (?P<message>.+)')
|
||||
|
||||
def __init__(self, target, options=None, notify=None, macros=None, tool_path=""):
|
||||
mbedToolchain.__init__(self, target, options, notify, macros)
|
||||
def __init__(self, target, options=None, notify=None, macros=None, silent=False, tool_path=""):
|
||||
mbedToolchain.__init__(self, target, options, notify, macros, silent)
|
||||
|
||||
if target.core == "Cortex-M0+":
|
||||
cpu = "cortex-m0"
|
||||
|
@ -170,8 +170,8 @@ class GCC(mbedToolchain):
|
|||
|
||||
|
||||
class GCC_ARM(GCC):
|
||||
def __init__(self, target, options=None, notify=None, macros=None):
|
||||
GCC.__init__(self, target, options, notify, macros, GCC_ARM_PATH)
|
||||
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
|
||||
GCC.__init__(self, target, options, notify, macros, silent, GCC_ARM_PATH)
|
||||
|
||||
# Use latest gcc nanolib
|
||||
self.ld.append("--specs=nano.specs")
|
||||
|
@ -182,8 +182,8 @@ class GCC_ARM(GCC):
|
|||
|
||||
|
||||
class GCC_CR(GCC):
|
||||
def __init__(self, target, options=None, notify=None, macros=None):
|
||||
GCC.__init__(self, target, options, notify, macros, GCC_CR_PATH)
|
||||
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
|
||||
GCC.__init__(self, target, options, notify, macros, silent, GCC_CR_PATH)
|
||||
|
||||
additional_compiler_flags = [
|
||||
"-D__NEWLIB__", "-D__CODE_RED", "-D__USE_CMSIS", "-DCPP_USE_HEAP",
|
||||
|
@ -199,8 +199,8 @@ class GCC_CR(GCC):
|
|||
|
||||
|
||||
class GCC_CS(GCC):
|
||||
def __init__(self, target, options=None, notify=None, macros=None):
|
||||
GCC.__init__(self, target, options, notify, macros, GCC_CS_PATH)
|
||||
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
|
||||
GCC.__init__(self, target, options, notify, macros, silent, GCC_CS_PATH)
|
||||
|
||||
|
||||
class GCC_CW(GCC):
|
||||
|
@ -208,13 +208,13 @@ class GCC_CW(GCC):
|
|||
"Cortex-M0+": "armv6-m",
|
||||
}
|
||||
|
||||
def __init__(self, target, options=None, notify=None, macros=None):
|
||||
GCC.__init__(self, target, options, notify, macros, CW_GCC_PATH)
|
||||
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
|
||||
GCC.__init__(self, target, options, notify, macros, silent, CW_GCC_PATH)
|
||||
|
||||
|
||||
class GCC_CW_EWL(GCC_CW):
|
||||
def __init__(self, target, options=None, notify=None, macros=None):
|
||||
GCC_CW.__init__(self, target, options, notify, macros)
|
||||
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
|
||||
GCC_CW.__init__(self, target, options, notify, macros, silent)
|
||||
|
||||
# Compiler
|
||||
common = [
|
||||
|
@ -242,5 +242,5 @@ class GCC_CW_EWL(GCC_CW):
|
|||
|
||||
|
||||
class GCC_CW_NEWLIB(GCC_CW):
|
||||
def __init__(self, target, options=None, notify=None, macros=None):
|
||||
GCC_CW.__init__(self, target, options, notify, macros)
|
||||
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
|
||||
GCC_CW.__init__(self, target, options, notify, macros, silent)
|
||||
|
|
|
@ -30,8 +30,8 @@ class IAR(mbedToolchain):
|
|||
|
||||
DIAGNOSTIC_PATTERN = re.compile('"(?P<file>[^"]+)",(?P<line>[\d]+)\s+(?P<severity>Warning|Error)(?P<message>.+)')
|
||||
|
||||
def __init__(self, target, options=None, notify=None, macros=None):
|
||||
mbedToolchain.__init__(self, target, options, notify, macros)
|
||||
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
|
||||
mbedToolchain.__init__(self, target, options, notify, macros, silent)
|
||||
|
||||
c_flags = [
|
||||
"--cpu=%s" % target.core, "--thumb",
|
||||
|
|
Loading…
Reference in New Issue