Skip to content

Commit cb373e6

Browse files
committed
scripts: flash: Add west config for flash skip rebuild
Add a west config option to skip rebuilds by default or not when doing west flash. Signed-off-by: Declan Snyder <[email protected]>
1 parent 18497c5 commit cb373e6

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

doc/develop/west/build-flash-debug.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,22 @@ only the image from this domain::
551551

552552
.. _west-debugging:
553553

554+
Configuration Options
555+
=====================
556+
557+
You can :ref:`configure <west-config-cmd>` ``west flash`` using these options.
558+
559+
.. NOTE: docs authors: keep this table sorted alphabetically
560+
561+
.. list-table::
562+
:widths: 10 30
563+
:header-rows: 1
564+
565+
* - Option
566+
- Description
567+
* - ``flash.skip-rebuild``
568+
- Boolean, default ``false``. If ``true``, do not rebuild on west flash.
569+
554570
Debugging: ``west debug``, ``west debugserver``
555571
***********************************************
556572

scripts/west_commands/run_common.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,7 @@ def do_run_common(command, user_args, user_runner_args, domain_file=None):
244244
)
245245

246246
build_dir = get_build_dir(user_args)
247-
if not user_args.skip_rebuild:
248-
rebuild(command, build_dir, user_args)
247+
rebuild(command, build_dir, user_args)
249248

250249
domains = get_domains_to_process(build_dir, user_args, domain_file)
251250

@@ -568,6 +567,13 @@ def load_cmake_cache(build_dir, args):
568567
log.die(f'no CMake cache found (expected one at {cache_file})')
569568

570569
def rebuild(command, build_dir, args):
570+
# Check if skip-rebuild is configured globally
571+
skip_rebuild_config = config.get('flash', 'skip-rebuild', fallback='false')
572+
skip_rebuild = args.skip_rebuild or (skip_rebuild_config.lower() == 'true')
573+
574+
if skip_rebuild:
575+
return
576+
571577
_banner(f'west {command.name}: rebuilding')
572578
try:
573579
zcmake.run_build(build_dir)
@@ -723,7 +729,7 @@ def dump_context(command, args, unknown_args):
723729
get_all_domain = True
724730

725731
# Re-build unless asked not to, to make sure the output is up to date.
726-
if build_dir and not args.skip_rebuild:
732+
if build_dir:
727733
rebuild(command, build_dir, args)
728734

729735
domains = get_domains_to_process(build_dir, args, None, get_all_domain)

0 commit comments

Comments
 (0)