Re: [Qbs] Evaluation of Conditional Depends

2020-06-10 Thread Christian Kandeler
On Wed, 10 Jun 2020 11:37:02 +0200 (CEST)
"Richard Weickelt"  wrote:

> ... And module properties set in the profile. I had a glance look at the 
> source code. When evaluating the condition property, we are taking the 
> following information from the product context into account:
> 
> - module values set in the profile (can even be a local profile within the 
> product item)
> - a fully(?) resolved instance of the qbs module
> 
> The result is then cached since this module might be loaded multiple times in 
> the same product context. I don't see why we could not allow access to 
> product as well as project properties and module properties set in the 
> product item.
> 
> Christian, is that restriction by purpose?

Well, there was no use case so far, and it does seem a bit dubious at first 
glance. But if there's a compelling case, perhaps it could be added (if it is 
actually possible; it's been a while since I've done work in that area).


Christian
___
Qbs mailing list
Qbs@qt-project.org
https://lists.qt-project.org/listinfo/qbs


Re: [Qbs] Evaluation of Conditional Depends

2020-06-10 Thread Richard Weickelt
> And of course the module's own properties set in the module file, except
> those referring to probes. But we do evaluate the module condition in a
> product context. Is that not the real product context or at least very
> close? E.g. if product sets moduleX.propA to true and depends on moduleX,
> is propA then not true when evaluating the condition? At least that was my
> expectation in my previous reply. Also, doesn't it make sense to provide
> access to custom product properties in that phase?

... And module properties set in the profile. I had a glance look at the source 
code. When evaluating the condition property, we are taking the following 
information from the product context into account:

- module values set in the profile (can even be a local profile within the 
product item)
- a fully(?) resolved instance of the qbs module

The result is then cached since this module might be loaded multiple times in 
the same product context. I don't see why we could not allow access to product 
as well as project properties and module properties set in the product item.

Christian, is that restriction by purpose?
___
Qbs mailing list
Qbs@qt-project.org
https://lists.qt-project.org/listinfo/qbs


Re: [Qbs] Evaluation of Conditional Depends

2020-06-10 Thread Richard Weickelt


Christian Kandeler wrote on 10. June 2020 10:09 (GMT +02:00):

> On Tue, 9 Jun 2020 20:55:43 +0200
> Christian Gudrian  wrote:
> 
>> Could it be that only a restricted set of variables is available during
>> evaluation of the module’s „condition“ property? Neither
>> „product“ nor any imported modules’ variables can be accessed
>> („Can’t find variable“ error).
>> 
>> Is that a known limitation or am I doing something wrong?
> 
> Remember that the module has not been loaded yet, so the right-hand side
> of the condition property is rather restricted in terms of what you can
> access there. Basically, it's just the qbs module.

And of course the module's own properties set in the module file, except those 
referring to probes. But we do evaluate the module condition in a product 
context. Is that not the real product context or at least very close? E.g. if 
product sets moduleX.propA to true and depends on moduleX, is propA then not 
true when evaluating the condition? At least that was my expectation in my 
previous reply. Also, doesn't it make sense to provide access to custom product 
properties in that phase?
___
Qbs mailing list
Qbs@qt-project.org
https://lists.qt-project.org/listinfo/qbs


Re: [Qbs] Evaluation of Conditional Depends

2020-06-10 Thread Christian Kandeler
On Tue, 9 Jun 2020 20:55:43 +0200
Christian Gudrian  wrote:

> Could it be that only a restricted set of variables is available during 
> evaluation of the module’s „condition“ property? Neither „product“ nor any 
> imported modules’ variables can be accessed („Can’t find variable“ error).
> 
> Is that a known limitation or am I doing something wrong?

Remember that the module has not been loaded yet, so the right-hand side of the 
condition property is rather restricted in terms of what you can access there. 
Basically, it's just the qbs module.


Christian
___
Qbs mailing list
Qbs@qt-project.org
https://lists.qt-project.org/listinfo/qbs