[Qbs] Dependencies on internal products using 'submodules'
Christian Gagneraud
chgans at gmail.com
Sun Dec 3 19:05:57 CET 2017
On 03/12/17 20:40, Jake Petroules wrote:
> Qbs has a global view of the entire project, so there's no need to
> qualify the names of your lib1, lib2 dependencies with the name of
> the sub-project in which they're defined. I think your idea of a
> cleaner syntax could be something of the form:
>
> Depends { names: ["lib1", "lib2"] }
>
> Basically, a condensed syntax that would allow to specify multiple
> dependency names in a single depends item, and optionally apply
> additional properties to all of those, like so:
>
> Depends { names: ["lib1", "lib2"]; condition: project.hasCoolLibs }
>
> equivalent to:
>
> Depends { name: "lib1"; condition: project.hasCoolLibs } Depends {
> name: "lib2"; condition: project.hasCoolLibs }
>
> A "names" property as such would be mutually exclusive with the
> existing submodules and productTypes property, as well as the name
> property.
>
> However your proposal as-is cannot work as the name of a dependency
> must be the name of a product or module, and projects have nothing to
> do with this. I don't think trying to add them into the mix would
> make any sense, but I think something what I suggested above would
> effectively solve the same problem I believe you're looking to do so,
> which is to remove redundant syntax (and my proposal requires fewer
> characters too :D).
Hi Jakes,
Yes, I sort of knew that project/products have nothing to do with
modules (I don't know why, but i've read something about it).
I like your proposition, it's IMHO a good compromise.
On the other hand you say that "there is no need to qualify a dependency
with the name of the project where it is declared", and it seems to
justify why this is not supported. "Not necessary" doesn't always imply
"not possible". After all there's already similar mechanism with
limitToSubProject (Depends/Project coupling), so why not allowing an
optional syntax, where name refers to a project, and submodules refer to
products from this project. Or maybe in that case, a "project" property
could be use in place of "name" (that would make the Depends item syntax
a bit messy tho). One (wild mind ;)) could imagine something like:
Depends {
project: "MyLibraries"
products: [
"lib1",
...
]
}
I don't know the internals of Qbs, so please excuse me if the above
doesn't make sense to you.
This is not a show stopper for me, just a nice to have. IMHO it keeps
the product.qbs tidy, and is in sync with the concept that you write
code once, but it gets read countless time, so it's good to make it easy
to read/understand.
Is it worth creating a proposal/use-case ticket based on this thread?
Chris
More information about the Qbs
mailing list