From 859a34416d0a11f7ebd0bfc85073b46555fc8d41 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sat, 17 Nov 2018 16:18:29 +0300 Subject: Add --jobs common option --- bpkg/common.cli | 10 ++++++++++ bpkg/pkg-command.cxx | 11 ++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/bpkg/common.cli b/bpkg/common.cli index 646cb2b..ab3d8bd 100644 --- a/bpkg/common.cli +++ b/bpkg/common.cli @@ -81,6 +81,16 @@ namespace bpkg \li|Even more detailed information.||" } + size_t --jobs|-j + { + "", + "Number of jobs to perform in parallel. If this option is not + specified or specified with the \c{0} value, then the number of + available hardware threads is used. This option is also propagated + when performing build system operations such as \cb{update}, + \cb{test}, etc." + } + // In the future we may also have --structured-result, similar to the // build system. // diff --git a/bpkg/pkg-command.cxx b/bpkg/pkg-command.cxx index c66c8da..1d53e03 100644 --- a/bpkg/pkg-command.cxx +++ b/bpkg/pkg-command.cxx @@ -44,7 +44,16 @@ namespace bpkg { bspec += ')'; l4 ([&]{trace << "buildspec: " << bspec;}); - run_b (o, verb_b::normal, cvars, vars, bspec); + + run_b (o, + verb_b::normal, + (o.jobs_specified () + ? strings ({"-j", to_string (o.jobs ())}) + : strings ()), + cvars, + vars, + bspec); + bspec.clear (); } }; -- cgit v1.1