cmds.projects.CmdBuild: Support --dep-flavours

CmdBuild caters for the needs of the targets all, clean and pkg-*. It
uses builtin dependency flavours matching those targets to resolve
build order. To make it more flexible in general and support more
targets, e.g. check and test, add a --dep-flavours option.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-07-11 12:18:58 +02:00
commit 68cda8197e
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61
2 changed files with 36 additions and 21 deletions

View file

@ -53,6 +53,14 @@ class CmdBuild(Cmd): # export
'on the command line'
),
)
parser.add_argument(
'--dep-flavours',
default = 'auto',
help = (
'Dependency flavours to take into consideration for build, '
'comma or space separated'
)
)
parser.add_argument(
'--env-reinit',
action = 'store_true',
@ -247,9 +255,12 @@ class CmdBuild(Cmd): # export
# -- build
order: list[str] = []
if args.dep_flavours != 'auto':
dep_flavours = re.split(r'[\s,]', args.dep_flavours)
else:
dep_flavours = ['build']
if re.match('pkg-.*', target) is not None:
dep_flavours = ['build', 'run', 'release', 'devel']
dep_flavours.extend(['run', 'release', 'devel'])
if target != 'order' and not args.build_order:
log(NOTICE, 'Using prerequisite flavours ' + ' '.join(dep_flavours))

View file

@ -254,7 +254,8 @@ Available subcommands of projects:
tmpl-dir Print directory containing templates of a given module
============= Running: jw-pkg.py --log-level info projects build --help
usage: jw-pkg.py projects build [-h] [--exclude EXCLUDE] [-n] [-O] [-I]
[--env-reinit] [--env-keep ENV_KEEP]
[--dep-flavours DEP_FLAVOURS] [--env-reinit]
[--env-keep ENV_KEEP]
target modules [modules ...]
janware software project build tool
@ -273,6 +274,9 @@ options:
(default: False)
-I, --ignore-deps Don't build dependencies, i.e. build only modules
specified on the command line (default: False)
--dep-flavours DEP_FLAVOURS
Dependency flavours to take into consideration for
build, comma or space separated (default: auto)
--env-reinit Source /etc/profile before each build step. Discard
environment unless --env-keep is specified (default:
False)