Skip to content

Commit 8926df9

Browse files
nordicjmrlubos
authored andcommitted
[nrf noup] scripts: west: build: Use sysbuild by default if in NCS dir
Uses sysbuild by default when building an application which resides in an allowed NCS-based directory when the sysbuild config key is not set. Do not use sysbuild if the mps2 board is being used to avoid problems with CI testing. Signed-off-by: Jamie McCrae <[email protected]>
1 parent fb155f1 commit 8926df9

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

scripts/west_commands/build.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
import sys
1010
import yaml
1111

12+
from pathlib import Path
13+
from zephyr_ext_common import ZEPHYR_BASE
14+
sys.path.append(os.fspath(Path(__file__).parent.parent))
15+
import zephyr_module
16+
1217
from west import log
1318
from west.configuration import config
1419
from zcmake import DEFAULT_CMAKE_GENERATOR, run_cmake, run_build, CMakeCache
@@ -557,7 +562,24 @@ def _run_cmake(self, board, origin, cmake_opts):
557562
if user_args:
558563
cmake_opts.extend(shlex.split(user_args))
559564

560-
config_sysbuild = config_getboolean('sysbuild', False)
565+
config_sysbuild = config_getboolean('sysbuild', None)
566+
567+
if config_sysbuild is None:
568+
# Check if this is an ncs-repo directory
569+
allow_list = [ 'mcuboot', 'sidewalk', 'find-my', 'nrf', 'matter', 'suit-processor',
570+
'memfault-firmware-sdk', 'zscilib', 'uoscore-uedhoc', 'zcbor',
571+
'hal_nordic' ]
572+
config_sysbuild = False
573+
574+
for module in zephyr_module.parse_modules(ZEPHYR_BASE, self.manifest):
575+
if module.meta['name'] in allow_list and Path(self.source_dir).is_relative_to(module.project):
576+
config_sysbuild = True
577+
break
578+
579+
if config_sysbuild is False and Path(self.source_dir).is_relative_to(ZEPHYR_BASE):
580+
config_sysbuild = True
581+
582+
561583
if self.args.sysbuild or (config_sysbuild and not self.args.no_sysbuild):
562584
cmake_opts.extend(['-S{}'.format(SYSBUILD_PROJ_DIR),
563585
'-DAPP_DIR:PATH={}'.format(self.source_dir)])

0 commit comments

Comments
 (0)