diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2021-08-09 14:17:06 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2021-08-09 14:17:06 +0200 |
commit | 055e65a0f93ab873c8998cea900229f04beb0d98 (patch) | |
tree | d66f693053e29120039025d44e9d1d3c14496fed | |
parent | 1b6a665ead3af91c3ce9c0a8492300c6f86e6f2a (diff) |
Generate smarter glue buildfile that reads packages.manifest
-rw-r--r-- | bdep/config.cxx | 18 | ||||
-rw-r--r-- | bdep/new.cxx | 11 |
2 files changed, 14 insertions, 15 deletions
diff --git a/bdep/config.cxx b/bdep/config.cxx index af84c59..d62ad3e 100644 --- a/bdep/config.cxx +++ b/bdep/config.cxx @@ -120,8 +120,10 @@ namespace bdep name = move (s); } - // Verify the configuration directory is not inside one of the packages or - // the project itself if it has a glue buildfile. + // Verify the configuration directory is not inside one of the packages. + // + // Note that the new version of our glue buildfile is smart enough to allow + // creation of configurations inside the project root. // static void verify_configuration_path (const dir_path& cfg, @@ -136,18 +138,6 @@ namespace bdep fail << "configuration directory " << cfg << " is inside package " << p.name << " (" << d << ")"; } - - if (cfg.sub (prj)) - { - path bf; - if (exists (bf = prj / "buildfile") || exists (bf = prj / "build2file")) - { - fail << "configuration directory " << cfg << " is inside project " - << "directory " << prj << - info << "remove glue " << bf << " if you would like to keep " - << "configurations inside your project"; - } - } } shared_ptr<configuration> 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 (); |