aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-05-10 10:34:31 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-05-10 10:34:31 +0200
commit023f1a286b7dfe80eb80a9e6924e492cf6f3f80a (patch)
tree6accbb5ccee95ae5cb7ba9f186b2694c9797b2d9
parente3133aa9628858bcfe414f95731831b5962358c7 (diff)
Implement test, update, and clean commands
-rw-r--r--bdep/bdep.cli15
-rw-r--r--bdep/bdep.cxx6
-rw-r--r--bdep/build.hxx27
-rw-r--r--bdep/build.txx115
-rw-r--r--bdep/buildfile11
-rw-r--r--bdep/clean.cli49
-rw-r--r--bdep/clean.hxx32
-rw-r--r--bdep/config.cli8
-rw-r--r--bdep/fetch.cli9
-rw-r--r--bdep/init.cli1
-rw-r--r--bdep/project.hxx8
-rw-r--r--bdep/status.cli11
-rw-r--r--bdep/sync.cli15
-rw-r--r--bdep/sync.cxx200
-rw-r--r--bdep/sync.hxx7
-rw-r--r--bdep/test.cli49
-rw-r--r--bdep/test.hxx32
-rw-r--r--bdep/update.cli49
-rw-r--r--bdep/update.hxx32
-rwxr-xr-xdoc/cli.sh2
20 files changed, 566 insertions, 112 deletions
diff --git a/bdep/bdep.cli b/bdep/bdep.cli
index 3b3d762..21b3c68 100644
--- a/bdep/bdep.cli
+++ b/bdep/bdep.cli
@@ -413,6 +413,21 @@ namespace bdep
{
"\l{bdep-config(1)} \- manage project's build configurations"
}
+
+ bool test
+ {
+ "\l{bdep-test(1)} \- test project in build configurations"
+ }
+
+ bool update
+ {
+ "\l{bdep-update(1)} \- update project in build configurations"
+ }
+
+ bool clean
+ {
+ "\l{bdep-clean(1)} \- clean project in build configurations"
+ }
};
// Make sure these don't conflict with command names above.
diff --git a/bdep/bdep.cxx b/bdep/bdep.cxx
index f25bed3..b382776 100644
--- a/bdep/bdep.cxx
+++ b/bdep/bdep.cxx
@@ -28,6 +28,9 @@
#include <bdep/fetch.hxx>
#include <bdep/status.hxx>
#include <bdep/config.hxx>
+#include <bdep/test.hxx>
+#include <bdep/update.hxx>
+#include <bdep/clean.hxx>
using namespace std;
using namespace bdep;
@@ -262,6 +265,9 @@ try
COMMAND_IMPL (fetch, fetch, "fetch");
COMMAND_IMPL (status, status, "status");
COMMAND_IMPL (config, config, "config");
+ COMMAND_IMPL (test, test, "test");
+ COMMAND_IMPL (update, update, "update");
+ COMMAND_IMPL (clean, clean, "clean");
assert (false);
fail << "unhandled command";
diff --git a/bdep/build.hxx b/bdep/build.hxx
new file mode 100644
index 0000000..64c65a7
--- /dev/null
+++ b/bdep/build.hxx
@@ -0,0 +1,27 @@
+// file : bdep/build.hxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+#ifndef BDEP_BUILD_HXX
+#define BDEP_BUILD_HXX
+
+#include <bdep/types.hxx>
+#include <bdep/utility.hxx>
+
+namespace bdep
+{
+ // Common "build system command" (update, clean, test) implementation.
+ //
+ template <typename O>
+ int
+ cmd_build (const O& o,
+ void (*build) (const O&,
+ const shared_ptr<configuration>&,
+ const cstrings&,
+ const strings&),
+ cli::scanner& args);
+}
+
+#include <bdep/build.txx>
+
+#endif // BDEP_BUILD_HXX
diff --git a/bdep/build.txx b/bdep/build.txx
new file mode 100644
index 0000000..3aaed2b
--- /dev/null
+++ b/bdep/build.txx
@@ -0,0 +1,115 @@
+// file : bdep/build.txx -*- C++ -*-
+// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+#include <cstring> // strchr()
+
+#include <bdep/project.hxx>
+#include <bdep/database.hxx>
+#include <bdep/diagnostics.hxx>
+
+#include <bdep/sync.hxx>
+
+namespace bdep
+{
+ template <typename O>
+ int
+ cmd_build (const O& o,
+ void (*build) (const O&,
+ const shared_ptr<configuration>&,
+ const cstrings&,
+ const strings&),
+ cli::scanner& args)
+ {
+ tracer trace ("build");
+
+ // Save cfg-vars with some sanity checking.
+ //
+ strings cfg_vars;
+ while (args.more ())
+ {
+ const char* a (args.next ());
+
+ if (strchr (a , '=') == nullptr)
+ fail << "'" << a << "' does not look like a variable assignment";
+
+ cfg_vars.push_back (a);
+ }
+
+ // The same ignore/load story as in sync.
+ //
+ project_packages pp (
+ find_project_packages (o,
+ false /* ignore_packages */,
+ false /* load_packages */));
+
+ const dir_path& prj (pp.project);
+
+ database db (open (prj, trace));
+
+ transaction t (db.begin ());
+ configurations cfgs (find_configurations (prj, t, o));
+ t.commit ();
+
+ // If specified, verify packages are present in each configuration.
+ //
+ if (!pp.packages.empty ())
+ verify_project_packages (pp, cfgs);
+
+ // If no packages were explicitly specified, then we build all that have
+ // been initialized in each configuration.
+ //
+ cstrings pkgs;
+
+ bool all (pp.packages.empty ());
+ if (!all)
+ {
+ for (const package_location& p: pp.packages)
+ pkgs.push_back (p.name.c_str ());
+ }
+
+ // Build in each configuration skipping empty ones.
+ //
+ bool first (true);
+ for (const shared_ptr<configuration>& c: cfgs)
+ {
+ if (c->packages.empty ())
+ {
+ if (verb)
+ info << "skipping empty configuration " << *c;
+
+ continue;
+ }
+
+ // Collect packages.
+ //
+ if (all)
+ {
+ pkgs.clear ();
+
+ for (const package_state& p: c->packages)
+ pkgs.push_back (p.name.c_str ());
+ }
+
+ // If we are printing multiple configurations, separate them with a
+ // blank line and print the configuration name/directory.
+ //
+ if (verb && cfgs.size () > 1)
+ {
+ text << (first ? "" : "\n")
+ << "in configuration " << *c << ':';
+
+ first = false;
+ }
+
+ // Pre-sync the configuration to avoid triggering the build system
+ // hook (see sync for details).
+ //
+ cmd_sync (o, prj, c, strings () /* pkg_args */, true /* implicit */);
+
+ build (o, c, pkgs, cfg_vars);
+ }
+
+ return 0;
+ }
+}
diff --git a/bdep/buildfile b/bdep/buildfile
index 0fb8e8c..54ba5e4 100644
--- a/bdep/buildfile
+++ b/bdep/buildfile
@@ -14,6 +14,9 @@ import libs += libbutl%lib{butl}
import libs += libodb%lib{odb}
import libs += libodb-sqlite%lib{odb-sqlite}
+# @@ Why don't we generate these with wildcard patterns (and rules below with
+# a for-loop)?
+#
options_topics = \
bdep-options \
common-options \
@@ -24,7 +27,10 @@ init-options \
sync-options \
fetch-options \
status-options \
-config-options
+config-options \
+test-options \
+update-options \
+clean-options
help_topics = projects-configs
@@ -64,6 +70,9 @@ if $cli.configured
cli.cxx{fetch-options}: cli{fetch}
cli.cxx{status-options}: cli{status}
cli.cxx{config-options}: cli{config}
+ cli.cxx{test-options}: cli{test}
+ cli.cxx{update-options}: cli{update}
+ cli.cxx{clean-options}: cli{clean}
# Help topics.
#
diff --git a/bdep/clean.cli b/bdep/clean.cli
new file mode 100644
index 0000000..c0d84e2
--- /dev/null
+++ b/bdep/clean.cli
@@ -0,0 +1,49 @@
+// file : bdep/clean.cli
+// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+include <bdep/project.cli>;
+
+"\section=1"
+"\name=bdep-clean"
+"\summary=clean project in build configurations"
+
+namespace bdep
+{
+ {
+ "<options>
+ <prj-spec> <prj-dir>
+ <pkg-spec> <pkg-dir>
+ <cfg-spec> <cfg-name> <cfg-dir>
+ <cfg-var>",
+
+ "\h|SYNOPSIS|
+
+ \c{\b{bdep clean} [<options>] [<pkg-spec>] [<cfg-spec>] [<cfg-var>...]}
+
+ \c{<cfg-spec> = (\b{@}<cfg-name> | \b{--config}|\b{-c} <cfg-dir>)... | \b{--all}|\b{-a}\n
+ <pkg-spec> = (\b{--directory}|\b{-d} <pkg-dir>)... | <prj-spec>\n
+ <prj-spec> = \b{--directory}|\b{-d} <prj-dir>}
+
+ \h|DESCRIPTION|
+
+ The \cb{clean} command cleans the project packages in one or more build
+ configurations. Underneath it executes the \l{bpkg-pkg-clean(1)} command
+ which itself is not much more than the build system \cb{clean} operation
+ (see \l{b(1)} for details). As a result, the main utility of this command
+ is the ability to refer to build configurations by names and to project
+ packages implicitly via the current working directory.
+
+ If no project or package directory is specified, then the current working
+ directory is assumed. If no configuration is specified, then the default
+ configuration is assumed. See \l{bdep-projects-configs(1)} for details on
+ specifying projects and configurations. Optional \c{\i{cfg-var}...} are
+ the additional configuration variables to pass to the build system.
+ "
+ }
+
+ class cmd_clean_options: project_options
+ {
+ "\h|CLEAN OPTIONS|"
+ };
+}
diff --git a/bdep/clean.hxx b/bdep/clean.hxx
new file mode 100644
index 0000000..c66ecc1
--- /dev/null
+++ b/bdep/clean.hxx
@@ -0,0 +1,32 @@
+// file : bdep/clean.hxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+#ifndef BDEP_CLEAN_HXX
+#define BDEP_CLEAN_HXX
+
+#include <bdep/types.hxx>
+#include <bdep/utility.hxx>
+
+#include <bdep/build.hxx>
+#include <bdep/clean-options.hxx>
+
+namespace bdep
+{
+ inline void
+ cmd_clean (const cmd_clean_options& o,
+ const shared_ptr<configuration>& c,
+ const cstrings& pkgs,
+ const strings& cfg_vars)
+ {
+ run_bpkg (2, o, "clean", "-d", c->path, cfg_vars, pkgs);
+ }
+
+ inline int
+ cmd_clean (const cmd_clean_options& o, cli::scanner& args)
+ {
+ return cmd_build (o, &cmd_clean, args);
+ }
+}
+
+#endif // BDEP_CLEAN_HXX
diff --git a/bdep/config.cli b/bdep/config.cli
index 494353e..1633edb 100644
--- a/bdep/config.cli
+++ b/bdep/config.cli
@@ -66,14 +66,14 @@ namespace bdep
\li|\cb{create}
The \cb{add} subcommand adds an existing \l{bpkg(1)} build
- configuration in directory <cfg-dir> to the project's build
+ configuration in directory \ci{cfg-dir} to the project's build
configuration set. The \cb{create} subcommand creates a new
- configuration in directory <cfg-dir> by executing the
- \l{bpkg-cfg-create(1)} command and passing to it <cfg-args>, if
+ configuration in directory \ci{cfg-dir} by executing the
+ \l{bpkg-cfg-create(1)} command and passing to it \ci{cfg-args}, if
any. It then proceeds as \cb{add} by adding the new configuration to
the project's build configuration set.
- In both subcommands, if <cfg-name> is specified, then the added
+ In both subcommands, if \ci{cfg-name} is specified, then the added
configuration is given this name. Several \cb{bdep} commands can use
such names as a more convenient way to specify build configurations
(see \l{bdep-projects-configs(1)} for details).
diff --git a/bdep/fetch.cli b/bdep/fetch.cli
index 5b82090..011fd0a 100644
--- a/bdep/fetch.cli
+++ b/bdep/fetch.cli
@@ -26,12 +26,13 @@ namespace bdep
The \cb{fetch} command fetches the list of packages available in the
project's prerequisite/complement repositories in one or more build
- configurations. If no project or package directory is specified, then the
- current working directory is assumed. If no configuration is specified,
- then the default configuration is assumed. See
- \l{bdep-projects-configs(1)} for details on specifying projects and
configurations.
+ If no project or package directory is specified, then the current working
+ directory is assumed. If no configuration is specified, then the default
+ configuration is assumed. See \l{bdep-projects-configs(1)} for details on
+ specifying projects and configurations.
+
If the \cb{--full|-F} option is specified, then instead \cb{fetch}
performs a full re-fetch of all the repositories added to the
configuration. This mode is primarily useful when a configuration (and
diff --git a/bdep/init.cli b/bdep/init.cli
index c410d7d..f43ef7a 100644
--- a/bdep/init.cli
+++ b/bdep/init.cli
@@ -39,6 +39,7 @@ namespace bdep
(<pkg-spec>), or, if the project itself is specified (<prj-spec>), all
its available packages, in one or more build configurations (<cfg-spec>)
that have already been associated with the project (\l{bdep-config(1)}).
+
If no project directory is specified, then the current working directory
is assumed. If no configuration is specified, then the default
configuration is assumed. See \l{bdep-projects-configs(1)} for details on
diff --git a/bdep/project.hxx b/bdep/project.hxx
index bbfd41d..f3c48d7 100644
--- a/bdep/project.hxx
+++ b/bdep/project.hxx
@@ -148,10 +148,10 @@ namespace bdep
// project. The result is an absolute and normalized project directory and a
// vector of relative (to the project directory) package locations.
//
- // If ignore_packages is true then ignore packages in case the resulting
- // vector will be empty. Otherwise, if load_packages is false, then don't
- // load all the available packages from packages.manifest if none were
- // found/specified.
+ // If ignore_packages is true then ignore packages in which case the
+ // resulting vector will be empty. Otherwise, if load_packages is false,
+ // then don't load all the available packages from packages.manifest if none
+ // were found/specified.
//
// Note that if the package directory is the same as project, then the
// package path will be empty (and not ./).
diff --git a/bdep/status.cli b/bdep/status.cli
index 4b4b643..0cde91e 100644
--- a/bdep/status.cli
+++ b/bdep/status.cli
@@ -29,11 +29,12 @@ namespace bdep
\h|DESCRIPTION|
The \cb{status} command prints the status of project packages and/or
- their dependencies in one or more build configurations. If no project or
- package directory is specified, then the current working directory is
- assumed. If no configuration is specified, then the default configuration
- is assumed. See \l{bdep-projects-configs(1)} for details on specifying
- projects and configurations.
+ their dependencies in one or more build configurations.
+
+ If no project or package directory is specified, then the current working
+ directory is assumed. If no configuration is specified, then the default
+ configuration is assumed. See \l{bdep-projects-configs(1)} for details on
+ specifying projects and configurations.
If no <dep-spec> arguments are specified, then \cb{status} prints the
status of the project's packages. Otherwise, the status of the specified
diff --git a/bdep/sync.cli b/bdep/sync.cli
index 9aa142b..ea5d51f 100644
--- a/bdep/sync.cli
+++ b/bdep/sync.cli
@@ -38,13 +38,14 @@ namespace bdep
configurations. The first form (no arguments nor \cb{--upgrade} or
\cb{--patch} are specified) upgrades the project packages to the latest
version/iteration, adjusts their dependencies according to the latest
- manifest information, and updates the lockfile. If no project or package
- directory is specified, then the current working directory is assumed. If
- no configuration is specified, then the default configuration is
- assumed. See \l{bdep-projects-configs(1)} for details on specifying
- projects and configurations. Optional <pkg-args> are the additional
- dependency packages and/or configuration variables to pass to the
- underlying \l{bpkg-pkg-build(1)} command.
+ manifest information, and updates the lockfile.
+
+ If no project or package directory is specified, then the current working
+ directory is assumed. If no configuration is specified, then the default
+ configuration is assumed. See \l{bdep-projects-configs(1)} for details on
+ specifying projects and configurations. Optional <pkg-args> are the
+ additional dependency packages and/or configuration variables to pass to
+ the underlying \l{bpkg-pkg-build(1)} command.
The second form (no arguments but either \cb{--upgrade} or \cb{--patch}
is specified), in addition to the first form's functionality, also
diff --git a/bdep/sync.cxx b/bdep/sync.cxx
index 8ecae4f..484a1ad 100644
--- a/bdep/sync.cxx
+++ b/bdep/sync.cxx
@@ -141,6 +141,7 @@ namespace bdep
bool implicit,
bool fetch,
bool yes,
+ bool name_cfg,
optional<bool> upgrade, // true - upgrade, false - patch
optional<bool> recursive, // true - recursive, false - immediate
const package_locations& prj_pkgs,
@@ -257,16 +258,22 @@ namespace bdep
if (!reps.empty ())
run_bpkg (3, co, "fetch", "-d", cfg, "--shallow", reps);
- // For implicit sync (normally performed on one configuration at a time)
- // add the configuration directory to the plan header.
- //
- // We use the configuration directory rather than the name because this
- // could be a multi-project configuration and in the implicit mode there
- // will normally be no "originating project" (unlike with explicit sync).
- //
- string plan (implicit
- ? "synchronizing " + cfg.representation () + ':'
- : "synchronizing:");
+ string plan ("synchronizing");
+ if (name_cfg)
+ {
+ plan += ' ';
+
+ // Use name if available, directory otherwise.
+ //
+ if (origin_config != nullptr && origin_config->name)
+ {
+ plan += '@';
+ plan += *origin_config->name;
+ }
+ else
+ plan += cfg.representation ();
+ }
+ plan += ':';
run_bpkg (2,
co,
@@ -405,6 +412,69 @@ namespace bdep
}
}
+ // The BDEP_SYNCED_CONFIGS environment variable.
+ //
+ // Note that it covers both depth and breadth (i.e., we don't restore the
+ // previous value before returning). The idea here is for commands like
+ // update or test would perform an implicit sync which will then be
+ // "noticed" by the build system hook. This should be both faster (no need
+ // to spawn multiple bdep processes) and simpler (no need to worry about
+ // who has the database open, etc).
+ //
+ // We also used to do this only in the first form of sync but it turns out
+ // we may end up invoking a hook during upgrade (e.g., to prepare a
+ // distribution of a package as part of pkg-checkout which happens in the
+ // configuration we have "hooked" -- yeah, this rabbit hole is deep).
+ //
+ const char synced_name[] = "BDEP_SYNCED_CONFIGS";
+
+ // Check if the specified configuration directory is already (being)
+ // synchronized. If it is not and add is true, then add it to the
+ // BDEP_SYNCED_CONFIGS environment variable.
+ //
+ //
+ static bool
+ synced (const dir_path& d, bool implicit, bool add = true)
+ {
+ string v;
+ const string& p (d.string ());
+
+ if (const char* e = getenv (synced_name))
+ v = e;
+
+ for (size_t b (0), e (0);
+ (e = v.find ('"', e)) != string::npos; // Skip leading ' '.
+ ++e) // Skip trailing '"'.
+ {
+ size_t n (next_word (v, b, e, '"'));
+
+ // Both paths are normilized so we can just compare them as
+ // strings.
+ //
+ if (path::traits::compare (v.c_str () + b, n,
+ p.c_str (), p.size ()) == 0)
+ {
+ if (implicit)
+ return true;
+ else
+ fail << "explicit re-synchronization of " << d;
+ }
+ }
+
+ if (add)
+ {
+ v += (v.empty () ? "\"" : " \"") + p + '"';
+
+#ifndef _WIN32
+ setenv (synced_name, v.c_str (), 1 /* overwrite */);
+#else
+ _putenv ((string (synced_name) + '=' + v).c_str ());
+#endif
+ }
+
+ return false;
+ }
+
void
cmd_sync (const common_options& co,
const dir_path& prj,
@@ -412,20 +482,23 @@ namespace bdep
const strings& pkg_args,
bool implicit,
bool fetch,
- bool yes)
+ bool yes,
+ bool name_cfg)
{
- cmd_sync (co,
- c->path,
- prj,
- c,
- pkg_args,
- implicit,
- fetch,
- yes,
- nullopt /* upgrade */,
- nullopt /* recursive */,
- package_locations () /* prj_pkgs */,
- strings () /* dep_pkgs */);
+ if (!synced (c->path, implicit))
+ cmd_sync (co,
+ c->path,
+ prj,
+ c,
+ pkg_args,
+ implicit,
+ fetch,
+ yes,
+ name_cfg,
+ nullopt /* upgrade */,
+ nullopt /* recursive */,
+ package_locations () /* prj_pkgs */,
+ strings () /* dep_pkgs */);
}
int
@@ -559,9 +632,15 @@ namespace bdep
d.complete ();
d.normalize ();
- cfgs.push_back (nullptr);
- cfg_dirs.push_back (move (d));
+ if (!synced (d, o.implicit (), false /* add */))
+ {
+ cfgs.push_back (nullptr);
+ cfg_dirs.push_back (move (d));
+ }
}
+
+ if (cfgs.empty ())
+ return 0; // All configuration are already (being) synchronized.
}
// Synchronize each configuration.
@@ -571,6 +650,11 @@ namespace bdep
const shared_ptr<configuration>& c (cfgs[i]); // Can be NULL.
const dir_path& cd (c != nullptr ? c->path : cfg_dirs[i]);
+ // Check if this configuration is already (being) synchronized.
+ //
+ if (synced (cd, o.implicit ()))
+ continue;
+
// Skipping empty ones.
//
if (c != nullptr && c->packages.empty ())
@@ -593,64 +677,6 @@ namespace bdep
if (fetch)
cmd_fetch (o, prj, c, o.fetch_full ());
- // Update the BDEP_SYNCED_CONFIGS environment variable.
- //
- // Note that it covers both depth and breadth (i.e., we don't restore
- // the previous value before returning). The idea here is for commands
- // like update or test would perform an implicit sync which will then be
- // "noticed" by the build system hook. This should be both faster (no
- // need to spawn multiple bdep processes) and simpler (no need to worry
- // about who has the database open, etc).
- //
- // We also used to do this only in the first form of sync but it turns
- // out we may end up invoking a hook during upgrade (e.g., to prepare a
- // distribution of a package as part of pkg-checkout which happens in
- // the configuration we have "hooked" -- yeah, this rabbit hole's deep).
- {
- const char n[] = "BDEP_SYNCED_CONFIGS";
-
- string v;
- const string& p (cd.string ());
-
- if (const char* e = getenv (n))
- {
- v = e;
-
- // Check if this configuration is already (being) synchronized.
- //
- for (size_t b (0), e (0);
- (e = v.find ('"', e)) != string::npos; // Skip leading ' '.
- ++e) // Skip trailing '"'.
- {
- size_t n (next_word (v, b, e, '"'));
-
- // Both paths are normilized so we can just compare them as
- // strings.
- //
- if (path::traits::compare (v.c_str () + b, n,
- p.c_str (), p.size ()) == 0)
- {
- if (o.implicit ())
- return 0; // Ignore.
- else
- fail << "explicit re-synchronization of " << cd;
- }
- }
-
- v += ' ';
- }
-
- v += '"';
- v += p;
- v += '"';
-
-#ifndef _WIN32
- setenv (n, v.c_str (), 1 /* overwrite */);
-#else
- _putenv ((string (n) + '=' + v).c_str ());
-#endif
- }
-
if (!dep_pkgs.empty ())
{
// The third form: upgrade of the specified dependencies.
@@ -665,6 +691,7 @@ namespace bdep
false /* implicit */,
!fetch,
o.recursive () || o.immediate () ? o.yes () : true,
+ false /* name_cfg */,
!o.patch (), // Upgrade by default unless patch requested.
(o.recursive () ? optional<bool> (true) :
o.immediate () ? optional<bool> (false) : nullopt),
@@ -684,6 +711,7 @@ namespace bdep
false /* implicit */,
!fetch,
o.yes (),
+ false /* name_cfg */,
o.upgrade (),
o.recursive (),
prj_pkgs,
@@ -693,6 +721,9 @@ namespace bdep
{
// The first form: sync of project packages (potentially implicit).
//
+ // For implicit sync (normally performed on one configuration at a
+ // time) add the configuration name/directory to the plan header.
+ //
cmd_sync (o,
cd,
prj,
@@ -700,7 +731,8 @@ namespace bdep
pkg_args,
o.implicit (),
!fetch,
- true /* yes */,
+ true /* yes */,
+ o.implicit () /* name_cfg */,
nullopt /* upgrade */,
nullopt /* recursive */,
package_locations () /* prj_pkgs */,
diff --git a/bdep/sync.hxx b/bdep/sync.hxx
index 0894c9b..1aebfe3 100644
--- a/bdep/sync.hxx
+++ b/bdep/sync.hxx
@@ -17,7 +17,9 @@ namespace bdep
// configuration variables to pass to bpkg-pkg-build (see bdep-init).
//
// If fetch is false, don't perform a (shallow) fetch of the project
- // repository. If yes is false, then don't suppress bpkg prompts.
+ // repository. If yes is false, then don't suppress bpkg prompts. If
+ // name_cfg is true then include the configuration name/directory into
+ // progress.
//
void
cmd_sync (const common_options&,
@@ -26,7 +28,8 @@ namespace bdep
const strings& pkg_args,
bool implicit,
bool fetch = true,
- bool yes = true);
+ bool yes = true,
+ bool name_cfg = false);
int
cmd_sync (cmd_sync_options&&, cli::group_scanner& args);
diff --git a/bdep/test.cli b/bdep/test.cli
new file mode 100644
index 0000000..d1fd931
--- /dev/null
+++ b/bdep/test.cli
@@ -0,0 +1,49 @@
+// file : bdep/test.cli
+// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+include <bdep/project.cli>;
+
+"\section=1"
+"\name=bdep-test"
+"\summary=test project in build configurations"
+
+namespace bdep
+{
+ {
+ "<options>
+ <prj-spec> <prj-dir>
+ <pkg-spec> <pkg-dir>
+ <cfg-spec> <cfg-name> <cfg-dir>
+ <cfg-var>",
+
+ "\h|SYNOPSIS|
+
+ \c{\b{bdep test} [<options>] [<pkg-spec>] [<cfg-spec>] [<cfg-var>...]}
+
+ \c{<cfg-spec> = (\b{@}<cfg-name> | \b{--config}|\b{-c} <cfg-dir>)... | \b{--all}|\b{-a}\n
+ <pkg-spec> = (\b{--directory}|\b{-d} <pkg-dir>)... | <prj-spec>\n
+ <prj-spec> = \b{--directory}|\b{-d} <prj-dir>}
+
+ \h|DESCRIPTION|
+
+ The \cb{test} command tests the project packages in one or more build
+ configurations. Underneath it executes the \l{bpkg-pkg-test(1)} command
+ which itself is not much more than the build system \cb{test} operation
+ (see \l{b(1)} for details). As a result, the main utility of this command
+ is the ability to refer to build configurations by names and to project
+ packages implicitly via the current working directory.
+
+ If no project or package directory is specified, then the current working
+ directory is assumed. If no configuration is specified, then the default
+ configuration is assumed. See \l{bdep-projects-configs(1)} for details on
+ specifying projects and configurations. Optional \c{\i{cfg-var}...} are
+ the additional configuration variables to pass to the build system.
+ "
+ }
+
+ class cmd_test_options: project_options
+ {
+ "\h|TEST OPTIONS|"
+ };
+}
diff --git a/bdep/test.hxx b/bdep/test.hxx
new file mode 100644
index 0000000..b057c24
--- /dev/null
+++ b/bdep/test.hxx
@@ -0,0 +1,32 @@
+// file : bdep/test.hxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+#ifndef BDEP_TEST_HXX
+#define BDEP_TEST_HXX
+
+#include <bdep/types.hxx>
+#include <bdep/utility.hxx>
+
+#include <bdep/build.hxx>
+#include <bdep/test-options.hxx>
+
+namespace bdep
+{
+ inline void
+ cmd_test (const cmd_test_options& o,
+ const shared_ptr<configuration>& c,
+ const cstrings& pkgs,
+ const strings& cfg_vars)
+ {
+ run_bpkg (2, o, "test", "-d", c->path, cfg_vars, pkgs);
+ }
+
+ inline int
+ cmd_test (const cmd_test_options& o, cli::scanner& args)
+ {
+ return cmd_build (o, &cmd_test, args);
+ }
+}
+
+#endif // BDEP_TEST_HXX
diff --git a/bdep/update.cli b/bdep/update.cli
new file mode 100644
index 0000000..e78dab4
--- /dev/null
+++ b/bdep/update.cli
@@ -0,0 +1,49 @@
+// file : bdep/update.cli
+// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+include <bdep/project.cli>;
+
+"\section=1"
+"\name=bdep-update"
+"\summary=update project in build configurations"
+
+namespace bdep
+{
+ {
+ "<options>
+ <prj-spec> <prj-dir>
+ <pkg-spec> <pkg-dir>
+ <cfg-spec> <cfg-name> <cfg-dir>
+ <cfg-var>",
+
+ "\h|SYNOPSIS|
+
+ \c{\b{bdep update} [<options>] [<pkg-spec>] [<cfg-spec>] [<cfg-var>...]}
+
+ \c{<cfg-spec> = (\b{@}<cfg-name> | \b{--config}|\b{-c} <cfg-dir>)... | \b{--all}|\b{-a}\n
+ <pkg-spec> = (\b{--directory}|\b{-d} <pkg-dir>)... | <prj-spec>\n
+ <prj-spec> = \b{--directory}|\b{-d} <prj-dir>}
+
+ \h|DESCRIPTION|
+
+ The \cb{update} command updates the project packages in one or more build
+ configurations. Underneath it executes the \l{bpkg-pkg-update(1)} command
+ which itself is not much more than the build system \cb{update} operation
+ (see \l{b(1)} for details). As a result, the main utility of this command
+ is the ability to refer to build configurations by names and to project
+ packages implicitly via the current working directory.
+
+ If no project or package directory is specified, then the current working
+ directory is assumed. If no configuration is specified, then the default
+ configuration is assumed. See \l{bdep-projects-configs(1)} for details on
+ specifying projects and configurations. Optional \c{\i{cfg-var}...} are
+ the additional configuration variables to pass to the build system.
+ "
+ }
+
+ class cmd_update_options: project_options
+ {
+ "\h|UPDATE OPTIONS|"
+ };
+}
diff --git a/bdep/update.hxx b/bdep/update.hxx
new file mode 100644
index 0000000..38d6278
--- /dev/null
+++ b/bdep/update.hxx
@@ -0,0 +1,32 @@
+// file : bdep/update.hxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+#ifndef BDEP_UPDATE_HXX
+#define BDEP_UPDATE_HXX
+
+#include <bdep/types.hxx>
+#include <bdep/utility.hxx>
+
+#include <bdep/build.hxx>
+#include <bdep/update-options.hxx>
+
+namespace bdep
+{
+ inline void
+ cmd_update (const cmd_update_options& o,
+ const shared_ptr<configuration>& c,
+ const cstrings& pkgs,
+ const strings& cfg_vars)
+ {
+ run_bpkg (2, o, "update", "-d", c->path, cfg_vars, pkgs);
+ }
+
+ inline int
+ cmd_update (const cmd_update_options& o, cli::scanner& args)
+ {
+ return cmd_build (o, &cmd_update, args);
+ }
+}
+
+#endif // BDEP_UPDATE_HXX
diff --git a/doc/cli.sh b/doc/cli.sh
index e51aacf..e75346d 100755
--- a/doc/cli.sh
+++ b/doc/cli.sh
@@ -60,7 +60,7 @@ o="--suppress-undocumented --output-prefix bdep- --class-doc bdep::common_option
compile "common" $o --output-suffix "-options" --class-doc bdep::common_options=long
compile "bdep" $o --output-prefix "" --class-doc bdep::commands=short --class-doc bdep::topics=short
-pages="new help init sync fetch status config projects-configs"
+pages="new help init sync fetch status config test update clean projects-configs"
for p in $pages; do
compile $p $o