From d861a7fecff8e900e3a65e09dc7a2e89e57b3b47 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sat, 17 Nov 2018 18:04:53 +0300 Subject: Add --jobs common option --- bdep/clean.hxx | 10 +++++++++- bdep/common.cli | 11 +++++++++++ bdep/test.hxx | 3 +++ bdep/update.hxx | 10 +++++++++- 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/bdep/clean.hxx b/bdep/clean.hxx index 35b37aa..f64c1ef 100644 --- a/bdep/clean.hxx +++ b/bdep/clean.hxx @@ -19,7 +19,15 @@ namespace bdep const cstrings& pkgs, const strings& cfg_vars) { - run_bpkg (2, o, "clean", "-d", c->path, cfg_vars, pkgs); + run_bpkg (2, + o, + (o.jobs_specified () + ? strings ({"-j", to_string (o.jobs ())}) + : strings ()), + "clean", + "-d", c->path, + cfg_vars, + pkgs); } inline int diff --git a/bdep/common.cli b/bdep/common.cli index eb9c6ec..8ab4b8e 100644 --- a/bdep/common.cli +++ b/bdep/common.cli @@ -79,6 +79,17 @@ namespace bdep \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 executing package manager commands such as \l{bpkg-pkg-update(1)}, + \l{bpkg-pkg-test(1)}, etc., which in turn propagate it to the build + system." + } + path --bpkg { "", diff --git a/bdep/test.hxx b/bdep/test.hxx index 33fbd8e..382fe85 100644 --- a/bdep/test.hxx +++ b/bdep/test.hxx @@ -21,6 +21,9 @@ namespace bdep { run_bpkg (2, o, + (o.jobs_specified () + ? strings ({"-j", to_string (o.jobs ())}) + : strings ()), "test", "-d", c->path, (o.immediate () ? "--immediate" : diff --git a/bdep/update.hxx b/bdep/update.hxx index d79c7b2..36ce8da 100644 --- a/bdep/update.hxx +++ b/bdep/update.hxx @@ -19,7 +19,15 @@ namespace bdep const cstrings& pkgs, const strings& cfg_vars) { - run_bpkg (2, o, "update", "-d", c->path, cfg_vars, pkgs); + run_bpkg (2, + o, + (o.jobs_specified () + ? strings ({"-j", to_string (o.jobs ())}) + : strings ()), + "update", + "-d", c->path, + cfg_vars, + pkgs); } inline int -- cgit v1.1