[Qbs] How to reload a parent project after inserting a sub-project

Christian Gagneraud chgans at gmail.com
Mon Jul 8 08:08:25 CEST 2019

Hi there,

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).

So far, i managed to find the parent ResolvedProject (the only data
structure where sub-projects is writable. The problem is that
subProjects are themselves ResolvedProject.

So given a parent ProjectData I can insert a sub-project into Qbs
code, now i need to create a ResolvedProject from this new sub-project
Qbs file, so that i can append it to the parent's ResolvedProject's
subProjects, and hopefully I will just have to call updateData.

Unfortunately ProjectResolver doesn't expose anything interesting,
tho, the private resolveTopLevelProject() sounds very interesting... a
bit too hackish maybe. It feels wrong to have to create a
ProjectUpdateContext and create a ResolvedProject out of that, all "by
hand", surely there's some code somewhere that can be re-used.

Any thoughts on how to get going from here? Any help or point out
would be greatly appreciated.


More information about the Qbs mailing list