aboutsummaryrefslogtreecommitdiff
path: root/bdep/new.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-08-09 14:17:06 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-08-09 14:17:06 +0200
commit055e65a0f93ab873c8998cea900229f04beb0d98 (patch)
treed66f693053e29120039025d44e9d1d3c14496fed /bdep/new.cxx
parent1b6a665ead3af91c3ce9c0a8492300c6f86e6f2a (diff)
Generate smarter glue buildfile that reads packages.manifest
Diffstat (limited to 'bdep/new.cxx')
-rw-r--r--bdep/new.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/bdep/new.cxx b/bdep/new.cxx
index 359d266..915e042 100644
--- a/bdep/new.cxx
+++ b/bdep/new.cxx
@@ -3081,6 +3081,14 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
// Only create the glue buildfile if we've also created packages.manifest.
//
+ // Note that the first version of our glue buildfile pulled all the
+ // subdirectories with a wildcard (*/). This proved to have several
+ // drawbacks: adding a non-package subdirectory (e.g., upstream/) is
+ // error-prone since we need to remember to manually exclude it. Also,
+ // some users seem to prefer to create configurations as subdirectories of
+ // the project root. Forgetting to exclude them leads to all kinds of
+ // bizarre errors (see GitHub issue #159 for one example).
+ //
if (!e)
{
path f (prj / buildfile_file);
@@ -3092,7 +3100,8 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
fdopen_mode::exclusive));
os << "# Glue buildfile that \"pulls\" all the packages in the project." << '\n'
<< "#" << '\n'
- << "import pkgs = */" << '\n'
+ << "import pkgs = [dir_paths] $process.run_regex(\\" << '\n'
+ << " cat $src_root/packages.manifest, '\\s*location\\s*:\\s*(\\S+)\\s*', '\\1')" << '\n'
<< '\n'
<< "./: $pkgs" << '\n';
os.close ();