Skip to content

Commit 865161f

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 865161f

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-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: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,10 @@ def do_run_common(command, user_args, user_runner_args, domain_file=None):
242242
import_from_path(
243243
module.meta.get("name", "runners_ext"), Path(module.project) / runner["file"]
244244
)
245+
build_dir = get_build_dir(user_args)
245246

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

250250
domains = get_domains_to_process(build_dir, user_args, domain_file)
251251

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

570570
def rebuild(command, build_dir, args):
571+
# Check if skip-rebuild is configured globally
572+
skip_rebuild_config = config.get('flash', 'skip-rebuild', fallback='false')
573+
skip_rebuild = args.skip_rebuild or (skip_rebuild_config.lower() == 'true')
574+
575+
if skip_rebuild:
576+
return
577+
571578
_banner(f'west {command.name}: rebuilding')
572579
try:
573580
zcmake.run_build(build_dir)
@@ -723,7 +730,7 @@ def dump_context(command, args, unknown_args):
723730
get_all_domain = True
724731

725732
# Re-build unless asked not to, to make sure the output is up to date.
726-
if build_dir and not args.skip_rebuild:
733+
if build_dir:
727734
rebuild(command, build_dir, args)
728735

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

0 commit comments

Comments
 (0)