Re: [Qbs] How do I use Parameter property in a module itself?
> Is it true that all module properties should be allowed to be set per-file? > > Product { > Depends { name: "mymodule"; } > mymodule.useFeature: true // enable some probes here, do heavy checks > > Group { files: «file»; mymodule.useFeature: false; } // does nothing, > all checks are already done > } > > What worse, this won’t work at all: > > Product { > Depends { name: "mymodule"; } > Group { files: «file»; mymodule.useFeature: true; } // ooops > } > This is how I understand the documentation: Yes module properties can be specified on file level (in a group), but: - probes are evaluated only once for each product and in product scope - the probe would see the module properties set for a product - the probe would not see module properties set for a group ___ Qbs mailing list Qbs@qt-project.org https://lists.qt-project.org/listinfo/qbs
Re: [Qbs] How do I use Parameter property in a module itself?
However, this is an interesting question. Is it true that all module properties should be allowed to be set per-file? Product { Depends { name: "mymodule"; } mymodule.useFeature: true // enable some probes here, do heavy checks Group { files: «file»; mymodule.useFeature: false; } // does nothing, all checks are already done } What worse, this won’t work at all: Product { Depends { name: "mymodule"; } Group { files: «file»; mymodule.useFeature: true; } // ooops } > 10 июня 2019 г., в 20:45, Иван Комиссаров написал(а): > > Yes, I’d like to have some syntax sugar here. > But 2-liner is probably OK too. > >> 10 июня 2019 г., в 20:32, Richard Weickelt написал(а): >> >> Ivan, >> >> Do you actually want to achieve this? >> >> Module { >> property bool useFeature: false >> >> Probes.BinaryProbe { >> condition: useFeature >> } >> } >> >> Product { >> Depends { name: "mymodule"; } >> mymodule.useFeature: true >> } >> >> The Parameter item, as far as I understand it, makes only sense if you have >> - 2 products A and B >> - B depends on A and on mymodule >> - in the context of B you want to control, how a module "mymodule" >> handles A >> >> You wouldn't use it to just parameterize "mymodule", because that can be >> achieved with plain properties. >> >> The probably best explanation so far of the Parameter item can be found in >> the following blog post: >> https://blog.qt.io/blog/2017/09/05/qbs-1-9-released/ I realize that the >> reference documentation of the Parameter item is insufficient and the >> example in the module documentation could be more sensible. >> >> Richard >> ___ >> Qbs mailing list >> Qbs@qt-project.org >> https://lists.qt-project.org/listinfo/qbs > ___ Qbs mailing list Qbs@qt-project.org https://lists.qt-project.org/listinfo/qbs
Re: [Qbs] How do I use Parameter property in a module itself?
Yes, I’d like to have some syntax sugar here. But 2-liner is probably OK too. > 10 июня 2019 г., в 20:32, Richard Weickelt написал(а): > > Ivan, > > Do you actually want to achieve this? > >Module { >property bool useFeature: false > >Probes.BinaryProbe { >condition: useFeature >} >} > >Product { >Depends { name: "mymodule"; } >mymodule.useFeature: true >} > > The Parameter item, as far as I understand it, makes only sense if you have > - 2 products A and B > - B depends on A and on mymodule > - in the context of B you want to control, how a module "mymodule" > handles A > > You wouldn't use it to just parameterize "mymodule", because that can be > achieved with plain properties. > > The probably best explanation so far of the Parameter item can be found in > the following blog post: > https://blog.qt.io/blog/2017/09/05/qbs-1-9-released/ I realize that the > reference documentation of the Parameter item is insufficient and the > example in the module documentation could be more sensible. > > Richard > ___ > Qbs mailing list > Qbs@qt-project.org > https://lists.qt-project.org/listinfo/qbs ___ Qbs mailing list Qbs@qt-project.org https://lists.qt-project.org/listinfo/qbs
[Qbs] How do I use Parameter property in a module itself?
I’d like to do something like this: Module { Parameter { property bool useFeature: false } Probes.BinaryProbe { condition: useFeature } } So I’d be able to write: Depends { name: "mymodule"; useFeature: true; } ___ Qbs mailing list Qbs@qt-project.org https://lists.qt-project.org/listinfo/qbs