aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2023-11-02 22:38:27 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2023-11-09 16:07:15 +0300
commit69115d2d8a35dfb22b1858b9b956ced2048b78e3 (patch)
treec2f28d52198b537c50ce61d076877d8ea285ef57
parenta52f444c25a558947d8ecea1642e09c92867c280 (diff)
Add support for buildfile-in-prefix sub-option for lib and exe project types in bdep-new
-rw-r--r--bdep/config.cxx6
-rw-r--r--bdep/new.cli66
-rw-r--r--bdep/new.cxx407
-rw-r--r--bdep/project.cxx4
-rw-r--r--bdep/sync.cxx4
-rw-r--r--bdep/utility.cxx2
-rw-r--r--tests/new.testscript1358
7 files changed, 1613 insertions, 234 deletions
diff --git a/bdep/config.cxx b/bdep/config.cxx
index 3c54fa3..5797539 100644
--- a/bdep/config.cxx
+++ b/bdep/config.cxx
@@ -260,7 +260,7 @@ namespace bdep
// Make sure the configuration path is absolute and normalized. Also
// derive relative to project directory path if possible.
//
- normalize (path, "configuration");
+ normalize (path, "configuration directory");
verify_configuration_path (path, prj, pkgs);
@@ -587,7 +587,7 @@ namespace bdep
//
translate_path_name (prj, path, name);
- normalize (path, "configuration");
+ normalize (path, "configuration directory");
verify_configuration_path (path, prj, pkgs);
@@ -1022,7 +1022,7 @@ namespace bdep
if (!exists (path))
fail << "configuration directory " << path << " does not exist";
- normalize (path, "configuration");
+ normalize (path, "configuration directory");
}
catch (const invalid_path&)
{
diff --git a/bdep/new.cli b/bdep/new.cli
index 9e4b3e3..fa003c2 100644
--- a/bdep/new.cli
+++ b/bdep/new.cli
@@ -165,7 +165,7 @@ namespace bdep
libraries) as well as sources. This can be customized in a number of ways
using the \cb{prefix*} and \cb{split} project type sub-options (see below
for details). For example, to move the source subdirectory inside
- \c{src/}:
+ \cb{src/}:
\
$ bdep new -l c++ -t exe,prefix=src hello
@@ -328,6 +328,11 @@ namespace bdep
Omit the source subdirectory.|
+ \li|\n\ \ \ \cb{buildfile-in-prefix}
+
+ Create the \cb{buildfile} in the source prefix directory rather than
+ in its source subdirectory.|
+
\li|\n\ \ \ \c{\b{license=}\i{name}}|
\li|\ \ \ \cb{no-readme}|
@@ -403,6 +408,11 @@ namespace bdep
Shortcut for \cb{no-subdir-include,no-subdir-source}.|
+ \li|\n\ \ \ \cb{buildfile-in-prefix}
+
+ Create the \cb{buildfiles} in the header/source prefix directories
+ rather than in their source subdirectories.|
+
\li|\n\ \ \ \c{\b{license=}\i{name}}|
\li|\ \ \ \cb{no-readme}|
@@ -596,6 +606,7 @@ namespace bdep
dir_path prefix;
dir_path subdir;
bool no-subdir;
+ bool buildfile-in-prefix;
string license = "other: proprietary";
bool no-readme;
bool alt-naming;
@@ -624,6 +635,7 @@ namespace bdep
bool no-subdir-include;
bool no-subdir-source;
bool no-subdir;
+ bool buildfile-in-prefix;
string license = "other: proprietary";
bool no-readme;
bool alt-naming;
@@ -1136,6 +1148,58 @@ namespace bdep
└── hello.cxx
\
+ When packaging a third-party project for \cb{build2}, one of the common
+ approaches is to create a project with the split layout and the
+ \cb{buildfiles} in the source prefix directories rather than in the source
+ subdirectories:
+
+ \
+ # hello/libhello/{include,src}/hello/
+ # hello/libhello/{include,src}/buildfile
+
+ $ bdep new -l c -t empty hello
+
+ $ bdep new -d hello --package \
+ -l c \
+ -t lib, \
+ split,subdir=hello,no-version,no-symexport,buildfile-in-prefix \
+ libhello
+
+ $ tree hello/
+ hello/
+ └── libhello/
+ ├── include/
+ │   ├── buildfile
+ │   └── hello/
+ │   └── hello.h
+ └── src/
+ ├── buildfile
+ └── hello/
+ └── hello.c
+ \
+
+ After that the upstream project is added as a \cb{git} submodule to the
+ project root directory and the source subdirectories are replaced with the
+ symbolic links to the directories inside the upstream project directory:
+
+ \
+ $ tree hello/
+ hello/
+ ├── libhello/
+ │ ├── include/
+ │ │   ├── buildfile
+ │ │   └── hello/ -> ../../upstream/include/hello/
+ │ └── src/
+ │ ├── buildfile
+ │ └── hello/ -> ../../upstream/src/
+ └── upstream/
+ ├── include/
+ │   └── hello/
+ │   └── hello.h
+ └── src/
+ └── hello.c
+ \
+
\h|DEFAULT OPTIONS FILES|
See \l{bdep-default-options-files(1)} for an overview of the default
diff --git a/bdep/new.cxx b/bdep/new.cxx
index 80eef7a..4dff04f 100644
--- a/bdep/new.cxx
+++ b/bdep/new.cxx
@@ -854,16 +854,18 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
dir_path sub; // Source subdirectory relative to source prefix.
bool src (false); // Source subdirectory mode.
- dir_path out; // Project/package root output directory.
- dir_path out_inc; // Include output directory.
- dir_path out_src; // Source output directory.
+ dir_path out; // Project/package root output directory.
+ dir_path out_pfx_inc; // Include prefix output directory (out + prefix).
+ dir_path out_pfx_src; // Source prefix output directory (out + prefix).
+ dir_path out_inc; // Include output directory (out + prefix + subdir)
+ dir_path out_src; // Source output directory (out + prefix + subdir).
{
// In all the cases out_inc and our_src are derived the same way except
// for the --source mode if --output is specified.
//
auto set_out = [&sub,
- &out, &out_inc, &out_src,
+ &out, &out_pfx_inc, &out_pfx_src, &out_inc, &out_src,
&pfx_inc, &pfx_src,
subdir, sub_inc, sub_src]
(const string& n)
@@ -872,8 +874,19 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
sub_inc || sub_src ? dir_path (n) :
dir_path ());
- out_inc = out / pfx_inc / (sub_inc ? sub : dir_path ());
- out_src = out / pfx_src / (sub_src ? sub : dir_path ());
+ // Normalize the output directory paths for the sake of comparison.
+ //
+ out_pfx_inc = out / pfx_inc;
+ normalize (out_pfx_inc, "include prefix");
+
+ out_pfx_src = out / pfx_src;
+ normalize (out_pfx_src, "source prefix");
+
+ out_inc = out_pfx_inc / (sub_inc ? sub : dir_path ());
+ normalize (out_inc, "include subdirectory");
+
+ out_src = out_pfx_src / (sub_src ? sub : dir_path ());
+ normalize (out_inc, "source subdirectory");
};
// Figure the final output and tentative project directories.
@@ -881,12 +894,12 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
if (o.package ())
{
if (o.directory_specified ())
- prj = normalize (o.directory (), "project");
+ prj = normalize (o.directory (), "project directory");
else
prj = current_directory ();
out = o.output_dir_specified () ? o.output_dir () : prj / dir_path (n);
- normalize (out, "output");
+ normalize (out, "output directory");
set_out (b);
}
else if (o.source ())
@@ -899,7 +912,7 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
fail << "both --output-dir|-o and --type|-t,subdir specified";
if (o.directory_specified ())
- prj = normalize (o.directory (), "project");
+ prj = normalize (o.directory (), "project directory");
else
prj = current_directory ();
@@ -911,7 +924,7 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
// subdirectory until the project directory is finalized.
//
out_src = o.output_dir ();
- normalize (out_src, "output");
+ normalize (out_src, "output directory");
out_inc = out_src;
}
else
@@ -920,7 +933,7 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
else
{
out = o.output_dir_specified () ? o.output_dir () : dir_path (n);
- normalize (out, "output");
+ normalize (out, "output directory");
prj = out;
set_out (b);
}
@@ -1007,11 +1020,17 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
// Here we treat out as subdirectory unless instructed otherwise in
// which case we treat it as a prefix.
//
+ // Note: out == prj (is always the case for --source; see above for
+ // details).
+ //
dir_path s (out_src.leaf (prj));
if (sub_inc || sub_src)
sub = move (s);
else
pfx_inc = pfx_src = move (s);
+
+ out_pfx_inc = prj / pfx_inc;
+ out_pfx_src = prj / pfx_src;
}
src = true;
@@ -1034,18 +1053,73 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
//
assert ((!pkg && !src) || pkg.has_value () == !src);
+ // We should have failed earlier otherwise.
+ //
+ assert ((sub_inc || sub_src) == !sub.empty ());
+
+ bool no_source (binless && !utest);
+
+ // Note that to re-locate a buildfile due to --type|-t,buildfile-in-prefix,
+ // both the source prefix directory and the source subdirectory needs to be
+ // present. In the split layout this may not be the case for either of the
+ // header or source buildfile but not for both, in which case we fail.
+ //
+ bool bfile_in_pfx_inc (false);
+ bool bfile_in_pfx_src (false);
+ {
+ bool bfile_in_pfx (t == type::exe ? t.exe_opt.buildfile_in_prefix () :
+ t == type::lib ? t.lib_opt.buildfile_in_prefix () :
+ false);
+
+ if (bfile_in_pfx)
+ {
+ bfile_in_pfx_inc = !pfx_inc.empty () && sub_inc;
+ bfile_in_pfx_src = !pfx_src.empty () && sub_src;
+
+ if (!bfile_in_pfx_inc && !bfile_in_pfx_src)
+ fail << "--type|-t,buildfile-in-prefix requires both source prefix "
+ << "and source subdirectory";
+
+ // Note that we don't need to check for the executable type of the
+ // project here, since for such a project bfile_in_pfx_{inc,src} are
+ // both either true or false.
+ //
+ if (!bfile_in_pfx_inc)
+ info << "--type|-t,buildfile-in-prefix ignored for include prefix "
+ << "because either prefix or subdirectory is absent";
+
+ if (!bfile_in_pfx_src && !no_source)
+ info << "--type|-t,buildfile-in-prefix ignored for source prefix "
+ << "because either prefix or subdirectory is absent";
+
+ // Issue a warning if on POSIX the executable file name may potentially
+ // clash with the source subdirectory name.
+ //
+ if (t == type::exe)
+ {
+ assert (!sub.empty ()); // Would have already failed otherwise.
+
+ if (*sub.begin () == s)
+ warn << "source subdirectory " << sub << " may clash with "
+ << "executable file name on some platforms" <<
+ info << "consider specifying alternative subdirectory with "
+ << "--type|-t,subdir";
+ }
+ }
+ }
+
// Note that the header and source directories may differ due to different
// source prefixes (--type|-t,prefix-{include,source}) as well as different
- // source subdirectories (--type|-t,no-sub-source).
+ // source subdirectories (--type|-t,no-sub-source,no-sub-include).
//
- bool split (out_inc != out_src);
+ bool split_source (out_inc != out_src);
- // In the split mode allowing the header or source directories to be the
- // project/package root directory could end up with clashing of the root,
- // header, and/or source buildfiles in different combinations. For the sake
- // of simplicity let's not support it for now.
+ // In the source directory split mode allowing the header or source
+ // directories to be the project/package root directory could end up with
+ // clashing of the root, header, and/or source .gitignore files in different
+ // combinations. For the sake of simplicity let's not support it for now.
//
- if (split)
+ if (split_source)
{
if (out_inc == out)
fail << "split header directory is project/package root";
@@ -1054,12 +1128,63 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
fail << "split source directory is project/package root";
}
+ const dir_path& inc_bfile_dir (!bfile_in_pfx_inc ? out_inc : out_pfx_inc);
+ const dir_path& src_bfile_dir (!bfile_in_pfx_src ? out_src : out_pfx_src);
+
+ // Note that a library's buildfile can be split into the header and source
+ // buildfiles due to different source prefixes
+ // (--type|-t,prefix-{include,source}) as well as different source
+ // subdirectories (--type|-t,no-sub-source,no-sub-include). Also note that
+ // the source directories split and the buildfiles split are orthogonal.
+ // Specifically, there can be the source directory split without the
+ // buildfile split (due to buildfiles being merged as result of the
+ // buildfile-in-prefix sub-option) and the buildfile split without the
+ // source directory split (some degenerate cases; see new/no-cfg/split tests
+ // for details).
+ //
+ bool split_buildfile (inc_bfile_dir != src_bfile_dir);
+
+ // In the buildfile split mode allowing the header or source buildfile
+ // directories to be the project/package root directory could end up with
+ // clashing of the root, header, and/or source buildfiles in different
+ // combinations. For the sake of simplicity let's not support it for now.
+ //
+ if (split_buildfile)
+ {
+ if (inc_bfile_dir == out)
+ fail << "header buildfile directory is project/package root";
+
+ if (src_bfile_dir == out)
+ fail << "source buildfile directory is project/package root";
+ }
+
+ // Fail in the split layout if the header buildfile "hides" the source
+ // buildfile. Note that the source buildfile doesn't "hide" the header
+ // buildfile since it includes it directly, unless this is a binless
+ // library (with unit tests).
+ //
+ if (split_buildfile && !no_source)
+ {
+ if (src_bfile_dir.sub (inc_bfile_dir))
+ fail << "split layout where source buildfile directory is a "
+ << "subdirectory of header buildfile directory is not supported" <<
+ info << "header buildfile directory: " << inc_bfile_dir <<
+ info << "source buildfile directory: " << src_bfile_dir;
+
+ if (binless && inc_bfile_dir.sub (src_bfile_dir))
+ fail << "split layout where header buildfile directory is a "
+ << "subdirectory of source buildfile directory is not supported "
+ << "for binless library" <<
+ info << "source buildfile directory: " << src_bfile_dir <<
+ info << "header buildfile directory: " << inc_bfile_dir;
+ }
+
// Merging the source and root directory buildfiles is a bit hairy when the
// project has the functional/integration tests subproject. Thus, we require
// them to be explicitly disabled. Note however, that getting rid of this
// requirement is not too complicated and can be considered in the future.
//
- if (t == type::lib && itest && out_src == out)
+ if (t == type::lib && itest && src_bfile_dir == out)
fail << "functional/integration testing is not supported in this layout" <<
info << "specify --type|-t,no-tests explicitly";
@@ -2050,9 +2175,9 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
}
}
- // <src>/buildfile
+ // <[pfx_]src>/buildfile
//
- open (out_src / buildfile_file);
+ open (src_bfile_dir / buildfile_file);
os << "libs =" << '\n'
<< "#import libs += libhello%lib{hello}" << '\n'
<< '\n';
@@ -2072,18 +2197,26 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
//
const char* w (out_src == out ? "*" : "**");
+ string src_dir (!bfile_in_pfx_src ? "" : sub.posix_representation ());
+
if (!utest)
+ {
os << "exe{" << s << "}: " <<
tt (ha + ' ' + xa) << "{" << w << "} " <<
- "$libs" <<
- (itest ? " testscript" : "") << '\n';
+ "$libs";
+
+ if (itest)
+ os << ' ' << src_dir << "testscript";
+
+ os << '\n';
+ }
else
{
os << "./: exe{" << s << "}: libue{" << s << "}: " <<
tt (ha + ' ' + xa) << "{" << w << " -" << w << ".test...} $libs" << '\n';
if (itest)
- os << "exe{" << s << "}: testscript" << '\n';
+ os << "exe{" << s << "}: " << src_dir << "testscript" << '\n';
os << '\n'
<< "# Unit tests." << '\n'
@@ -2126,27 +2259,68 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
// <src>/.gitignore
//
- if (vc == vcs::git)
+ // Add the root .gitignore file content at the beginning of our
+ // .gitignore file, if required.
+ //
+ bool root (out_src == out);
+ bool exe_src (!bfile_in_pfx_src); // Add <stem>.
+ bool itest_src (itest && !bfile_in_pfx_src); // Add test-<stem>.
+
+ if (root || exe_src || utest || itest_src)
{
- open (out_src / ".gitignore");
+ if (vc == vcs::git)
+ {
+ open (out_src / ".gitignore");
- // Add the root .gitignore file content, if required.
- //
- if (out_src == out)
- write_root_gitignore (true /* newline */);
+ // Add the root .gitignore file content, if required.
+ //
+ if (root)
+ write_root_gitignore (exe_src || utest || itest_src /* newline */);
- os << s << '\n';
- if (utest)
- os << "*.test" << '\n';
- if (itest || utest)
- os << '\n'
- << "# Testscript output directory (can be symlink)." << '\n'
- << "#" << '\n';
- if (itest)
- os << "test-" << s << '\n';
- if (utest)
- os << "test-*.test" << '\n';
- os.close ();
+ if (exe_src)
+ os << s << '\n';
+
+ if (utest)
+ os << "*.test" << '\n';
+
+ if (itest_src || utest)
+ {
+ if (exe_src || utest)
+ os << '\n';
+
+ os << "# Testscript output directory (can be symlink)." << '\n'
+ << "#" << '\n';
+
+ if (itest_src)
+ os << "test-" << s << '\n';
+ if (utest)
+ os << "test-*.test" << '\n';
+ }
+
+ os.close ();
+ }
+ }
+
+ // <pfx_src>/.gitignore
+ //
+ // Note: should never need to be merged with root since we banned such
+ // layouts (buildfile will clash with root buildfile).
+ //
+ if (bfile_in_pfx_src)
+ {
+ if (vc == vcs::git)
+ {
+ open (out_pfx_src / ".gitignore");
+ os << s << '\n';
+
+ if (itest)
+ os << '\n'
+ << "# Testscript output directory (can be symlink)." << '\n'
+ << "#" << '\n'
+ << "test-" << s << '\n';
+
+ os.close ();
+ }
}
// <src>/testscript
@@ -2538,16 +2712,16 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
os.close ();
}
- // <inc>/buildfile
+ // <[pfx_]inc>/buildfile
//
- if (split)
+ if (split_buildfile)
{
// We shouldn't clash with the root buildfile: we should have failed
// earlier if that were the case.
//
- assert (out_inc != out);
+ assert (inc_bfile_dir != out);
- open (out_inc / buildfile_file);
+ open (inc_bfile_dir / buildfile_file);
// Use the recursive headers wildcard since the include directory
// cannot be the project/package root for a split layout (see
@@ -2555,6 +2729,8 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
//
const char* w ("**");
+ string inc_dir (!bfile_in_pfx_inc ? "" : sub.posix_representation ());
+
if (binless)
{
os << "intf_libs = # Interface dependencies." << '\n'
@@ -2562,7 +2738,8 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
<< '\n'
<< "lib{" << s << "}: " << tt (ha) << "{" << w;
if (ver)
- os << " -version} " << hg << "{version}";
+ os << " -" << inc_dir << "version} " << inc_dir << hg
+ << "{version}";
else
os << "}";
os << " $intf_libs" << '\n';
@@ -2571,7 +2748,8 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
{
os << "pub_hdrs = " << tt (ha) << "{" << w;
if (ver)
- os << " -version} " << hg << "{version}" << '\n';
+ os << " -" << inc_dir << "version} " << inc_dir << hg <<
+ "{version}" << '\n';
else
os << "}" << '\n';
os << '\n'
@@ -2580,11 +2758,14 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
if (ver)
os << '\n'
- << hg << "{version}: in{version} $src_root/manifest" << '\n';
+ << inc_dir << hg << "{version}: " << inc_dir << "in{version} " <<
+ "$src_root/manifest" << '\n';
if (!exph.empty ())
os << '\n'
- << hg << "{export}@./: " << mp << ".importable = false" << '\n';
+ << inc_dir << hg << "{export}@" <<
+ (!bfile_in_pfx_inc ? "./" : inc_dir) << ": " << mp <<
+ ".importable = false" << '\n';
if (binless)
{
@@ -2612,9 +2793,11 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
if (install)
{
- if (!ip.empty ())
+ const string& install_dir (!bfile_in_pfx_inc ? ip : empty_string);
+
+ if (!install_dir.empty ())
os << '\n'
- << "# Install into the " << ip << " subdirectory of, say, /usr/include/" << '\n'
+ << "# Install into the " << install_dir << " subdirectory of, say, /usr/include/" << '\n'
<< "# recreating subdirectories." << '\n'
<< "#" << '\n';
else
@@ -2624,7 +2807,7 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
os << tt (ha) << "{*}:" << '\n'
<< "{" << '\n'
- << " install = include/" << ip << '\n'
+ << " install = include/" << install_dir << '\n'
<< " install.subdirs = true" << '\n'
<< "}" << '\n';
}
@@ -2632,17 +2815,17 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
os.close ();
}
- // <src>/buildfile
+ // <[pfx_]src>/buildfile
//
// Note that there is no <src>/buildfile for a split binless library
// with the unit tests disabled, since there are no files in <src>/ in
// this case.
//
- if (!(binless && !utest && split))
+ if (!(split_buildfile && no_source))
{
- open (out_src / buildfile_file);
+ open (src_bfile_dir / buildfile_file);
- if (!(split && binless))
+ if (!(split_buildfile && binless))
{
os << "intf_libs = # Interface dependencies." << '\n';
@@ -2653,9 +2836,10 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
<< '\n';
}
- if (split)
+ if (split_buildfile)
{
- string rel (out_inc.relative (out_src).posix_representation ());
+ string rel (
+ inc_bfile_dir.relative (src_bfile_dir).posix_representation ());
os << "# Public headers." << '\n'
<< "#" << '\n'
@@ -2683,9 +2867,15 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
//
const char* w (out_src == out ? "*" : "**");
+ // Note that inc_dir is only used if there is no buildfile split.
+ // Also note that there can still be the source directory split, in
+ // which case it is not empty.
+ //
+ string inc_dir (!bfile_in_pfx_inc ? "" : sub.posix_representation ());
+
if (!utest)
{
- if (split)
+ if (split_buildfile)
{
assert (!binless); // Make sure pub_hdrs is assigned (see above).
@@ -2710,8 +2900,9 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
os << tt (binless ? ha : ha + ' ' + xa) << "{" << w;
- if (ver && !split)
- os << " -version} " << hg << "{version}";
+ if (ver && !split_buildfile)
+ os << " -" << inc_dir << "version} " << inc_dir << hg
+ << "{version}";
else
os << "}";
@@ -2724,7 +2915,7 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
{
if (!binless)
{
- if (split)
+ if (split_buildfile)
os << "./: lib{" << s << "}: libul{" << s << "}: $pub/{$pub_hdrs}" << '\n'
<< '\n'
<< "# Private headers and sources as well as dependencies." << '\n'
@@ -2735,19 +2926,20 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
os << "libul{" << s << "}: " << tt (ha + ' ' + xa) <<
"{" << w << " -" << w << ".test...";
- if (ver && !split)
- os << " -version} \\" << '\n'
- << " " << hg << "{version}";
+ if (ver && !split_buildfile)
+ os << " -" << inc_dir << "version} \\" << '\n'
+ << " " << inc_dir << hg << "{version}";
else
os << "}";
os << " $impl_libs $intf_libs" << '\n';
}
- else if (!split) // Binless.
+ else if (!split_buildfile) // Binless.
{
os << "./: lib{" << s << "}: "
<< tt (ha) << "{" << w << " -" << w << ".test...";
if (ver)
- os << " -version} " << hg << "{version} \\" << '\n'
+ os << " -" << inc_dir << "version} " << inc_dir << hg <<
+ "{version} \\" << '\n'
<< " ";
else
os << "}";
@@ -2786,10 +2978,11 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
<< " n = $name($t)..." << '\n'
<< '\n'
<< " ./: $d/exe{$n}: $t $d/" << tt (ha) << "{"
- << (split && binless ? w : "+$n") << "} $d/testscript{+$n}";
+ << (split_buildfile && binless ? w : "+$n")
+ << "} $d/testscript{+$n}";
if (binless)
- os << (split ? " $pub/" : " ") << "lib{" << s << "}" << '\n';
+ os << (split_buildfile ? " $pub/" : " ") << "lib{" << s << "}" << '\n';
else
os << '\n'
<< " $d/exe{$n}: libul{" << s << "}: bin.whole = false" << '\n';
@@ -2797,13 +2990,16 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
os << "}" << '\n';
}
- if (ver && !split)
+ if (ver && !split_buildfile)
os << '\n'
- << hg << "{version}: in{version} $src_root/manifest" << '\n';
+ << inc_dir << hg << "{version}: " << inc_dir << "in{version} " <<
+ "$src_root/manifest" << '\n';
- if (!exph.empty () && !split)
+ if (!exph.empty () && !split_buildfile)
os << '\n'
- << hg << "{export}@./: " << mp << ".importable = false" << '\n';
+ << inc_dir << hg << "{export}@" <<
+ (!bfile_in_pfx_inc ? "./" : inc_dir) << ": " << mp <<
+ ".importable = false" << '\n';
// Build.
//
@@ -2817,7 +3013,7 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
string opi;
string spi;
- if (split && !binless)
+ if (split_source && !binless)
{
opi = !pi.empty () ? "$out_pfx_inc" : "$out_root";
spi = !pi.empty () ? "$src_pfx_inc" : "$src_root";
@@ -2869,7 +3065,7 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
// Export.
//
- if (!(split && binless))
+ if (!(split_buildfile && binless))
{
os << '\n'
<< "# Export options." << '\n'
@@ -2907,11 +3103,13 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
//
if (install)
{
- if (!split)
+ if (!split_buildfile)
{
- if (!ip.empty ())
+ const string& install_dir (!bfile_in_pfx_inc ? ip : empty_string);
+
+ if (!install_dir.empty ())
os << '\n'
- << "# Install into the " << ip << " subdirectory of, say, /usr/include/" << '\n'
+ << "# Install into the " << install_dir << " subdirectory of, say, /usr/include/" << '\n'
<< "# recreating subdirectories." << '\n'
<< "#" << '\n';
else
@@ -2921,7 +3119,7 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
os << tt (ha) << "{*}:" << '\n'
<< "{" << '\n'
- << " install = include/" << ip << '\n'
+ << " install = include/" << install_dir << '\n'
<< " install.subdirs = true" << '\n'
<< "}" << '\n';
}
@@ -2942,7 +3140,11 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
//
bool root (out_src == out);
- if (ver || utest || root || auto_symexport)
+ // Add <stem>.def.
+ //
+ bool auto_symexport_src (auto_symexport && !bfile_in_pfx_src);
+
+ if (root || ver || auto_symexport_src || utest)
{
if (vc == vcs::git)
{
@@ -2952,12 +3154,12 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
//
if (root)
{
- assert (!split);
+ assert (!split_source);
open (out_src / ".gitignore");
write_root_gitignore ();
- if (!ver && !auto_symexport && !utest)
+ if (!ver && !auto_symexport_src && !utest)
os.close ();
}
@@ -2975,11 +3177,11 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
<< "#" << '\n'
<< verh << '\n';
- if ((!auto_symexport && !utest) || split)
+ if ((!auto_symexport_src && !utest) || split_source)
os.close ();
}
- if (auto_symexport)
+ if (auto_symexport_src)
{
if (!os.is_open ())
open (out_src / ".gitignore");
@@ -3012,6 +3214,22 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
}
}
+ // <pfx_src>/.gitignore
+ //
+ if (bfile_in_pfx_src && auto_symexport)
+ {
+ if (vc == vcs::git)
+ {
+ open (out_pfx_src / ".gitignore");
+
+ os << "# Generated DLL symbol-exporting file." << '\n'
+ << "#" << '\n'
+ << s << ".def" << '\n';
+
+ os.close ();
+ }
+ }
+
// <src>/<stem>.test.*
//
if (utest)
@@ -3068,11 +3286,11 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
// Note: for the binless library the library target is defined in
// the header directory buildfile.
//
- string sd ((binless
- ? pfx_inc / (sub_inc ? sub : empty_dir_path)
- : pfx_src / (sub_src ? sub : empty_dir_path)).
- posix_representation ());
-
+ string sd (
+ (binless
+ ? pfx_inc / (sub_inc && !bfile_in_pfx_inc ? sub : empty_dir_path)
+ : pfx_src / (sub_src && !bfile_in_pfx_src ? sub : empty_dir_path)).
+ posix_representation ());
open (bd / "export." + build_ext);
os << "$out_root/" << '\n'
@@ -3422,7 +3640,7 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
if (src)
{
bool pi (exists (out_inc));
- bool ps (split && exists (out_src));
+ bool ps (split_source && exists (out_src));
dr << "source subdirectory " << n << " in";
@@ -3499,14 +3717,15 @@ options_files (const char*, const cmd_new_options& o, const strings&)
auto output_parent_dir = [&o] ()
{
- return normalize (o.output_dir (), "output");
+ return normalize (o.output_dir (), "output directory");
};
if (o.package () || o.source ())
{
start =
- o.output_dir_specified () ? output_parent_dir () :
- o.directory_specified () ? normalize (o.directory (), "project") :
+ o.output_dir_specified () ? output_parent_dir () :
+ o.directory_specified () ? normalize (o.directory (),
+ "project directory") :
current_directory ();
// Get the actual project directory.
diff --git a/bdep/project.cxx b/bdep/project.cxx
index 864e677..9803405 100644
--- a/bdep/project.cxx
+++ b/bdep/project.cxx
@@ -90,7 +90,7 @@ namespace bdep
{
dir_path d (di->first);
- normalize (d, "configuration");
+ normalize (d, "configuration directory");
if (auto c = db.query_one<configuration> (query::path ==
d.string ()))
@@ -182,7 +182,7 @@ namespace bdep
dir_path prj;
optional<dir_path> pkg;
- dir_path d (normalize (start, "project"));
+ dir_path d (normalize (start, "project directory"));
for (; !d.empty (); d = d.directory ())
{
// Ignore errors when checking for file existence since we may be
diff --git a/bdep/sync.cxx b/bdep/sync.cxx
index 46eaf1a..eac8b8c 100644
--- a/bdep/sync.cxx
+++ b/bdep/sync.cxx
@@ -1449,7 +1449,7 @@ namespace bdep
// origin project (which we may not have).
//
for (dir_path d: po.config ())
- append (normalize (d, "configuration"));
+ append (normalize (d, "configuration directory"));
if (const char* o = (po.config_id_specified () ? "--config-id" :
po.config_name_specified () ? "--config-name|-n" :
@@ -2571,7 +2571,7 @@ namespace bdep
{
dir_path d (c.first);
- normalize (d, "configuration");
+ normalize (d, "configuration directory");
if (open && contains (*open, d))
continue;
diff --git a/bdep/utility.cxx b/bdep/utility.cxx
index 3d97090..5c9e2c2 100644
--- a/bdep/utility.cxx
+++ b/bdep/utility.cxx
@@ -118,7 +118,7 @@ namespace bdep
}
catch (const invalid_path& e)
{
- fail << "invalid " << what << " directory " << e.path;
+ fail << "invalid " << what << ' ' << e.path;
}
catch (const system_error& e)
{
diff --git a/tests/new.testscript b/tests/new.testscript
index d8c0b9c..82d41f5 100644
--- a/tests/new.testscript
+++ b/tests/new.testscript
@@ -14,6 +14,10 @@ config_cxx = [cmdline] config.cxx=$quote($recall($cxx.path) $cxx.config.mode, tr
status += -d prj
+b = [cmdline] $build
+t = [cmdline] $build test:
+i = [cmdline] $build install: config.install.root=./install &install/***
+
: no-cfg
:
{
@@ -31,9 +35,19 @@ status += -d prj
sed -n -e 's/^(type: .+)$/\1/p' prj-foo/manifest >:'';
sed -n -e 's/^language: (.+)$/\1/p' prj-foo/manifest >'c++';
- $build prj-foo/ $config_cxx 2>>~%EOE%
+ $b prj-foo/ $config_cxx 2>>~%EOE%;
%(c\+\+|ld) .+%{2}
EOE
+
+ $t prj-foo/ $config_cxx 2>>~%EOE%;
+ %test .+%
+ EOE
+
+ $i prj-foo/ $config_cxx 2>>/~%EOE%
+ %.*
+ install prj-foo/prj-foo/exe{prj-foo} -> install/bin/
+ %.*
+ EOE
}
: exe-lib-prefix
@@ -46,11 +60,19 @@ status += -d prj
sed -n -e 's/^type: (.+)$/\1/p' libprj-foo/manifest >'exe';
- $build libprj-foo/ $config_cxx 2>>~%EOE%
+ $b libprj-foo/ $config_cxx 2>>~%EOE%
%(c\+\+|ld) .+%{2}
EOE
}
+ : exe-buildfile-in-prefix
+ :
+ {
+ $* -t exe,buildfile-in-prefix -l c++ prj-foo 2>>EOE != 0
+ error: --type|-t,buildfile-in-prefix requires both source prefix and source subdirectory
+ EOE
+ }
+
: exe-c++-suffix
:
{
@@ -60,7 +82,7 @@ status += -d prj
sed -n -e 's/^(language: .+)$/\1/p' foo.c++/manifest >:'';
- $build foo.c++/ $config_cxx 2>>~%EOE%
+ $b foo.c++/ $config_cxx 2>>~%EOE%
%(c\+\+|ld) .+%{2}
EOE
}
@@ -84,7 +106,7 @@ status += -d prj
int bar;
EOI
- $build foo/ $config_cxx $config_c 2>>~%EOE%
+ $b foo/ $config_cxx $config_c 2>>~%EOE%
%(c\+\+|c|ld) .+%{3}
EOE
}
@@ -98,9 +120,19 @@ status += -d prj
sed -n -e 's/^(type: .+)$/\1/p' libprj-foo/manifest >:'';
- $build libprj-foo/ $config_cxx 2>>~%EOE%
+ $b libprj-foo/ $config_cxx 2>>~%EOE%;
%(version|c\+\+|ar|ld) .+%{7}
EOE
+
+ $t libprj-foo/ $config_cxx 2>>~%EOE%;
+ %test .+%
+ EOE
+
+ $i libprj-foo/ $config_cxx 2>>/~%EOE%
+ %.*
+ install libprj-foo/libprj-foo/hxx{prj-foo} -> install/include/libprj-foo/
+ %.*
+ EOE
}
: lib-no-lib-prefix
@@ -113,11 +145,19 @@ status += -d prj
sed -n -e 's/^type: (.+)$/\1/p' prj-foo/manifest >'lib';
- $build prj-foo/ $config_cxx 2>>~%EOE%
+ $b prj-foo/ $config_cxx 2>>~%EOE%
%(version|c\+\+|ar|ld) .+%{7}
EOE
}
+ : lib-buildfile-in-prefix
+ :
+ {
+ $* -t lib,buildfile-in-prefix -l c++ libprj-foo 2>>EOE != 0
+ error: --type|-t,buildfile-in-prefix requires both source prefix and source subdirectory
+ EOE
+ }
+
: lib-c++-c
:
{
@@ -139,7 +179,7 @@ status += -d prj
#include "fox.h"
EOI
- $build libfoo/ $config_cxx $config_c 2>>~%EOE%
+ $b libfoo/ $config_cxx $config_c 2>>~%EOE%
%(version|c\+\+|c|ld|ar) .+%{10}
EOE
}
@@ -161,11 +201,42 @@ status += -d prj
created new executable project prj-foo in $~/prj-foo/
EOE
- $build prj-foo/ $config_cxx 2>>~%EOE%
+ $b prj-foo/ $config_cxx 2>>~%EOE%
%(c\+\+|ld) .+%{2}
EOE
}
+ : exe-prefix-buildfile-in-prefix
+ :
+ {
+ $* -t exe,prefix=src,subdir=prj/foo,buildfile-in-prefix -l c++ prj-foo 2>>/"EOE" &prj-foo/***;
+ created new executable project prj-foo in $~/prj-foo/
+ EOE
+
+ $b prj-foo/ $config_cxx 2>>/~%EOE%;
+ c++ prj-foo/src/prj/foo/cxx{prj-foo} -> prj-foo/src/prj/foo/obje{prj-foo}
+ ld prj-foo/src/exe{prj-foo}
+ EOE
+
+ $t prj-foo/ $config_cxx 2>>~%EOE%;
+ %test .+%
+ EOE
+
+ $i prj-foo/ $config_cxx 2>>/~%EOE%
+ %.*
+ install prj-foo/src/exe{prj-foo} -> install/bin/
+ %.*
+ EOE
+ }
+
+ : exe-prefix-no-subdir-buildfile-in-prefix
+ :
+ {
+ $* -t exe,prefix=src,no-subdir,buildfile-in-prefix -l c++ prj-foo 2>>EOE != 0
+ error: --type|-t,buildfile-in-prefix requires both source prefix and source subdirectory
+ EOE
+ }
+
: lib-prefix
:
{
@@ -173,11 +244,55 @@ status += -d prj
created new library project libprj-foo in $~/libprj-foo/
EOE
- $build libprj-foo/ $config_cxx 2>>~%EOE%
+ $b libprj-foo/ $config_cxx 2>>~%EOE%
%(version|c\+\+|ar|ld) .+%{7}
EOE
}
+ : lib-prefix-buildfile-in-prefix
+ :
+ {
+ $* -t lib,prefix=src,buildfile-in-prefix -l c++ libprj-foo 2>>/"EOE" &libprj-foo/***;
+ created new library project libprj-foo in $~/libprj-foo/
+ EOE
+
+ $b libprj-foo/ $config_cxx 2>>/~%EOE%;
+ %.*
+ version libprj-foo/src/libprj-foo/in{version} -> libprj-foo/src/libprj-foo/hxx{version}
+ %.*
+ c++ libprj-foo/src/libprj-foo/cxx{prj-foo} -> libprj-foo/src/libprj-foo/objs{prj-foo}
+ %.*
+ ld libprj-foo/src/libs{prj-foo}
+ %.*
+ EOE
+
+ $t libprj-foo/ $config_cxx 2>>~%EOE%;
+ %test .+%
+ EOE
+
+ $i libprj-foo/ $config_cxx 2>>/~%EOE%
+ %.*
+ %(
+ install libprj-foo/src/libprj-foo/hxx{prj-foo} -> install/include/libprj-foo/
+ %.*
+ install libprj-foo/src/libprj-foo/hxx{version} -> install/include/libprj-foo/
+ %|
+ install libprj-foo/src/libprj-foo/hxx{version} -> install/include/libprj-foo/
+ %.*
+ install libprj-foo/src/libprj-foo/hxx{prj-foo} -> install/include/libprj-foo/
+ %)
+ %.*
+ EOE
+ }
+
+ : lib-prefix-no-subdir-buildfile-in-prefix
+ :
+ {
+ $* -t lib,prefix=src,no-subdir,buildfile-in-prefix,no-version -l c++ libprj-foo 2>>EOE != 0
+ error: --type|-t,buildfile-in-prefix requires both source prefix and source subdirectory
+ EOE
+ }
+
: lib-split
:
{
@@ -185,8 +300,68 @@ status += -d prj
created new library project libprj-foo in $~/libprj-foo/
EOE
- $build libprj-foo/ $config_cxx 2>>~%EOE%
- %(version|c\+\+|ar|ld) .+%{7}
+ $b libprj-foo/ $config_cxx 2>>/~%EOE%;
+ %.*
+ version libprj-foo/include/libprj-foo/in{version} -> libprj-foo/include/libprj-foo/hxx{version}
+ %.*
+ c++ libprj-foo/src/libprj-foo/cxx{prj-foo} -> libprj-foo/src/libprj-foo/objs{prj-foo}
+ %.*
+ ld libprj-foo/src/libprj-foo/libs{prj-foo}
+ %.*
+ EOE
+
+ $t libprj-foo/ $config_cxx 2>>~%EOE%;
+ %test .+%
+ EOE
+
+ $i libprj-foo/ $config_cxx 2>>/~%EOE%
+ %.*
+ %(
+ install libprj-foo/include/libprj-foo/hxx{prj-foo} -> install/include/libprj-foo/
+ %.*
+ install libprj-foo/include/libprj-foo/hxx{version} -> install/include/libprj-foo/
+ %|
+ install libprj-foo/include/libprj-foo/hxx{version} -> install/include/libprj-foo/
+ %.*
+ install libprj-foo/include/libprj-foo/hxx{prj-foo} -> install/include/libprj-foo/
+ %)
+ %.*
+ EOE
+ }
+
+ : lib-split-buildfile-in-prefix
+ :
+ {
+ $* -t lib,split,buildfile-in-prefix -l c++ libprj-foo 2>>/"EOE" &libprj-foo/***;
+ created new library project libprj-foo in $~/libprj-foo/
+ EOE
+
+ $b libprj-foo/ $config_cxx 2>>/~%EOE%;
+ %.*
+ version libprj-foo/include/libprj-foo/in{version} -> libprj-foo/include/libprj-foo/hxx{version}
+ %.*
+ c++ libprj-foo/src/libprj-foo/cxx{prj-foo} -> libprj-foo/src/libprj-foo/objs{prj-foo}
+ %.*
+ ld libprj-foo/src/libs{prj-foo}
+ %.*
+ EOE
+
+ $t libprj-foo/ $config_cxx 2>>~%EOE%;
+ %test .+%
+ EOE
+
+ $i libprj-foo/ $config_cxx 2>>/~%EOE%
+ %.*
+ %(
+ install libprj-foo/include/libprj-foo/hxx{prj-foo} -> install/include/libprj-foo/
+ %.*
+ install libprj-foo/include/libprj-foo/hxx{version} -> install/include/libprj-foo/
+ %|
+ install libprj-foo/include/libprj-foo/hxx{version} -> install/include/libprj-foo/
+ %.*
+ install libprj-foo/include/libprj-foo/hxx{prj-foo} -> install/include/libprj-foo/
+ %)
+ %.*
EOE
}
@@ -213,7 +388,7 @@ status += -d prj
#include "fox.h"
EOI
- $build libfoo/ $config_cxx $config_c 2>>~%EOE%
+ $b libfoo/ $config_cxx $config_c 2>>~%EOE%
%(version|c\+\+|c|ar|ld) .+%{10}
EOE
}
@@ -225,8 +400,60 @@ status += -d prj
created new library project libprj-foo in $~/libprj-foo/
EOE
- $build libprj-foo/ $config_cxx 2>>~%EOE%
- %(version|c\+\+|ld) .+%{3}
+ $b libprj-foo/ $config_cxx 2>>/~%EOE%;
+ version libprj-foo/include/libprj-foo/in{version} -> libprj-foo/include/libprj-foo/hxx{version}
+ c++ libprj-foo/tests/basics/cxx{driver} -> libprj-foo/tests/basics/obje{driver}
+ ld libprj-foo/tests/basics/exe{driver}
+ EOE
+
+ $t libprj-foo/ $config_cxx 2>>~%EOE%;
+ %test .+%
+ EOE
+
+ $i libprj-foo/ $config_cxx 2>>/~%EOE%
+ %.*
+ %(
+ install libprj-foo/include/libprj-foo/hxx{prj-foo} -> install/include/libprj-foo/
+ %.*
+ install libprj-foo/include/libprj-foo/hxx{version} -> install/include/libprj-foo/
+ %|
+ install libprj-foo/include/libprj-foo/hxx{version} -> install/include/libprj-foo/
+ %.*
+ install libprj-foo/include/libprj-foo/hxx{prj-foo} -> install/include/libprj-foo/
+ %)
+ %.*
+ EOE
+ }
+
+ : lib-split-binless-buildfile-in-prefix
+ :
+ {
+ $* -t lib,split,binless,buildfile-in-prefix -l c++ libprj-foo 2>>/"EOE" &libprj-foo/***;
+ created new library project libprj-foo in $~/libprj-foo/
+ EOE
+
+ $b libprj-foo/ $config_cxx 2>>/~%EOE%;
+ version libprj-foo/include/libprj-foo/in{version} -> libprj-foo/include/libprj-foo/hxx{version}
+ c++ libprj-foo/tests/basics/cxx{driver} -> libprj-foo/tests/basics/obje{driver}
+ ld libprj-foo/tests/basics/exe{driver}
+ EOE
+
+ $t libprj-foo/ $config_cxx 2>>~%EOE%;
+ %test .+%
+ EOE
+
+ $i libprj-foo/ $config_cxx 2>>/~%EOE%
+ %.*
+ %(
+ install libprj-foo/include/libprj-foo/hxx{prj-foo} -> install/include/libprj-foo/
+ %.*
+ install libprj-foo/include/libprj-foo/hxx{version} -> install/include/libprj-foo/
+ %|
+ install libprj-foo/include/libprj-foo/hxx{version} -> install/include/libprj-foo/
+ %.*
+ install libprj-foo/include/libprj-foo/hxx{prj-foo} -> install/include/libprj-foo/
+ %)
+ %.*
EOE
}
@@ -245,7 +472,7 @@ status += -d prj
#include "fox.h"
EOI
- $build libfoo/ $config_cxx $config_c 2>>~%EOE%
+ $b libfoo/ $config_cxx $config_c 2>>~%EOE%
%(version|c\+\+|c|ld) .+%{4}
EOE
}
@@ -257,8 +484,68 @@ status += -d prj
created new library project libprj-foo in $~/libprj-foo/
EOE
- $build libprj-foo/ $config_cxx 2>>~%EOE%
- %(version|c\+\+|ld) .+%{5}
+ $b libprj-foo/ $config_cxx 2>>/~%EOE%;
+ %.*
+ version libprj-foo/include/libprj-foo/in{version} -> libprj-foo/include/libprj-foo/hxx{version}
+ %.*
+ c++ libprj-foo/src/libprj-foo/cxx{prj-foo.test} -> libprj-foo/src/libprj-foo/obje{prj-foo.test}
+ %.*
+ ld libprj-foo/src/libprj-foo/exe{prj-foo.test}
+ %.*
+ EOE
+
+ $t libprj-foo/ $config_cxx 2>>~%EOE%;
+ %test .+%{2}
+ EOE
+
+ $i libprj-foo/ $config_cxx 2>>/~%EOE%
+ %.*
+ %(
+ install libprj-foo/include/libprj-foo/hxx{prj-foo} -> install/include/libprj-foo/
+ %.*
+ install libprj-foo/include/libprj-foo/hxx{version} -> install/include/libprj-foo/
+ %|
+ install libprj-foo/include/libprj-foo/hxx{version} -> install/include/libprj-foo/
+ %.*
+ install libprj-foo/include/libprj-foo/hxx{prj-foo} -> install/include/libprj-foo/
+ %)
+ %.*
+ EOE
+ }
+
+ : lib-split-binless-unit-tests-buildfile-in-prefix
+ :
+ {
+ $* -t lib,split,binless,unit-tests,buildfile-in-prefix -l c++ libprj-foo 2>>/"EOE" &libprj-foo/***;
+ created new library project libprj-foo in $~/libprj-foo/
+ EOE
+
+ $b libprj-foo/ $config_cxx 2>>/~%EOE%;
+ %.*
+ version libprj-foo/include/libprj-foo/in{version} -> libprj-foo/include/libprj-foo/hxx{version}
+ %.*
+ c++ libprj-foo/src/libprj-foo/cxx{prj-foo.test} -> libprj-foo/src/libprj-foo/obje{prj-foo.test}
+ %.*
+ ld libprj-foo/src/libprj-foo/exe{prj-foo.test}
+ %.*
+ EOE
+
+ $t libprj-foo/ $config_cxx 2>>~%EOE%;
+ %test .+%{2}
+ EOE
+
+ $i libprj-foo/ $config_cxx 2>>/~%EOE%
+ %.*
+ %(
+ install libprj-foo/include/libprj-foo/hxx{prj-foo} -> install/include/libprj-foo/
+ %.*
+ install libprj-foo/include/libprj-foo/hxx{version} -> install/include/libprj-foo/
+ %|
+ install libprj-foo/include/libprj-foo/hxx{version} -> install/include/libprj-foo/
+ %.*
+ install libprj-foo/include/libprj-foo/hxx{prj-foo} -> install/include/libprj-foo/
+ %)
+ %.*
EOE
}
@@ -269,7 +556,19 @@ status += -d prj
created new executable project foo in $~/foo/
EOE
- $build foo/ $config_cxx 2>>~%EOE%
+ $b foo/ $config_cxx 2>>~%EOE%
+ %(c\+\+|ld|ar) .+%{5}
+ EOE
+ }
+
+ : exe-unit-tests-buildfile-in-prefix
+ :
+ {
+ $* -t exe,prefix=src/bar,subdir=prj,unit-tests,buildfile-in-prefix -l c++ foo 2>>/"EOE" &foo/***;
+ created new executable project foo in $~/foo/
+ EOE
+
+ $b foo/ $config_cxx 2>>~%EOE%
%(c\+\+|ld|ar) .+%{5}
EOE
}
@@ -297,7 +596,7 @@ status += -d prj
}
EOI
- $build foo/ $config_cxx $config_c 2>>~%EOE%
+ $b foo/ $config_cxx $config_c 2>>~%EOE%
%(c\+\+|c|ld|ar) .+%{8}
EOE
}
@@ -309,7 +608,19 @@ status += -d prj
created new library project libfoo in $~/libfoo/
EOE
- $build libfoo/ $config_cxx 2>>~%EOE%
+ $b libfoo/ $config_cxx 2>>~%EOE%
+ %(version|c\+\+|ar|ld) .+%{11}
+ EOE
+ }
+
+ : lib-unit-tests-buildfile-in-prefix
+ :
+ {
+ $* -t lib,prefix=src,unit-tests,buildfile-in-prefix -l c++ libfoo 2>>/"EOE" &libfoo/***;
+ created new library project libfoo in $~/libfoo/
+ EOE
+
+ $b libfoo/ $config_cxx 2>>~%EOE%
%(version|c\+\+|ar|ld) .+%{11}
EOE
}
@@ -337,7 +648,7 @@ status += -d prj
}
EOI
- $build libfoo/ $config_cxx $config_c 2>>~%EOE%
+ $b libfoo/ $config_cxx $config_c 2>>~%EOE%
%(version|c\+\+|c|ar|ld) .+%{15}
EOE
}
@@ -349,7 +660,7 @@ status += -d prj
created new executable project foo in $~/foo/
EOE
- $build foo/ $config_cxx 2>>~%EOE%
+ $b foo/ $config_cxx 2>>~%EOE%
%(c\+\+|ld|ar) .+%{5}
EOE
}
@@ -361,7 +672,7 @@ status += -d prj
created new library project libfoo in $~/libfoo/
EOE
- $build libfoo/ $config_cxx 2>>~%EOE%
+ $b libfoo/ $config_cxx 2>>~%EOE%
%(version|c\+\+|ar|ld) .+%{11}
EOE
}
@@ -390,7 +701,7 @@ status += -d prj
%.*
EOE
- $build foo/ $config_cxx 2>>~%EOE%
+ $b foo/ $config_cxx 2>>~%EOE%
%(c\+\+|ld) .+%{2}
EOE
}
@@ -404,7 +715,7 @@ status += -d prj
test -f foo/README.md == 1;
- $build foo/ $config_cxx 2>>~%EOE%
+ $b foo/ $config_cxx 2>>~%EOE%
%(c\+\+|ld) .+%{2}
EOE
}
@@ -417,7 +728,19 @@ status += -d prj
created new library project libfoo in $~/libfoo/
EOE
- $build libfoo/ $config_cxx 2>>~%EOE%
+ $b libfoo/ $config_cxx 2>>~%EOE%
+ %(c\+\+|ar|ld) .+%{10}
+ EOE
+ }
+
+ : lib-no-version-buildfile-in-prefix
+ :
+ {
+ $* -t lib,prefix=src,unit-tests,no-version,buildfile-in-prefix -l c++ libfoo 2>>/"EOE" &libfoo/***;
+ created new library project libfoo in $~/libfoo/
+ EOE
+
+ $b libfoo/ $config_cxx 2>>~%EOE%
%(c\+\+|ar|ld) .+%{10}
EOE
}
@@ -429,8 +752,60 @@ status += -d prj
created new library project libfoo in $~/libfoo/
EOE
- $build libfoo/ $config_cxx 2>>~%EOE%
- %(version|c\+\+|ld) .+%{3}
+ $b libfoo/ $config_cxx 2>>/~%EOE%;
+ version libfoo/libfoo/in{version} -> libfoo/libfoo/hxx{version}
+ c++ libfoo/tests/basics/cxx{driver} -> libfoo/tests/basics/obje{driver}
+ ld libfoo/tests/basics/exe{driver}
+ EOE
+
+ $t libfoo/ $config_cxx 2>>~%EOE%;
+ %test .+%
+ EOE
+
+ $i libfoo/ $config_cxx 2>>/~%EOE%
+ %.*
+ %(
+ install libfoo/libfoo/hxx{foo} -> install/include/libfoo/
+ %.*
+ install libfoo/libfoo/hxx{version} -> install/include/libfoo/
+ %|
+ install libfoo/libfoo/hxx{version} -> install/include/libfoo/
+ %.*
+ install libfoo/libfoo/hxx{foo} -> install/include/libfoo/
+ %)
+ %.*
+ EOE
+ }
+
+ : lib-binless-buildfile-in-prefix
+ :
+ {
+ $* -t lib,prefix=src,binless,buildfile-in-prefix -l c++ libfoo 2>>/"EOE" &libfoo/***;
+ created new library project libfoo in $~/libfoo/
+ EOE
+
+ $b libfoo/ $config_cxx 2>>/~%EOE%;
+ version libfoo/src/libfoo/in{version} -> libfoo/src/libfoo/hxx{version}
+ c++ libfoo/tests/basics/cxx{driver} -> libfoo/tests/basics/obje{driver}
+ ld libfoo/tests/basics/exe{driver}
+ EOE
+
+ $t libfoo/ $config_cxx 2>>~%EOE%;
+ %test .+%
+ EOE
+
+ $i libfoo/ $config_cxx 2>>/~%EOE%
+ %.*
+ %(
+ install libfoo/src/libfoo/hxx{foo} -> install/include/libfoo/
+ %.*
+ install libfoo/src/libfoo/hxx{version} -> install/include/libfoo/
+ %|
+ install libfoo/src/libfoo/hxx{version} -> install/include/libfoo/
+ %.*
+ install libfoo/src/libfoo/hxx{foo} -> install/include/libfoo/
+ %)
+ %.*
EOE
}
@@ -441,8 +816,68 @@ status += -d prj
created new library project libfoo in $~/libfoo/
EOE
- $build libfoo/ $config_cxx 2>>~%EOE%
- %(version|c\+\+|ld) .+%{5}
+ $b libfoo/ $config_cxx 2>>/~%EOE%;
+ %.*
+ version libfoo/libfoo/in{version} -> libfoo/libfoo/hxx{version}
+ %.*
+ c++ libfoo/libfoo/cxx{foo.test} -> libfoo/libfoo/obje{foo.test}
+ %.*
+ ld libfoo/libfoo/exe{foo.test}
+ %.*
+ EOE
+
+ $t libfoo/ $config_cxx 2>>~%EOE%;
+ %test .+%{2}
+ EOE
+
+ $i libfoo/ $config_cxx 2>>/~%EOE%
+ %.*
+ %(
+ install libfoo/libfoo/hxx{foo} -> install/include/libfoo/
+ %.*
+ install libfoo/libfoo/hxx{version} -> install/include/libfoo/
+ %|
+ install libfoo/libfoo/hxx{version} -> install/include/libfoo/
+ %.*
+ install libfoo/libfoo/hxx{foo} -> install/include/libfoo/
+ %)
+ %.*
+ EOE
+ }
+
+ : lib-binless-unit-tests-buildfile-in-prefix
+ :
+ {
+ $* -t lib,prefix=src,unit-tests,binless -l c++ libfoo 2>>/"EOE" &libfoo/***;
+ created new library project libfoo in $~/libfoo/
+ EOE
+
+ $b libfoo/ $config_cxx 2>>/~%EOE%;
+ %.*
+ version libfoo/src/libfoo/in{version} -> libfoo/src/libfoo/hxx{version}
+ %.*
+ c++ libfoo/src/libfoo/cxx{foo.test} -> libfoo/src/libfoo/obje{foo.test}
+ %.*
+ ld libfoo/src/libfoo/exe{foo.test}
+ %.*
+ EOE
+
+ $t libfoo/ $config_cxx 2>>~%EOE%;
+ %test .+%{2}
+ EOE
+
+ $i libfoo/ $config_cxx 2>>/~%EOE%
+ %.*
+ %(
+ install libfoo/src/libfoo/hxx{foo} -> install/include/libfoo/
+ %.*
+ install libfoo/src/libfoo/hxx{version} -> install/include/libfoo/
+ %|
+ install libfoo/src/libfoo/hxx{version} -> install/include/libfoo/
+ %.*
+ install libfoo/src/libfoo/hxx{foo} -> install/include/libfoo/
+ %)
+ %.*
EOE
}
@@ -453,7 +888,19 @@ status += -d prj
created new library project libprj-foo in $~/libprj-foo/
EOE
- $build libprj-foo/ $config_cxx 2>>~%EOE%
+ $b libprj-foo/ $config_cxx 2>>~%EOE%
+ %(version|c\+\+|ar|ld) .+%{7}
+ EOE
+ }
+
+ : lib-alt-subdir-buildfile-in-prefix
+ :
+ {
+ $* -l c++ -t lib,prefix-include=include,prefix-source=src/foo/bar,subdir=libprj/foo libprj-foo 2>>/"EOE" &libprj-foo/***;
+ created new library project libprj-foo in $~/libprj-foo/
+ EOE
+
+ $b libprj-foo/ $config_cxx 2>>~%EOE%
%(version|c\+\+|ar|ld) .+%{7}
EOE
}
@@ -466,11 +913,11 @@ status += -d prj
EOE
if $posix
- $build libfoo/ $config_cxx 2>>~%EOE%
+ $b libfoo/ $config_cxx 2>>~%EOE%
%(version|c\+\+|ar|ld) .+%{7}
EOE
else
- $build 'clean:' libfoo/ 2>>~%EOE%
+ $b 'clean:' libfoo/ 2>>~%EOE%
%info: .+ is clean%
EOE
end
@@ -486,7 +933,7 @@ status += -d prj
created new library project libfoo in $~/libfoo/
EOE
- $build libfoo/ $config_cxx 2>>~%EOE%;
+ $b libfoo/ $config_cxx 2>>~%EOE%;
%(version|c\+\+|ar|ld|def) .+%{9,10}
EOE
@@ -495,6 +942,22 @@ status += -d prj
end
}
+ : basics-buildfile-in-prefix
+ :
+ {
+ $* -t lib,prefix=src,auto-symexport,buildfile-in-prefix -l c++ libfoo 2>>/"EOE" &libfoo/***;
+ created new library project libfoo in $~/libfoo/
+ EOE
+
+ $b libfoo/ $config_cxx 2>>~%EOE%;
+ %(version|c\+\+|ar|ld|def) .+%{9,10}
+ EOE
+
+ if ($cxx.target.system == 'win32-msvc')
+ test -f libfoo/src/foo.def
+ end
+ }
+
: unit-tests
:
{
@@ -502,9 +965,29 @@ status += -d prj
created new library project libfoo in $~/libfoo/
EOE
- $build libfoo/ $config_cxx 2>>~%EOE%
+ $b libfoo/ $config_cxx 2>>~%EOE%;
%(version|c\+\+|ar|ld|def) .+%{11,12}
EOE
+
+ if ($cxx.target.system == 'win32-msvc')
+ test -f libfoo/libfoo/foo.def
+ end
+ }
+
+ : unit-tests-buildfile-in-prefix
+ :
+ {
+ $* -t lib,prefix=src,auto-symexport,unit-tests,buildfile-in-prefix -l c++ libfoo 2>>/"EOE" &libfoo/***;
+ created new library project libfoo in $~/libfoo/
+ EOE
+
+ $b libfoo/ $config_cxx 2>>~%EOE%;
+ %(version|c\+\+|ar|ld|def) .+%{11,12}
+ EOE
+
+ if ($cxx.target.system == 'win32-msvc')
+ test -f libfoo/src/foo.def
+ end
}
: split
@@ -514,9 +997,29 @@ status += -d prj
created new library project libfoo in $~/libfoo/
EOE
- $build libfoo/ $config_cxx 2>>~%EOE%
+ $b libfoo/ $config_cxx 2>>~%EOE%;
%(version|c\+\+|ar|ld|def) .+%{9,10}
EOE
+
+ if ($cxx.target.system == 'win32-msvc')
+ test -f libfoo/src/libfoo/foo.def
+ end
+ }
+
+ : split-buildfile-in-prefix
+ :
+ {
+ $* -t lib,auto-symexport,split,buildfile-in-prefix -l c++ libfoo 2>>/"EOE" &libfoo/***;
+ created new library project libfoo in $~/libfoo/
+ EOE
+
+ $b libfoo/ $config_cxx 2>>~%EOE%;
+ %(version|c\+\+|ar|ld|def) .+%{9,10}
+ EOE
+
+ if ($cxx.target.system == 'win32-msvc')
+ test -f libfoo/src/foo.def
+ end
}
: unit-tests-split
@@ -526,9 +1029,300 @@ status += -d prj
created new library project libfoo in $~/libfoo/
EOE
- $build libfoo/ $config_cxx 2>>~%EOE%
+ $b libfoo/ $config_cxx 2>>~%EOE%;
+ %(version|c\+\+|ar|ld|def) .+%{11,12}
+ EOE
+
+ if ($cxx.target.system == 'win32-msvc')
+ test -f libfoo/src/libfoo/foo.def
+ end
+ }
+
+ : unit-tests-split-buildfile-in-prefix
+ :
+ {
+ $* -t lib,auto-symexport,unit-tests,split,buildfile-in-prefix -l c++ libfoo 2>>/"EOE" &libfoo/***;
+ created new library project libfoo in $~/libfoo/
+ EOE
+
+ $b libfoo/ $config_cxx 2>>~%EOE%;
%(version|c\+\+|ar|ld|def) .+%{11,12}
EOE
+
+ if ($cxx.target.system == 'win32-msvc')
+ test -f libfoo/src/foo.def
+ end
+ }
+ }
+
+ : split
+ {
+ : buildfile
+ :
+ {
+ : no-src-dir-split
+ :
+ {
+ $* -t lib,prefix-source=src,prefix-include=src/libhello,no-subdir-include,buildfile-in-prefix,no-version libhello 2>>/"EOE" &libhello/***;
+ info: --type|-t,buildfile-in-prefix ignored for include prefix because either prefix or subdirectory is absent
+ created new library project libhello in $~/libhello/
+ EOE
+
+ test -f libhello/src/buildfile;
+ test -f libhello/src/libhello/buildfile;
+
+ $b libhello/ $config_cxx 2>>/~%EOE%;
+ %.*
+ c++ libhello/src/libhello/cxx{hello} -> libhello/src/libhello/objs{hello}
+ %.*
+ ld libhello/src/libs{hello}
+ %.*
+ EOE
+
+ $t libhello/ $config_cxx 2>>~%EOE%;
+ %test .+%
+ EOE
+
+ $i libhello/ $config_cxx 2>>/~%EOE%
+ %.*
+ install libhello/src/libhello/hxx{hello} -> install/include/
+ %.*
+ EOE
+ }
+
+ : failure
+ {
+ : src-is-root
+ :
+ {
+ $* -t lib,prefix-include=include,prefix-source=.,no-subdir-include,buildfile-in-prefix,no-version libhello 2>>EOE != 0
+ info: --type|-t,buildfile-in-prefix ignored for include prefix because either prefix or subdirectory is absent
+ error: source buildfile directory is project/package root
+ EOE
+ }
+
+ : header-is-root
+ :
+ {
+ $* -t lib,prefix-source=src,prefix-include=.,no-subdir-source,buildfile-in-prefix libhello 2>>EOE != 0
+ info: --type|-t,buildfile-in-prefix ignored for source prefix because either prefix or subdirectory is absent
+ error: header buildfile directory is project/package root
+ EOE
+ }
+
+ : src-subdir-of-hdr
+ :
+ {
+ : binless
+ :
+ {
+ $* -t lib,prefix-include=src,prefix-source=src/foo,binless,unit-tests,no-subdir,no-version libhello 2>>/"EOE" != 0
+ error: split layout where source buildfile directory is a subdirectory of header buildfile directory is not supported
+ info: header buildfile directory: $~/libhello/src/
+ info: source buildfile directory: $~/libhello/src/foo/
+ EOE
+ }
+
+ : binfull
+ :
+ {
+ $* -t lib,prefix-include=src,prefix-source=src/foo,unit-tests,no-subdir,no-version libhello 2>>/"EOE" != 0
+ error: split layout where source buildfile directory is a subdirectory of header buildfile directory is not supported
+ info: header buildfile directory: $~/libhello/src/
+ info: source buildfile directory: $~/libhello/src/foo/
+ EOE
+ }
+ }
+
+ : hdr-subdir-of-src
+ :
+ {
+ : binless
+ :
+ {
+ $* -t lib,prefix-include=src/foo,prefix-source=src,binless,unit-tests,no-subdir,no-version libhello 2>>/"EOE" != 0
+ error: split layout where header buildfile directory is a subdirectory of source buildfile directory is not supported for binless library
+ info: source buildfile directory: $~/libhello/src/
+ info: header buildfile directory: $~/libhello/src/foo/
+ EOE
+ }
+ }
+ }
+ }
+
+ : source
+ {
+ : no-buildfile-split
+ :
+ {
+ : hdr-inside-src
+ :
+ {
+ : binless
+ :
+ {
+ $* -t lib,prefix=src,binless,no-subdir-source,unit-tests,buildfile-in-prefix libhello 2>>/"EOE" &libhello/***;
+ info: --type|-t,buildfile-in-prefix ignored for source prefix because either prefix or subdirectory is absent
+ created new library project libhello in $~/libhello/
+ EOE
+
+ test -f libhello/src/buildfile;
+ test -f libhello/src/libhello/buildfile == 1;
+
+ $b libhello/ $config_cxx 2>>/~%EOE%;
+ %.*
+ version libhello/src/libhello/in{version} -> libhello/src/libhello/hxx{version}
+ %.*
+ c++ libhello/src/cxx{hello.test} -> libhello/src/obje{hello.test}
+ %.*
+ ld libhello/src/exe{hello.test}
+ %.*
+ EOE
+
+ $t libhello/ $config_cxx 2>>~%EOE%;
+ %test .+%{2}
+ EOE
+
+ $i libhello/ $config_cxx 2>>/~%EOE%
+ %.*
+ %(
+ install libhello/src/libhello/hxx{hello} -> install/include/libhello/
+ %.*
+ install libhello/src/libhello/hxx{version} -> install/include/libhello/
+ %|
+ install libhello/src/libhello/hxx{version} -> install/include/libhello/
+ %.*
+ install libhello/src/libhello/hxx{hello} -> install/include/libhello/
+ %)
+ %.*
+ EOE
+ }
+
+ : binful
+ :
+ {
+ $* -t lib,prefix=src,no-subdir-source,unit-tests,buildfile-in-prefix libhello 2>>/"EOE" &libhello/***;
+ info: --type|-t,buildfile-in-prefix ignored for source prefix because either prefix or subdirectory is absent
+ created new library project libhello in $~/libhello/
+ EOE
+
+ test -f libhello/src/buildfile;
+ test -f libhello/src/libhello/buildfile == 1;
+
+ $b libhello/ $config_cxx 2>>/~%EOE%;
+ %.*
+ version libhello/src/libhello/in{version} -> libhello/src/libhello/hxx{version}
+ %.*
+ c++ libhello/src/cxx{hello} -> libhello/src/objs{hello}
+ %.*
+ ld libhello/src/libs{hello}
+ %.*
+ EOE
+
+ $t libhello/ $config_cxx 2>>~%EOE%;
+ %test .+%{2}
+ EOE
+
+ $i libhello/ $config_cxx 2>>/~%EOE%
+ %.*
+ %(
+ install libhello/src/libhello/hxx{hello} -> install/include/libhello/
+ %.*
+ install libhello/src/libhello/hxx{version} -> install/include/libhello/
+ %|
+ install libhello/src/libhello/hxx{version} -> install/include/libhello/
+ %.*
+ install libhello/src/libhello/hxx{hello} -> install/include/libhello/
+ %)
+ %.*
+ EOE
+ }
+ }
+
+ : src-inside-hdr
+ :
+ {
+ : binless
+ :
+ {
+ $* -t lib,prefix=src,binless,no-subdir-include,unit-tests,buildfile-in-prefix,no-version libhello 2>>/"EOE" &libhello/***;
+ info: --type|-t,buildfile-in-prefix ignored for include prefix because either prefix or subdirectory is absent
+ created new library project libhello in $~/libhello/
+ EOE
+
+ test -f libhello/src/buildfile;
+ test -f libhello/src/libhello/buildfile == 1;
+
+ $b libhello/ $config_cxx 2>>/~%EOE%;
+ %.*
+ c++ libhello/src/libhello/cxx{hello.test} -> libhello/src/libhello/obje{hello.test}
+ %.*
+ ld libhello/src/libhello/exe{hello.test}
+ %.*
+ EOE
+
+ $t libhello/ $config_cxx 2>>~%EOE%;
+ %test .+%{2}
+ EOE
+
+ $i libhello/ $config_cxx 2>>/~%EOE%
+ %.*
+ install libhello/src/hxx{hello} -> install/include/
+ %.*
+ EOE
+ }
+
+ : binful
+ :
+ {
+ $* -t lib,prefix=src,no-subdir-include,unit-tests,buildfile-in-prefix,no-version libhello 2>>/"EOE" &libhello/***;
+ info: --type|-t,buildfile-in-prefix ignored for include prefix because either prefix or subdirectory is absent
+ created new library project libhello in $~/libhello/
+ EOE
+
+ test -f libhello/src/buildfile;
+ test -f libhello/src/libhello/buildfile == 1;
+
+ $b libhello/ $config_cxx 2>>/~%EOE%;
+ %.*
+ c++ libhello/src/libhello/cxx{hello} -> libhello/src/libhello/objs{hello}
+ %.*
+ ld libhello/src/libs{hello}
+ %.*
+ EOE
+
+ $t libhello/ $config_cxx 2>>~%EOE%;
+ %test .+%{2}
+ EOE
+
+ $i libhello/ $config_cxx 2>>/~%EOE%
+ %.*
+ install libhello/src/hxx{hello} -> install/include/
+ %.*
+ EOE
+ }
+ }
+ }
+
+ : failure
+ :
+ {
+ : src-is-root
+ :
+ {
+ $* -t lib,prefix-include=include,prefix-source=.,no-subdir-source libhello 2>>EOE != 0
+ error: split source directory is project/package root
+ EOE
+ }
+
+ : header-is-root
+ :
+ {
+ $* -t lib,prefix-include=.,prefix-source=src,no-subdir-include,no-version libhello 2>>EOE != 0
+ error: split header directory is project/package root
+ EOE
+ }
+ }
}
}
@@ -543,7 +1337,7 @@ status += -d prj
sed -n -e 's/^language: (.+)$/\1/p' prj-foo/manifest >'c';
- $build prj-foo/ $config_c 2>>~%EOE%
+ $b prj-foo/ $config_c 2>>~%EOE%
%(c|ld) .+%{2}
EOE
}
@@ -557,7 +1351,7 @@ status += -d prj
sed -n -e 's/^(language: .+)$/\1/p' foo.c/manifest >:'';
- $build foo.c/ $config_c 2>>~%EOE%
+ $b foo.c/ $config_c 2>>~%EOE%
%(c|ld) .+%{2}
EOE
}
@@ -581,7 +1375,7 @@ status += -d prj
int bar;
EOI
- $build foo/ $config_c $config_cxx 2>>~%EOE%
+ $b foo/ $config_c $config_cxx 2>>~%EOE%
%(c|c\+\+|ld) .+%{3}
EOE
}
@@ -593,7 +1387,7 @@ status += -d prj
created new executable project prj-foo in $~/prj-foo/
EOE
- $build prj-foo/ $config_c 2>>~%EOE%
+ $b prj-foo/ $config_c 2>>~%EOE%
%(c|ld) .+%{2}
EOE
}
@@ -605,7 +1399,7 @@ status += -d prj
created new executable project foo in $~/foo/
EOE
- $build foo/ $config_c 2>>~%EOE%
+ $b foo/ $config_c 2>>~%EOE%
%(c|ld|ar) .+%{5}
EOE
}
@@ -632,7 +1426,7 @@ status += -d prj
}
EOI
- $build foo/ $config_c $config_cxx 2>>~%EOE%
+ $b foo/ $config_c $config_cxx 2>>~%EOE%
%(c|c\+\+|ld|ar) .+%{8}
EOE
}
@@ -644,7 +1438,7 @@ status += -d prj
created new library project libprj-foo in $~/libprj-foo/
EOE
- $build libprj-foo/ $config_c 2>>~%EOE%
+ $b libprj-foo/ $config_c 2>>~%EOE%
%(version|c|ar|ld) .+%{7}
EOE
}
@@ -672,7 +1466,7 @@ status += -d prj
#include "fox.hpp"
EOI
- $build libfoo/ $config_c $config_cxx 2>>~%EOE%
+ $b libfoo/ $config_c $config_cxx 2>>~%EOE%
%(version|c|c\+\+|ld|ar) .+%{10}
EOE
}
@@ -684,7 +1478,7 @@ status += -d prj
created new library project libprj-foo in $~/libprj-foo/
EOE
- $build libprj-foo/ $config_c 2>>~%EOE%
+ $b libprj-foo/ $config_c 2>>~%EOE%
%(version|c|ar|ld) .+%{3}
EOE
}
@@ -696,7 +1490,7 @@ status += -d prj
created new library project libprj-foo in $~/libprj-foo/
EOE
- $build libprj-foo/ $config_c 2>>~%EOE%
+ $b libprj-foo/ $config_c 2>>~%EOE%
%(version|c|ar|ld) .+%{7}
EOE
}
@@ -708,7 +1502,7 @@ status += -d prj
created new library project libprj-foo in $~/libprj-foo/
EOE
- $build libprj-foo/ $config_c 2>>~%EOE%
+ $b libprj-foo/ $config_c 2>>~%EOE%
%(version|c|ar|ld) .+%{7}
EOE
}
@@ -736,7 +1530,7 @@ status += -d prj
#include "fox.hxx"
EOI
- $build libfoo/ $config_c $config_cxx 2>>~%EOE%
+ $b libfoo/ $config_c $config_cxx 2>>~%EOE%
%(version|c|c\+\+|ar|ld) .+%{10}
EOE
}
@@ -748,7 +1542,7 @@ status += -d prj
created new library project libprj-foo in $~/libprj-foo/
EOE
- $build libprj-foo/ $config_c 2>>~%EOE%
+ $b libprj-foo/ $config_c 2>>~%EOE%
%(version|c|ld) .+%{3}
EOE
}
@@ -768,7 +1562,7 @@ status += -d prj
#include "fox.hxx"
EOI
- $build libfoo/ $config_c $config_cxx 2>>~%EOE%
+ $b libfoo/ $config_c $config_cxx 2>>~%EOE%
%(version|c|c\+\+|ld) .+%{4}
EOE
}
@@ -780,7 +1574,7 @@ status += -d prj
created new library project libfoo in $~/libfoo/
EOE
- $build libfoo/ $config_c 2>>~%EOE%
+ $b libfoo/ $config_c 2>>~%EOE%
%(version|c|ar|ld) .+%{5}
EOE
}
@@ -792,7 +1586,7 @@ status += -d prj
created new library project libfoo in $~/libfoo/
EOE
- $build libfoo/ $config_c 2>>~%EOE%
+ $b libfoo/ $config_c 2>>~%EOE%
%(version|c|ar|ld) .+%{11}
EOE
}
@@ -819,7 +1613,7 @@ status += -d prj
}
EOI
- $build libfoo/ $config_c $config_cxx 2>>~%EOE%
+ $b libfoo/ $config_c $config_cxx 2>>~%EOE%
%(version|c|c\+\+|ar|ld) .+%{15}
EOE
}
@@ -831,7 +1625,7 @@ status += -d prj
created new library project libfoo in $~/libfoo/
EOE
- $build libfoo/ $config_c 2>>~%EOE%
+ $b libfoo/ $config_c 2>>~%EOE%
%(version|c|ld) .+%{5}
EOE
}
@@ -844,11 +1638,11 @@ status += -d prj
EOE
if $posix
- $build libfoo/ $config_c 2>>~%EOE%
+ $b libfoo/ $config_c 2>>~%EOE%
%(version|c|ar|ld) .+%{7}
EOE
else
- $build 'clean:' libfoo/ 2>>~%EOE%
+ $b 'clean:' libfoo/ 2>>~%EOE%
%info: .+ is clean%
EOE
end
@@ -864,7 +1658,7 @@ status += -d prj
created new library project libfoo in $~/libfoo/
EOE
- $build libfoo/ $config_c 2>>~%EOE%;
+ $b libfoo/ $config_c 2>>~%EOE%;
%(version|c|ar|ld|def) .+%{9,10}
EOE
@@ -880,7 +1674,7 @@ status += -d prj
created new library project libfoo in $~/libfoo/
EOE
- $build libfoo/ $config_c 2>>~%EOE%
+ $b libfoo/ $config_c 2>>~%EOE%
%(version|c|ar|ld|def) .+%{11,12}
EOE
}
@@ -892,7 +1686,7 @@ status += -d prj
created new library project libfoo in $~/libfoo/
EOE
- $build libfoo/ $config_c 2>>~%EOE%
+ $b libfoo/ $config_c 2>>~%EOE%
%(version|c|ar|ld|def) .+%{9,10}
EOE
}
@@ -904,7 +1698,7 @@ status += -d prj
created new library project libfoo in $~/libfoo/
EOE
- $build libfoo/ $config_c 2>>~%EOE%
+ $b libfoo/ $config_c 2>>~%EOE%
%(version|c|ar|ld|def) .+%{11,12}
EOE
}
@@ -962,7 +1756,7 @@ status += -d prj
created new library package libprj in $~/prj/libprj/
EOE
- $build prj/libprj/ $config_cxx 2>>~%EOE%
+ $b prj/libprj/ $config_cxx 2>>~%EOE%
%(version|c\+\+|ar|ld) .+%{7}
EOE
}
@@ -980,7 +1774,7 @@ status += -d prj
created new library package libprj in $~/prj/libprj/
EOE
- $build prj/libprj/ $config_cxx 2>>~%EOE%
+ $b prj/libprj/ $config_cxx 2>>~%EOE%
%(version|c\+\+|ar|ld) .+%{7}
EOE
}
@@ -998,7 +1792,7 @@ status += -d prj
created new library package libprj in $~/prj/libprj/
EOE
- $build prj/libprj/ $config_cxx 2>>~%EOE%
+ $b prj/libprj/ $config_cxx 2>>~%EOE%
%(version|c\+\+|ar|ld) .+%{7}
EOE
}
@@ -1016,7 +1810,7 @@ status += -d prj
created new library package libprj in $~/prj/libprj/
EOE
- $build prj/libprj/ $config_cxx 2>>~%EOE%
+ $b prj/libprj/ $config_cxx 2>>~%EOE%
%(version|c\+\+|ld) .+%{3}
EOE
}
@@ -1034,7 +1828,7 @@ status += -d prj
created new library package libprj in $~/prj/libprj/
EOE
- $build prj/libprj/ $config_cxx 2>>~%EOE%
+ $b prj/libprj/ $config_cxx 2>>~%EOE%
%(version|c\+\+|ld) .+%{5}
EOE
}
@@ -1088,7 +1882,7 @@ status += -d prj
#
test -f prj/libprj/README.md == 1;
- $build prj/ $config_cxx 2>>~%EOE%
+ $b prj/ $config_cxx 2>>~%EOE%
%(c\+\+|ar|ld) .+%{6}
EOE
}
@@ -1106,7 +1900,7 @@ status += -d prj
created new library source subdirectory libprj in $~/prj/libs/src/libprj/
EOE
- $build prj/ $config_cxx 2>>~%EOE%
+ $b prj/ $config_cxx 2>>~%EOE%
%(c\+\+|ar|ld) .+%{6}
EOE
}
@@ -1126,7 +1920,7 @@ status += -d prj
$~/prj/src/libprj/
EOE
- $build prj/ $config_cxx 2>>~%EOE%
+ $b prj/ $config_cxx 2>>~%EOE%
%(c\+\+|ar|ld) .+%{6}
EOE
}
@@ -1144,7 +1938,7 @@ status += -d prj
created new library source subdirectory libprj in $~/prj/include/libprj/
EOE
- $build prj/ $config_cxx 2>>~%EOE%
+ $b prj/ $config_cxx 2>>~%EOE%
%(c\+\+|ld) .+%{2}
EOE
}
@@ -1164,7 +1958,7 @@ status += -d prj
$~/prj/src/libprj/
EOE
- $build prj/ $config_cxx 2>>~%EOE%
+ $b prj/ $config_cxx 2>>~%EOE%
%(c\+\+|ld) .+%{4}
EOE
}
@@ -1186,7 +1980,7 @@ status += -d prj
created new executable source subdirectory prj in $~/prj/prj/
EOE
- $build prj/ $config_cxx 2>>~%EOE%
+ $b prj/ $config_cxx 2>>~%EOE%
%(c\+\+|ar|ld) .+%{6}
EOE
}
@@ -1204,7 +1998,7 @@ status += -d prj
created new library source subdirectory prj in $~/prj/core/prj/
EOE
- $build prj/ $config_cxx 2>>~%EOE%
+ $b prj/ $config_cxx 2>>~%EOE%
%(c\+\+|ar|ld) .+%{8}
EOE
}
@@ -1223,7 +2017,7 @@ status += -d prj
test -f libprj/libprj/prj.cxx;
test -f libprj/libprj/prj.hxx;
- $build libprj/ $config_cxx 2>>~%EOE%
+ $b libprj/ $config_cxx 2>>~%EOE%
%(version|c\+\+|ar|ld) .+%{7}
EOE
}
@@ -1238,7 +2032,7 @@ status += -d prj
test -f libprj/libprj/prj.cpp;
test -f libprj/libprj/prj.hpp;
- $build libprj/ $config_cxx 2>>~%EOE%
+ $b libprj/ $config_cxx 2>>~%EOE%
%(version|c\+\+|ar|ld) .+%{7}
EOE
}
@@ -1253,7 +2047,7 @@ status += -d prj
test -f libprj/libprj/prj.c++;
test -f libprj/libprj/prj.h++;
- $build libprj/ $config_cxx 2>>~%EOE%
+ $b libprj/ $config_cxx 2>>~%EOE%
%(version|c\+\+|ar|ld) .+%{7}
EOE
}
@@ -1268,7 +2062,7 @@ status += -d prj
test -f libprj/libprj/prj.cc;
test -f libprj/libprj/prj.hh;
- $build libprj/ $config_cxx 2>>~%EOE%
+ $b libprj/ $config_cxx 2>>~%EOE%
%(version|c\+\+|ar|ld) .+%{7}
EOE
}
@@ -1283,7 +2077,7 @@ status += -d prj
test -f libprj/libprj/prj.c;
test -f libprj/libprj/prj.h;
- $build libprj/ $config_cxx 2>>~%EOE%
+ $b libprj/ $config_cxx 2>>~%EOE%
%(version|c\+\+|ar|ld) .+%{7}
EOE
}
@@ -1298,7 +2092,7 @@ status += -d prj
test -f libprj/libprj/prj.cxx;
test -f libprj/libprj/prj;
- $build libprj/ $config_cxx 2>>~%EOE%
+ $b libprj/ $config_cxx 2>>~%EOE%
%(version|c\+\+|ar|ld) .+%{7}
EOE
}
@@ -1324,7 +2118,7 @@ status += -d prj
%.+
EOO
- $build libprj/ $config_cxx 2>>~%EOE%
+ $b libprj/ $config_cxx 2>>~%EOE%
%(version|c\+\+|ar|ld) .+%{7}
EOE
}
@@ -1339,7 +2133,7 @@ status += -d prj
test -f libprj/libprj/prj.cpp;
test -f libprj/libprj/prj.hxx;
- $build libprj/ $config_cxx 2>>~%EOE%
+ $b libprj/ $config_cxx 2>>~%EOE%
%(version|c\+\+|ar|ld) .+%{7}
EOE
}
@@ -1353,7 +2147,7 @@ status += -d prj
test -f libprj/libprj/prj.cpp;
test -f libprj/libprj/prj.hpp;
- $build libprj/ $config_cxx 2>>~%EOE%
+ $b libprj/ $config_cxx 2>>~%EOE%
%(version|c\+\+|ar|ld) .+%{7}
EOE
}
@@ -1432,7 +2226,7 @@ status += -d prj
%.+
EOO
- $build prj/ $config_c 2>>~%EOE%
+ $b prj/ $config_c 2>>~%EOE%
%(c|ar|ld) .+%{5}
EOE
}
@@ -1447,7 +2241,7 @@ status += -d prj
test -f libprj/buildfile;
test -f libprj/libprj/version.h.in == 1;
- $build libprj/ $config_c 2>>~%EOE%
+ $b libprj/ $config_c 2>>~%EOE%
%(c|ar|ld) .+%{6}
EOE
}
@@ -1462,7 +2256,7 @@ status += -d prj
test -f libprj/build2file;
test -d libprj/libprj == 1;
- $build libprj/ $config_c 2>>~%EOE%
+ $b libprj/ $config_c 2>>~%EOE%
%info: .+ is up to date%
EOE
}
@@ -1491,7 +2285,7 @@ status += -d prj
test -f libprj/libprj/prj;
test -f libprj/libprj/prj.cpp;
- $build libprj/ $config_cxx 2>>~%EOE%
+ $b libprj/ $config_cxx 2>>~%EOE%
%(c\+\+|ar|ld) .+%{6}
EOE
}
@@ -1506,7 +2300,7 @@ status += -d prj
test -f libprj/libprj/prj.h;
test -f libprj/libprj/prj.c;
- $build libprj/ $config_c 2>>~%EOE%
+ $b libprj/ $config_c 2>>~%EOE%
%(c|ar|ld) .+%{6}
EOE
}
@@ -1564,7 +2358,7 @@ status += -d prj
CMakeCache.txt
EOO
- $build prj/libprj/ $config_cxx 2>>~%EOE%
+ $b prj/libprj/ $config_cxx 2>>~%EOE%
%(version|c\+\+|ar|ld) .+%{7}
EOE
}
@@ -1731,7 +2525,7 @@ status += -d prj
mkdir hello/tests;
touch hello/tests/hello.test.cxx;
- $build hello/ $config_cxx 2>>~%EOE%
+ $b hello/ $config_cxx 2>>~%EOE%
%(c\+\+|ld) .+%{2}
EOE
}
@@ -1746,7 +2540,7 @@ status += -d prj
mkdir hello/tests;
touch hello/tests/hello.test.cxx;
- $build hello/ $config_cxx 2>>~%EOE%
+ $b hello/ $config_cxx 2>>~%EOE%
%(c\+\+|ld|ar) .+%{5}
EOE
}
@@ -1765,7 +2559,7 @@ status += -d prj
mkdir libhello/tests;
touch libhello/tests/hello.test.cxx;
- $build libhello/ $config_cxx 2>>~%EOE%
+ $b libhello/ $config_cxx 2>>~%EOE%
%(c\+\+|ld|ar) .+%{4}
EOE
}
@@ -1783,7 +2577,7 @@ status += -d prj
mkdir libhello/tests;
touch libhello/tests/hello.test.cxx;
- $build libhello/ $config_cxx 2>>~%EOE%
+ $b libhello/ $config_cxx 2>>~%EOE%
%(c\+\+|ld|ar) .+%{8}
EOE
}
@@ -1798,7 +2592,7 @@ status += -d prj
mkdir libhello/tests;
touch libhello/tests/hello.test.cxx;
- $build libhello/ $config_cxx 2>>~%EOE%
+ $b libhello/ $config_cxx 2>>~%EOE%
%(c\+\+|ld) .+%{2}
EOE
}
@@ -1811,8 +2605,6 @@ status += -d prj
: Here we smoke test the common source code layouts listed in bdep-new(1).
:
{
- t = [cmdline] $build test:
-
: subdir
:
{
@@ -1820,13 +2612,33 @@ status += -d prj
created new library project libhello in $~/libhello/
EOE
- $build libhello/ $config_cxx 2>>~%EOE%;
- %(version|c\+\+|ld|ar) .+%{7}
+ $b libhello/ $config_cxx 2>>/~%EOE%;
+ %.*
+ version libhello/hello/in{version} -> libhello/hello/hxx{version}
+ %.*
+ c++ libhello/hello/cxx{hello} -> libhello/hello/objs{hello}
+ %.*
+ ld libhello/hello/libs{hello}
+ %.*
EOE
- $t libhello/ $config_cxx 2>>~%EOE%
+ $t libhello/ $config_cxx 2>>~%EOE%;
%test .+%
EOE
+
+ $i libhello/ $config_cxx 2>>/~%EOE%
+ %.*
+ %(
+ install libhello/hello/hxx{hello} -> install/include/hello/
+ %.*
+ install libhello/hello/hxx{version} -> install/include/hello/
+ %|
+ install libhello/hello/hxx{version} -> install/include/hello/
+ %.*
+ install libhello/hello/hxx{hello} -> install/include/hello/
+ %)
+ %.*
+ EOE
}
: combined-prefix
@@ -1836,7 +2648,7 @@ status += -d prj
created new executable project hello in $~/hello/
EOE
- $build hello/ $config_cxx 2>>~%EOE%;
+ $b hello/ $config_cxx 2>>~%EOE%;
%(c\+\+|ld) .+%{2}
EOE
@@ -1852,13 +2664,36 @@ status += -d prj
created new library project libhello in $~/libhello/
EOE
- $build libhello/ $config_cxx 2>>~%EOE%;
- %(version|c\+\+|ld|ar) .+%{7}
+ test -f libhello/include/libhello/buildfile;
+ test -f libhello/libhello/buildfile;
+
+ $b libhello/ $config_cxx 2>>/~%EOE%;
+ %.*
+ version libhello/include/libhello/in{version} -> libhello/include/libhello/hxx{version}
+ %.*
+ c++ libhello/libhello/cxx{hello} -> libhello/libhello/objs{hello}
+ %.*
+ ld libhello/libhello/libs{hello}
+ %.*
EOE
- $t libhello/ $config_cxx 2>>~%EOE%
+ $t libhello/ $config_cxx 2>>~%EOE%;
%test .+%
EOE
+
+ $i libhello/ $config_cxx 2>>/~%EOE%
+ %.*
+ %(
+ install libhello/include/libhello/hxx{hello} -> install/include/libhello/
+ %.*
+ install libhello/include/libhello/hxx{version} -> install/include/libhello/
+ %|
+ install libhello/include/libhello/hxx{version} -> install/include/libhello/
+ %.*
+ install libhello/include/libhello/hxx{hello} -> install/include/libhello/
+ %)
+ %.*
+ EOE
}
: split
@@ -1868,13 +2703,36 @@ status += -d prj
created new library project libhello in $~/libhello/
EOE
- $build libhello/ $config_cxx 2>>~%EOE%;
- %(version|c\+\+|ld|ar) .+%{7}
+ test -f libhello/include/libhello/buildfile;
+ test -f libhello/src/libhello/buildfile;
+
+ $b libhello/ $config_cxx 2>>/~%EOE%;
+ %.*
+ version libhello/include/libhello/in{version} -> libhello/include/libhello/hxx{version}
+ %.*
+ c++ libhello/src/libhello/cxx{hello} -> libhello/src/libhello/objs{hello}
+ %.*
+ ld libhello/src/libhello/libs{hello}
+ %.*
EOE
- $t libhello/ $config_cxx 2>>~%EOE%
+ $t libhello/ $config_cxx 2>>~%EOE%;
%test .+%
EOE
+
+ $i libhello/ $config_cxx 2>>/~%EOE%
+ %.*
+ %(
+ install libhello/include/libhello/hxx{hello} -> install/include/libhello/
+ %.*
+ install libhello/include/libhello/hxx{version} -> install/include/libhello/
+ %|
+ install libhello/include/libhello/hxx{version} -> install/include/libhello/
+ %.*
+ install libhello/include/libhello/hxx{hello} -> install/include/libhello/
+ %)
+ %.*
+ EOE
}
: prefix-no-subdir
@@ -1884,7 +2742,7 @@ status += -d prj
created new executable project hello in $~/hello/
EOE
- $build hello/ $config_cxx 2>>~%EOE%;
+ $b hello/ $config_cxx 2>>~%EOE%;
%(c\+\+|ld) .+%{2}
EOE
@@ -1900,13 +2758,26 @@ status += -d prj
created new library project libhello in $~/libhello/
EOE
- $build libhello/ $config_cxx 2>>~%EOE%;
- %(c\+\+|ld|ar) .+%{6}
+ test -f libhello/include/buildfile;
+ test -f libhello/src/buildfile;
+
+ $b libhello/ $config_cxx 2>>/~%EOE%;
+ %.*
+ c++ libhello/src/cxx{hello} -> libhello/src/objs{hello}
+ %.*
+ ld libhello/src/libs{hello}
+ %.*
EOE
- $t libhello/ $config_cxx 2>>~%EOE%
+ $t libhello/ $config_cxx 2>>~%EOE%;
%test .+%
EOE
+
+ $i libhello/ $config_cxx 2>>/~%EOE%
+ %.*
+ install libhello/include/hxx{hello} -> install/include/
+ %.*
+ EOE
}
: no-subdir
@@ -1916,8 +2787,25 @@ status += -d prj
created new library project libhello in $~/libhello/
EOE
- $build libhello/ $config_cxx 2>>~%EOE%
- %(c\+\+|ld|ar) .+%{4}
+ test -d libhello/libhello/ == 1;
+ test -f libhello/buildfile;
+
+ $b libhello/ $config_cxx 2>>/~%EOE%;
+ %.*
+ c++ libhello/cxx{hello} -> libhello/objs{hello}
+ %.*
+ ld libhello/libs{hello}
+ %.*
+ EOE
+
+ $t libhello/ $config_cxx 2>>EOE != 0;
+ <buildspec>: error: target libhello/ does not support operation test
+ EOE
+
+ $i libhello/ $config_cxx 2>>/~%EOE%
+ %.*
+ install libhello/hxx{hello} -> install/include/
+ %.*
EOE
}
@@ -1928,13 +2816,36 @@ status += -d prj
created new library project libhello in $~/libhello/
EOE
- $build libhello/ $config_cxx 2>>~%EOE%;
- %(version|c\+\+|ld|ar) .+%{7}
+ test -f libhello/include/hello/buildfile;
+ test -f libhello/src/buildfile;
+
+ $b libhello/ $config_cxx 2>>/~%EOE%;
+ %.*
+ version libhello/include/hello/in{version} -> libhello/include/hello/hxx{version}
+ %.*
+ c++ libhello/src/cxx{hello} -> libhello/src/objs{hello}
+ %.*
+ ld libhello/src/libs{hello}
+ %.*
EOE
- $t libhello/ $config_cxx 2>>~%EOE%
+ $t libhello/ $config_cxx 2>>~%EOE%;
%test .+%
EOE
+
+ $i libhello/ $config_cxx 2>>/~%EOE%
+ %.*
+ %(
+ install libhello/include/hello/hxx{hello} -> install/include/hello/
+ %.*
+ install libhello/include/hello/hxx{version} -> install/include/hello/
+ %|
+ install libhello/include/hello/hxx{version} -> install/include/hello/
+ %.*
+ install libhello/include/hello/hxx{hello} -> install/include/hello/
+ %)
+ %.*
+ EOE
}
: split-no-subdir-include
@@ -1944,13 +2855,26 @@ status += -d prj
created new library project libhello in $~/libhello/
EOE
- $build libhello/ $config_cxx 2>>~%EOE%;
- %(c\+\+|ld|ar) .+%{6}
+ test -f libhello/include/buildfile;
+ test -f libhello/src/hello/buildfile;
+
+ $b libhello/ $config_cxx 2>>/~%EOE%;
+ %.*
+ c++ libhello/src/hello/cxx{hello} -> libhello/src/hello/objs{hello}
+ %.*
+ ld libhello/src/hello/libs{hello}
+ %.*
EOE
- $t libhello/ $config_cxx 2>>~%EOE%
+ $t libhello/ $config_cxx 2>>~%EOE%;
%test .+%
EOE
+
+ $i libhello/ $config_cxx 2>>/~%EOE%
+ %.*
+ install libhello/include/hxx{hello} -> install/include/
+ %.*
+ EOE
}
: include-in-src
@@ -1962,13 +2886,36 @@ status += -d prj
created new library project libhello in $~/libhello/
EOE
- $build libhello/ $config_cxx 2>>~%EOE%;
- %(version|c\+\+|ld|ar) .+%{7}
+ test -f libhello/src/hello/buildfile;
+ test -f libhello/src/include/hello/buildfile;
+
+ $b libhello/ $config_cxx 2>>/~%EOE%;
+ %.*
+ version libhello/src/include/hello/in{version} -> libhello/src/include/hello/hxx{version}
+ %.*
+ c++ libhello/src/hello/cxx{hello} -> libhello/src/hello/objs{hello}
+ %.*
+ ld libhello/src/hello/libs{hello}
+ %.*
EOE
- $t libhello/ $config_cxx 2>>~%EOE%
+ $t libhello/ $config_cxx 2>>~%EOE%;
%test .+%
EOE
+
+ $i libhello/ $config_cxx 2>>/~%EOE%
+ %.*
+ %(
+ install libhello/src/include/hello/hxx{hello} -> install/include/hello/
+ %.*
+ install libhello/src/include/hello/hxx{version} -> install/include/hello/
+ %|
+ install libhello/src/include/hello/hxx{version} -> install/include/hello/
+ %.*
+ install libhello/src/include/hello/hxx{hello} -> install/include/hello/
+ %)
+ %.*
+ EOE
}
: include-in-src-no-subdir-source
@@ -1981,13 +2928,36 @@ subdir=hello,no-subdir-source \
created new library project libhello in $~/libhello/
EOE
- $build libhello/ $config_cxx 2>>~%EOE%;
- %(version|c\+\+|ld|ar) .+%{7}
+ test -f libhello/src/buildfile;
+ test -f libhello/src/include/hello/buildfile;
+
+ $b libhello/ $config_cxx 2>>/~%EOE%;
+ %.*
+ version libhello/src/include/hello/in{version} -> libhello/src/include/hello/hxx{version}
+ %.*
+ c++ libhello/src/cxx{hello} -> libhello/src/objs{hello}
+ %.*
+ ld libhello/src/libs{hello}
+ %.*
EOE
- $t libhello/ $config_cxx 2>>~%EOE%
+ $t libhello/ $config_cxx 2>>~%EOE%;
%test .+%
EOE
+
+ $i libhello/ $config_cxx 2>>/~%EOE%
+ %.*
+ %(
+ install libhello/src/include/hello/hxx{hello} -> install/include/hello/
+ %.*
+ install libhello/src/include/hello/hxx{version} -> install/include/hello/
+ %|
+ install libhello/src/include/hello/hxx{version} -> install/include/hello/
+ %.*
+ install libhello/src/include/hello/hxx{hello} -> install/include/hello/
+ %)
+ %.*
+ EOE
}
: boost
@@ -2000,13 +2970,36 @@ subdir=hello,no-subdir-source \
created new library project libhello in $~/libhello/
EOE
- $build libhello/ $config_cxx 2>>~%EOE%;
- %(version|c\+\+|ld|ar) .+%{7}
+ test -f libhello/libs/hello/src/buildfile;
+ test -f libhello/include/hello/buildfile;
+
+ $b libhello/ $config_cxx 2>>/~%EOE%;
+ %.*
+ version libhello/include/hello/in{version} -> libhello/include/hello/hxx{version}
+ %.*
+ c++ libhello/libs/hello/src/cxx{hello} -> libhello/libs/hello/src/objs{hello}
+ %.*
+ ld libhello/libs/hello/src/libs{hello}
+ %.*
EOE
- $t libhello/ $config_cxx 2>>~%EOE%
+ $t libhello/ $config_cxx 2>>~%EOE%;
%test .+%
EOE
+
+ $i libhello/ $config_cxx 2>>/~%EOE%
+ %.*
+ %(
+ install libhello/include/hello/hxx{hello} -> install/include/hello/
+ %.*
+ install libhello/include/hello/hxx{version} -> install/include/hello/
+ %|
+ install libhello/include/hello/hxx{version} -> install/include/hello/
+ %.*
+ install libhello/include/hello/hxx{hello} -> install/include/hello/
+ %)
+ %.*
+ EOE
}
: multiple-components
@@ -2027,6 +3020,9 @@ subdir=hello1,no-subdir-source \
$~/hello/libhello1/src/
EOE
+ test -f hello/libhello1/include/hello1/buildfile;
+ test -f hello/libhello1/src/buildfile;
+
$* -d hello --source \
-l c++ \
-t lib,\
@@ -2038,9 +3034,30 @@ subdir=hello2,no-subdir-source \
$~/hello/libhello2/src/
EOE
- $build hello/ $config_cxx 2>>~%EOE%
+ test -f hello/libhello2/include/hello2/buildfile;
+ test -f hello/libhello2/src/buildfile;
+
+ $b hello/ $config_cxx 2>>~%EOE%;
%(c\+\+|ld|ar) .+%{8}
EOE
+
+ $t hello/ $config_cxx 2>>/EOE;
+ info: dir{hello/} has nothing to test
+ EOE
+
+ $i hello/ $config_cxx 2>>/~%EOE%
+ %.*
+ %(
+ install hello/libhello1/include/hello1/hxx{hello1} -> install/include/hello1/
+ %.*
+ install hello/libhello2/include/hello2/hxx{hello2} -> install/include/hello2/
+ %|
+ install hello/libhello2/include/hello2/hxx{hello2} -> install/include/hello2/
+ %.*
+ install hello/libhello1/include/hello1/hxx{hello1} -> install/include/hello1/
+ %)
+ %.*
+ EOE
}
: multiple-components-diff-prefixes
@@ -2061,17 +3078,96 @@ subdir=hello,no-subdir-source \
$~/hello/libs/libhello/src/
EOE
+ test -f hello/libs/libhello/include/hello/buildfile;
+ test -f hello/libs/libhello/src/buildfile;
+
$* -d hello --source -l c++ -t exe,prefix=src hello 2>>/"EOE";
created new executable source subdirectory hello in $~/hello/src/hello/
EOE
- $build hello/ $config_cxx 2>>~%EOE%;
+ test -f hello/src/hello/buildfile;
+
+ $b hello/ $config_cxx 2>>~%EOE%;
%(c\+\+|ld|ar) .+%{6}
EOE
- $t hello/ $config_cxx 2>>~%EOE%
+ $t hello/ $config_cxx 2>>~%EOE%;
%test .+%
EOE
+
+ $i hello/ $config_cxx 2>>/~%EOE%
+ %.*
+ %(
+ install hello/libs/libhello/include/hello/hxx{hello} -> install/include/hello/
+ %.*
+ install hello/src/hello/exe{hello} -> install/bin/
+ %|
+ install hello/src/hello/exe{hello} -> install/bin/
+ %.*
+ install hello/libs/libhello/include/hello/hxx{hello} -> install/include/hello/
+ %)
+ %.*
+ EOE
+ }
+
+ : packaging-third-party
+ :
+ {
+ $* -l c -t empty hello 2>>/"EOE" &hello/***;
+ created new empty project hello in $~/hello/
+ EOE
+
+ $* -d hello --package \
+ -l c \
+ -t lib,split,subdir=hello,no-version,no-symexport,buildfile-in-prefix \
+ libhello 2>>/"EOE";
+ created new library package libhello in $~/hello/libhello/
+ EOE
+
+ test -f hello/libhello/include/buildfile;
+ test -f hello/libhello/include/buildfile;
+
+ cat <<EOI >=hello/libhello/src/hello.def;
+ EXPORTS
+ say_hello
+ EOI
+
+ cat <<EOI >+hello/libhello/src/buildfile;
+
+ libs{hello}: def{hello}: include = ($c.target.class == 'windows')
+ EOI
+
+ $* -d hello --package \
+ -l c \
+ -t exe,prefix=src,subdir=hello-app,buildfile-in-prefix \
+ hello 2>>/"EOE";
+ created new executable package hello in $~/hello/hello/
+ EOE
+
+ test -f hello/hello/src/buildfile;
+
+ $b hello/libhello/ $config_c 2>>/~%EOE%;
+ %.*
+ c hello/libhello/src/hello/c{hello} -> hello/libhello/src/hello/objs{hello}
+ %.*
+ ld hello/libhello/src/libs{hello}
+ %.*
+ EOE
+
+ $b hello/hello/ $config_c 2>>/~%EOE%;
+ c hello/hello/src/hello-app/c{hello} -> hello/hello/src/hello-app/obje{hello}
+ ld hello/hello/src/exe{hello}
+ EOE
+
+ $t hello/libhello/ hello/hello/ $config_c 2>>~%EOE%;
+ %test .+%{2}
+ EOE
+
+ $i hello/libhello/ $config_c 2>>/~%EOE%
+ %.*
+ install hello/libhello/include/hello/h{hello} -> install/include/hello/
+ %.*
+ EOE
}
}
}
@@ -2090,7 +3186,7 @@ subdir=hello,no-subdir-source \
$status >'prj configured 0.1.0-a.0.19700101000000';
- $build prj/ 2>>~%EOE%
+ $b prj/ 2>>~%EOE%
%(mkdir|c\+\+|ld|ln) .+%{4}
EOE
}
@@ -2112,7 +3208,7 @@ subdir=hello,no-subdir-source \
$status >'prj configured 0.1.0-a.0.19700101000000';
- $build prj/ 2>>~%EOE%
+ $b prj/ 2>>~%EOE%
%(mkdir|c\+\+|ld|ln) .+%{4}
EOE
}