[Qbs] How to reload a parent project after inserting a sub-project
Christian.Kandeler at qt.io
Mon Jul 8 12:08:41 CEST 2019
On Mon, 8 Jul 2019 21:22:13 +1200
Christian Gagneraud <chgans at gmail.com> wrote:
> On Mon, 8 Jul 2019 at 20:50, Christian Kandeler
> <Christian.Kandeler at qt.io> wrote:
> > On Mon, 8 Jul 2019 18:08:25 +1200
> > Christian Gagneraud <chgans at gmail.com> wrote:
> > > I'm back on https://codereview.qt-project.org/c/qbs/qbs/+/260217, i
> > > decided that I should get that done and tested before I move on
> > > QtCreator integration.
> > > Conceptually, it works, i added a test that check that a sub-project
> > > is correctly inserted, but for now, i need to re-setup the top project
> > > using SetupProjectJob (in tst_api.cpp).
> > I would not bother with any of that. Just update the files. Any halfway decent IDE will have a watch on the qbs files and re-resolve the project. I'm not ruling out that manually manipulating the build graph (as we do for file updates) is possible, but it seems quite ambitious.
> Yes indeed, it looked quite complicated to me. Sounds like a good plan
> to use QtC's watch system
Actually, a watch system isn't even needed at all, as the IDE knows that it's told qbs to update the files. So it can just manually schedule a re-parse. In fact, we actively switch off the watcher for such cases, to suppress the "do you want to reload" dialog.
> i guess the only thing I'm missing is
> saving the edited file on the QtC side, or maybe it's better to do
> that on Qbs side (but wouldn't be consistent with group/file
I'm pretty sure we do save the files on the qbs side there.
> I was thinking about adding a function to tst_api that would simulate
> a full project reload, this would allow me to verify that i can add
> and remove references to the toplevel project and check for error
> cases, maybe another simple test to make sure it works for nested
> Any objection with that approach?
I don't know what you mean by "simulating a full project reload". Lots of tst_api test cases do project reloads.
More information about the Qbs