[Qbs] Probes caching in Qt Creator

resurrection at centrum.cz resurrection at centrum.cz
Sat Jul 22 16:48:05 CEST 2017

tl;dr Qbs Probes that write project files are not correctly evaluated (at least not in Qt Creator)
I do not know whether this is an issue of Qbs or Qt Creator but I will describe it, provide the minimal source and you could probably tell me. :-)
So I continue in my efforts of automatically writing Qbs project files in a Probe. I imagine it could be done in any variable - even the project.references - but its proper place is definitely in a Probe. When I do this and Qbs runs over it the files are generated and everything seems orderly except the projects do not come up in Qt Creator (they are correctly written though).
Reparsing the file does not work (and the Probe is not re-run). I presume as per documentation that the results are cached and that is why the Probe is not re-run. Except they do not get into the project.references variable because that one is empty when printing it to the console. Forcing re-run of probes on the Project page in Qt Creator seemingly does not work either BUT it is a required step in the workaround I discovered. Because as soon as I do a trivial change to the Qbs file after I force probes re-run and save the file again (e.g. add and remove a space or blank line) Qt Creator indeed reparses it correctly showing the projects. However once a change is done the the Probe code, everything disappears again and one has to force probes re-run and do a change to the file to force it to actully reparse (Reparse Qbs does not help). Some furhter observations:
- Reparse Qbs work fine for wild cards as new files do show up fine but it does not for programatically written project files - at least not when writing them in a Probe.
- When printing project.references variable it never shows correct content. It always prints out empty but the projects still show up and the variable it is being assigned from (the one in probes) does have the correct content always.
I am not sure what is going on or what could be done about it. Or if it is a bug in Qt Creator, Qbs or just unsupported way of using either or both of them. Attached is the example that you can try out yourself. It does this on Windows, haven't tried on Linux but I can if need be.
Michael Vlach
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qbs-probes.7z
Type: application/octet-stream
Size: 731 bytes
Desc: qbs-probes.7z
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20170722/96227e81/attachment.obj>

More information about the Qbs mailing list