[QBS] Combination of imports and module
Joerg Bornemann
joerg.bornemann at digia.com
Mon Jul 1 10:05:02 CEST 2013
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