diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2024-09-09 20:19:59 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2024-09-09 20:37:39 +0300 |
commit | b702be9d90ea1e67b4f8de6944f822fd183e727b (patch) | |
tree | 6e30469ad6bf6adfff873bc31f76f2567d0a2676 | |
parent | df19364adef814237b8afd156d3bd1a33d16b318 (diff) |
Allow using package names in bdep-release
-rw-r--r-- | bdep/release.cli | 4 | ||||
-rw-r--r-- | bdep/release.cxx | 39 | ||||
-rw-r--r-- | tests/release.testscript | 88 |
3 files changed, 125 insertions, 6 deletions
diff --git a/bdep/release.cli b/bdep/release.cli index 4e69283..64d2d37 100644 --- a/bdep/release.cli +++ b/bdep/release.cli @@ -15,14 +15,14 @@ namespace bdep { "<options> <prj-spec> <prj-dir> - <pkg-spec> <pkg-dir>", + <pkg-spec> <pkg> <pkg-dir>", "\h|SYNOPSIS| \c{\b{bdep release} [<options>] [<prj-spec>]} \c{<prj-spec> = \b{--directory}|\b{-d} <prj-dir> | <pkg-spec>\n - <pkg-spec> = (\b{--directory}|\b{-d} <pkg-dir>)...} + <pkg-spec> = (<pkg> | (\b{--directory}|\b{-d} <pkg-dir>))...} \h|DESCRIPTION| diff --git a/bdep/release.cxx b/bdep/release.cxx index 80a97e1..1650062 100644 --- a/bdep/release.cxx +++ b/bdep/release.cxx @@ -480,8 +480,14 @@ namespace bdep } int - cmd_release (const cmd_release_options& o, cli::scanner&) + cmd_release (const cmd_release_options& o, cli::scanner& args) { + // Save the package names. + // + strings ns; + while (args.more ()) + ns.emplace_back (args.next ()); + // Detect options incompatibility going through the groups of mutually // exclusive options. Also make sure that options make sense for the // current mode (releasing, revising, etc.) by pre-setting an incompatible @@ -753,13 +759,38 @@ namespace bdep // package_locations pls; - if (o.directory_specified ()) + if (o.directory_specified () || !ns.empty ()) { project_packages pp ( find_project_packages (o.directory (), - false /* ignore_packages */, - true /* load_packages */)); + false /* ignore_packages */, + ns.empty () /* load_packages */)); prj.path = move (pp.project); + + if (!ns.empty ()) + pp.append (find_project_packages (prj.path, ns).first.packages); + + // Issue a warning if some project packages are not being released. + // + for (package_location& pl: load_packages (prj.path)) + { + if (find_if (pp.packages.begin (), pp.packages.end (), + [&pl] (const package_location& l) + { + return l.path == pl.path; + }) == pp.packages.end ()) + pls.push_back (move (pl)); + } + + if (!pls.empty ()) + { + diag_record dr (warn); + dr << "following project packages not being released:"; + + for (const package_location& pl: pls) + dr << ' ' << pl.name; + } + pls = move (pp.packages); } else diff --git a/tests/release.testscript b/tests/release.testscript index 2b86964..9f56256 100644 --- a/tests/release.testscript +++ b/tests/release.testscript @@ -1122,6 +1122,94 @@ new += --vcs git,branch=master 2>- test.options += -q + : pkg-spec + : + { + +$clone_repos + + test.arguments += --no-open --push --yes + + : dir + : + { + $clone_repos; + + test.arguments = $regex.apply($test.arguments, '^(-d|prj)$', ''); + + $* -d prj/libprj 2>>EOE; + warning: following project packages not being released: prj + EOE + + $clone2; + + cat prj2/libprj/manifest >>~%EOO%; + %.* + name: libprj + version: 0.1.0 + %.* + EOO + + cat prj2/prj/manifest >>~%EOO% + %.* + name: prj + version: 0.1.0-a.0.z + %.* + EOO + } + + : name + : + { + $clone_repos; + + $* libprj 2>>EOE; + warning: following project packages not being released: prj + EOE + + $clone2; + + cat prj2/libprj/manifest >>~%EOO%; + %.* + name: libprj + version: 0.1.0 + %.* + EOO + + cat prj2/prj/manifest >>~%EOO% + %.* + name: prj + version: 0.1.0-a.0.z + %.* + EOO + } + + : no-pkg-prj-spec + : + { + $clone_repos; + + test.arguments = $regex.apply($test.arguments, '^(-d|prj)$', ''); + + env -c prj/libprj -- $*; + + $clone2; + + cat prj2/libprj/manifest >>~%EOO%; + %.* + name: libprj + version: 0.1.0 + %.* + EOO + + cat prj2/prj/manifest >>~%EOO% + %.* + name: prj + version: 0.1.0 + %.* + EOO + } + } + : patch : { |