projects.py: Add support for --build-order

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2018-10-22 21:13:59 +00:00
commit 83631eafc5

View file

@ -200,6 +200,8 @@ class Build(object):
default=False, help='Output debug information to stderr') default=False, help='Output debug information to stderr')
parser.add_argument('--dry-run', '-n', action='store_true', parser.add_argument('--dry-run', '-n', action='store_true',
default=False, help='Don\'t build anything, just print what would be done.') default=False, help='Don\'t build anything, just print what would be done.')
parser.add_argument('--build-order', '-O', action='store_true',
default=False, help='Don\'t build anything, just print the build order.')
parser.add_argument('--ignore-deps', '-I', action='store_true', parser.add_argument('--ignore-deps', '-I', action='store_true',
default=False, help='Don\'t build dependencies, i.e. build only modules specified on the command line') default=False, help='Don\'t build dependencies, i.e. build only modules specified on the command line')
parser.add_argument('target', default='all', help='Build target') parser.add_argument('target', default='all', help='Build target')
@ -221,7 +223,7 @@ class Build(object):
exclude += " " + env_exclude exclude += " " + env_exclude
# -- build # -- build
if target != 'order': if target != 'order' and not args.build_order:
print("calculating order for modules ... ") print("calculating order for modules ... ")
order = [] order = []
@ -234,7 +236,7 @@ class Build(object):
if args.ignore_deps: if args.ignore_deps:
order = [m for m in order if m in args.modules] order = [m for m in order if m in args.modules]
order = [m for m in order if m not in exclude] order = [m for m in order if m not in exclude]
if target == 'order': if target == 'order' or args.build_order:
print(' '.join(order)) print(' '.join(order))
exit(0) exit(0)