Skip to content
Browse files

scripts: tweak west build output

Follow along with changes made in west flash/debug/etc to make it
easier to see the output steps visually.

Signed-off-by: Marti Bolivar <>
  • Loading branch information...
mbolivar authored and carlescufi committed Jun 3, 2019
1 parent ec8dbf3 commit e6873b8d7e7a14a5cd09bfd4fccd4f74d42204fd
Showing with 19 additions and 9 deletions.
  1. +19 −9 scripts/west_commands/
@@ -30,6 +30,9 @@
cmake_opt Extra options to pass to CMake; implies -c

def _banner(msg):
log.inf('-- west build: ' + msg, colorize=True)

def config_get(option, fallback):
return config.get('build', option, fallback=fallback)

@@ -352,14 +355,15 @@ def _sanity_check(self):

def _run_cmake(self, board, origin, cmake_opts):
log.inf('source directory: {}'.format(self.source_dir), colorize=True)
log.inf('build directory: {}{}'.
' (created)' if self.created_build_dir else ''),
log.inf('BOARD:', ('{} (origin: {})'.format(board, origin) if board
else 'UNKNOWN'),
'''build configuration:
source directory: {}
build directory: {}{}
BOARD: {}'''.
format(self.source_dir, self.build_dir,
' (created)' if self.created_build_dir else '',
('{} (origin: {})'.format(board, origin) if board
else 'UNKNOWN')))

if board is None and config_getboolean('board_warn', True):
log.wrn('This looks like a fresh build and BOARD is unknown;',
@@ -372,6 +376,8 @@ def _run_cmake(self, board, origin, cmake_opts):
log.dbg('Not generating a build system; one is present.')

_banner('generating a build system')

if board is not None and origin != 'CMakeCache.txt':
cmake_opts = ['-DBOARD={}'.format(board)]
@@ -394,7 +400,7 @@ def _run_cmake(self, board, origin, cmake_opts):
run_cmake(final_cmake_args, dry_run=self.args.dry_run)

def _run_pristine(self):
log.inf('Making build dir {} pristine'.format(self.build_dir))
_banner('making build dir {} pristine'.format(self.build_dir))

zb = os.environ.get('ZEPHYR_BASE')
if not zb:
@@ -409,6 +415,10 @@ def _run_pristine(self):
run_cmake(cmake_args, cwd=self.build_dir, dry_run=self.args.dry_run)

def _run_build(self, target):
if target:
_banner('running target {}'.format(target))
_banner('building application')
extra_args = ['--target', target] if target else []
if self.args.build_opt:

0 comments on commit e6873b8

Please sign in to comment.
You can’t perform that action at this time.