From f3cac67d4467a5e01cef503f59026e08b84266d8 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 16 Jul 2020 06:14:39 +0200 Subject: Create glue buildfile in bdep-new --package mode --- bdep/new.cxx | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'bdep') 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. -- cgit v1.1