[build2] Packaging using submodules makes impossible to make imporing tests

Klaim - Joël Lamotte mjklaim at gmail.com
Sun Nov 11 18:28:43 UTC 2018


While I was working on this: https://queue.cppget.org/plf-colony
(which is submitted to cppget, yay), I stumbled upon on the following
issue:

If I do `bdep new mylib -t lib` I end up with
 - a subdirectory which is the actual library
 - a subdirectory which is a sub-project with tests

The test "basic" is setup to import the mylib library and it is setup
as a separate project.
This is good because it helps testing importing libraries.

Now if I want to make a package of a library already in github, I want
to use a submodule.
To do so, the simplest way is to put the submodule in the source directory:

thatlib/
thatlib/build/...
thatlib/thatlib/
thatlib/thatlib/buildfile
thatlib/thatlib/thatlib-github // the submodule

However so far I ende up adding tests in the same
thatlib/thatlib/buildfile because it was simpler.

Now if I want to set tests in a separate sub-project:

thatlib/thatlib/buildfile
thatlib/thatlib/thatlib-github // the submodule refered to by the buildfile
thatlib/tests/build/... // this marks it as a sub-project
thatlib/tests/test_suite/buildfile // the actual text exe is defined here

Then in thatlib/tests/test_suite/buildfile I will need to refer to
sources that exists only in thatlib/thatlib/thatlib-github. In this
situation thatlib/thatlib/thatlib-github is "out of source tree" from
the tests sub-project pov which leads to an error if I do somethnig
like

    exe{test_suite} : cxx{thatlib/thatlib/thatlib-github/tests/*}
thatlib%lib{thatlib}

Moving the submodule in the root directory makes the real sources out
of source tree for both library and test buildfiles.

Opinion: I have no idea how to fix this. Just needed to report, see if
someone can help with his? Otherwise that forces me to always declare
tests as part of the same buildfile over the submodule, which makes
impossible to have more than one buildfile referring to the content of
that submodule.

Joël



More information about the users mailing list