[QBS] Combination of imports and module

Johannes.Matokic at microchip.com Johannes.Matokic at microchip.com
Mon Jul 1 16:34:36 CEST 2013


Thank you.

> All .qbs files in the module dir are loaded to evaluate their condition. 
> If the import files don't contain Module{} it's ok - just a bit slower. 
> A dedicated imports dir would be cleaner.
In fact it seems to be important to have those separated. I have added a Depends { name: "fancy" } to one of the imports which crashed Qt Creator. I think it entered kind of a recursive loop that scanned for the fancy-module but I'm not sure. Once I removed this Depends it could be parsed again.

-----Urspr√ľngliche Nachricht-----
Von: Joerg Bornemann [mailto:joerg.bornemann at digia.com] 
Gesendet: Montag, 1. Juli 2013 10:05
An: qbs at qt-project.org
Cc: Johannes Matokic - M91481
Betreff: Re: [QBS] Combination of imports and module

On 28/06/2013 16:27, Johannes.Matokic at microchip.com wrote:

> how would someone do a module that provides its own imports?
> I want to do a module that has a few common product types and rules how they could be combined when used as dependencies in the final product.

Looks like there's no good way to achieve this currently.
   Imports, like qbs.fileinfo are found if the configuration value preferences.qbsPath points to a valid location. If it's empty, then the shared/qbs directory is used. Below the preferences.qbsPath is an imports directory where qbs.fileinfo resides. Similar for modules.
   For some reason we have Project.moduleSearchPaths but not Project.importsSearchPaths. We should add this though.

Another idea would be to automatically recognize an "imports" subdir below the module subdir. That way you could place FancyProduct.qbs in the directory fancy/imports without further setup.

> Is it ok to put the module.qbs into the same dir as the imports?

All .qbs files in the module dir are loaded to evaluate their condition. 
If the import files don't contain Module{} it's ok - just a bit slower. 
A dedicated imports dir would be cleaner.

> Are there any (other) obvious (fatal) mistakes?

Looks good AFAICT. As a work around for the importSearchPath issue you could use the QML-like directory imports. Put your imports into a separate directory, say fancyimports and do this:

import "fancyimports" as Fancy

and reference the qbs items in there as Fancy.MyProduct and Fancy.OtherStuff.


BR,

Joerg

-- 
Joerg Bornemann
Digia, Qt
http://qt.digia.com/




More information about the Qbs mailing list