[build2] Potential improvement: "bdep new ... --package" should automatically configure?

Klaim - Joël Lamotte mjklaim at gmail.com
Thu May 31 18:38:42 UTC 2018


Hi!

I'm experimenting with the case where:
 - the developer want to have one repository with multiple projects, aka
packages in build2;
 - the developer discover the projects they need while developing, add them
progressively;

Scenario:
 1. I create an empty repository, ready to work with build2 ('bdep new -t
empty');
 2. I add package with a library (the initial project) ('bdep new ...
--package');
 3. I initialize a configuration (the library is added automatically);
 4. I build (or not), basically I work with the library;
 5. then I realize I need to add another project;
 6. I add another package but this time with an executable (but I think
it's not important);
 7. Assuming the new package is automatically added to the configurations
     currently managed for the whole repository, I start working (for
example, build/update);

What I observe does not match step 7.
Instead, no bdep operation will take the new executable created in step 6
except if I do the following:

    bdep deinit
    bdep init

Which makes the configuration now contain the new project (and it builds).
See below how I got through steps 1 to 6.

This goes against my intuition because if I created both projects/packages
without doing any init/config-add, both package would be taken
automatically into account.
This is also what happen with bdep init after the bdep deinit.
In my opinion, adding a project should not force reconfiguring (and
building) the whole repository.

It's also problematic because there is no way to state that I want that
non-configured project
(that exist in my repo, and bdep knows it) to be configured in all (or
some) configurations
that are already known for this repository.

Question: did I do something wrong? Or maybe I misunderstood something and
got
into weird territory? In particular, it was my understanding that the
--package flag was designed
for this kind of usage.

Suggestion:
Adding a package ("bdep new myproject -t exe --package") in a repository
with .bdep
should either:
 A. Print a warning clarifying that the project will not be automatically
configured,
       suggest a command to do it (ideally without having to impact the
other projects);
 B. Automatically configure the new package in the configurations currently
known by
      bdep for this repository.
 C. Like B but do it only for the default, then add a way to automatically
configure projects
      which were not added to a configuration.

Maybe I missed something but I remark that there are ways to add/remove
configurations
(bdep config operations) but not to add/remove packages/projects from known
configurations
from bdep. It's possible with bpkg but that defeats the help that bdep
provides in this case.
It will be particularly problematic when you have to manage more than one
configuration
(typically debug/release/debugrelease/withsomespecialoptimizations mixed
with several compilers).

Joël

-------------------------------------------------------------

Here is what I did to go until step 6 (with output, using v0.7.0):

    PS G:\perso\experiments\actorsim> bdep new myproject -t empty
    created new empty project myproject in
G:\perso\experiments\actorsim\myproject\
    PS G:\perso\experiments\actorsim> cd .\myproject\
    PS G:\perso\experiments\actorsim\myproject> tree .
    Folder PATH listing for volume DATA
    Volume serial number is 0A7B-5DBB
    G:\PERSO\EXPERIMENTS\ACTORSIM\MYPROJECT
    └───.bdep
    PS G:\perso\experiments\actorsim\myproject> bdep new thatlib -t lib
--package
    warning: library name does not start with 'lib'
      info: this package may not be acceptable to some repositories
    created new library package thatlib in
G:\perso\experiments\actorsim\myproject\thatlib\
    PS G:\perso\experiments\actorsim\myproject> tree .
    Folder PATH listing for volume DATA
    Volume serial number is 0A7B-5DBB
    G:\PERSO\EXPERIMENTS\ACTORSIM\MYPROJECT
    ├───.bdep
    └───thatlib
        ├───build
        ├───tests
        │   ├───basics
        │   └───build
        └───thatlib
    PS G:\perso\experiments\actorsim\myproject> ls


        Directory: G:\perso\experiments\actorsim\myproject


    Mode                LastWriteTime         Length Name
    ----                -------------         ------ ----
    d-----       2018-05-31     20:00                .bdep
    d-----       2018-05-31     20:00                thatlib
    -a----       2018-05-31     20:00             10 .gitignore
    -a----       2018-05-31     20:00             25 packages.manifest
    -a----       2018-05-31     20:00            209 repositories.manifest


    PS G:\perso\experiments\actorsim\myproject> bdep init -C ../build-msvc
cc config.cxx=cl
    initializing in project G:\perso\experiments\actorsim\myproject\
    created configuration G:\perso\experiments\actorsim\build-msvc\ 1
default,forwarded,auto-synchronized
    synchronizing:
      new thatlib/0.1.0-a.0.19700101000000
    PS G:\perso\experiments\actorsim\myproject> bdep new client -t exe
--package
    created new executable project client in
G:\perso\experiments\actorsim\myproject\client\

As said before, at this point operations like 'bdep update' will not build
'client'.
The only way I found was 'bdep deinit' followed by 'bdep init'.

Joël
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.build2.org/archives/users/attachments/20180531/1f3bf8d4/attachment-0001.html>


More information about the users mailing list