aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rw-r--r--bdep/new.cxx26
2 files changed, 28 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index c7da512..7d9cdd3 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,9 @@ Version 0.13.0
See the SOURCE LAYOUT section in bdep-new(1) for details and a large
number of layout examples.
+ * The bdep-new command in the --package mode now creates the glue buildfile
+ for the project.
+
* The bdep-new command now generates the .gitattributes file.
* The bdep-new --subdirectory mode option has been renamed to --source.
diff --git a/bdep/new.cxx b/bdep/new.cxx
index 8a180ec..8f025ff 100644
--- a/bdep/new.cxx
+++ b/bdep/new.cxx
@@ -2833,7 +2833,7 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
for (auto& rm: rms)
rm.cancel ();
- // packages.manifest
+ // packages.manifest and glue buildfile
//
if (pkg)
{
@@ -2852,6 +2852,30 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
{
fail << "unable to write to " << f << ": " << e;
}
+
+ // Only create the glue buildfile if we've also created packages.manifest.
+ //
+ if (!e)
+ {
+ path f (prj / buildfile_file);
+ if (!exists (f))
+ try
+ {
+ ofdstream os (f, (fdopen_mode::out |
+ fdopen_mode::create |
+ fdopen_mode::exclusive));
+ os << "# Glue buildfile that \"pulls\" all the packages in the project." << '\n'
+ << "#" << '\n'
+ << "import pkgs = */" << '\n'
+ << '\n'
+ << "./: $pkgs" << '\n';
+ os.close ();
+ }
+ catch (const io_error& e)
+ {
+ fail << "unable to write to " << f << ": " << e;
+ }
+ }
}
// Run post hooks.