aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-02-13 12:50:41 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-02-13 12:50:41 +0200
commitfdf5d0b35b2b9c19136437af97b687b34fc740ea (patch)
tree8ad783aa43b4c6f3461f471a74e208a8ebcd437d
parent8ab23ad062f53ed32107f19d7e855c07992eb517 (diff)
Move bdep-new binless sub-option from --lang|-l to --type|t
-rw-r--r--bdep/new.cli54
-rw-r--r--bdep/new.cxx13
-rw-r--r--tests/new.testscript4
3 files changed, 34 insertions, 37 deletions
diff --git a/bdep/new.cli b/bdep/new.cli
index 93d8aaf..dec854e 100644
--- a/bdep/new.cli
+++ b/bdep/new.cli
@@ -157,10 +157,6 @@ namespace bdep
A C++ project. Recognized language sub-options:|
- \li|\n\ \ \ \cb{binless}
-
- Create a header-only library.|
-
\li|\n\ \ \ \cb{cpp}
Use the \cb{.cpp}, \cb{.hpp}, \cb{.ipp}, \cb{.tpp}, and \cb{.mpp}
@@ -206,7 +202,7 @@ namespace bdep
source files:
\
- $ bdep new -l c++,binless,hxx=h,cxx=cpp -t lib libhello
+ $ bdep new -l c++,hxx=h,cxx=cpp -t lib,binless libhello
\
The project type can be specified with the \c{\b{--type}|\b{-t}} option.
@@ -252,6 +248,10 @@ namespace bdep
A project that builds a sample C or C++ library. Recognized library
project sub-options:|
+ \li|\n\ \ \ \cb{binless}
+
+ Create a header-only C++ library.|
+
\li|\n\ \ \ \cb{no-tests}
Don't add support for functional/integration testing.|
@@ -381,7 +381,27 @@ namespace bdep
"
}
- //--type options
+ // --lang options
+ //
+ class cmd_new_c_options
+ {
+ };
+
+ // The cpp flag is the "extension=?pp" alias and is mutually exclusive with
+ // extension=.
+ //
+ class cmd_new_cxx_options
+ {
+ bool cpp;
+ string extension;
+ string hxx;
+ string cxx;
+ string ixx;
+ string txx;
+ string mxx;
+ };
+
+ //--type options
//
class cmd_new_exe_options
{
@@ -396,6 +416,7 @@ namespace bdep
class cmd_new_lib_options
{
+ bool binless;
bool no-tests;
bool unit-tests;
bool no-install;
@@ -420,27 +441,6 @@ namespace bdep
bool no-readme;
};
- // --lang options
- //
- class cmd_new_c_options
- {
- };
-
- // The cpp flag is the "extension=?pp" alias and is mutually exclusive with
- // extension=.
- //
- class cmd_new_cxx_options
- {
- bool binless;
- bool cpp;
- string extension;
- string hxx;
- string cxx;
- string ixx;
- string txx;
- string mxx;
- };
-
// --vcs options
//
class cmd_new_git_options
diff --git a/bdep/new.cxx b/bdep/new.cxx
index 4c1146e..e4f3dd6 100644
--- a/bdep/new.cxx
+++ b/bdep/new.cxx
@@ -325,6 +325,9 @@ namespace bdep
}
case type::lib:
{
+ if (t.lib_opt.binless () && l != lang::cxx)
+ fail << "--type|-t,binless is only valid for C++ libraries";
+
readme = !t.lib_opt.no_readme () && !sub;
altn = t.lib_opt.alt_naming ();
itest = !t.lib_opt.no_tests () && !sub;
@@ -366,12 +369,6 @@ namespace bdep
break;
}
}
-
- // @@ TODO: move into the lib case once binless is a project type
- // suboption.
- //
- if (l == lang::cxx && l.cxx_opt.binless () && t != type::lib)
- fail << "'binless' is only valid for libraries";
}
// Standard/alternative build file/directory naming scheme.
@@ -1495,7 +1492,7 @@ namespace bdep
break;
}
case lang::cxx:
- if (l.cxx_opt.binless ())
+ if (t.lib_opt.binless ())
{
apih = s + he;
verh = ver ? "version" + he : string ();
@@ -1668,7 +1665,7 @@ namespace bdep
os.close ();
}
- bool binless (l == lang::cxx && l.cxx_opt.binless ());
+ bool binless (t.lib_opt.binless ());
// buildfile
//
diff --git a/tests/new.testscript b/tests/new.testscript
index 4fefe56..fd95a94 100644
--- a/tests/new.testscript
+++ b/tests/new.testscript
@@ -152,7 +152,7 @@ status += -d prj
: lib-binless
:
{
- $* -t lib -l c++,binless libfoo 2>>/"EOE" &libfoo/***;
+ $* -t lib,binless -l c++ libfoo 2>>/"EOE" &libfoo/***;
created new library project libfoo in $~/libfoo/
EOE
@@ -164,7 +164,7 @@ status += -d prj
: lib-binless-unit-tests
:
{
- $* -t lib,unit-tests -l c++,binless libfoo 2>>/"EOE" &libfoo/***;
+ $* -t lib,unit-tests,binless -l c++ libfoo 2>>/"EOE" &libfoo/***;
created new library project libfoo in $~/libfoo/
EOE