[Qbs] Qt Quick Tests and custom import paths

Christian Kandeler christian.kandeler at qt.io
Thu May 17 15:19:33 CEST 2018


On Thu, 17 May 2018 14:59:31 +0200
<resurrection at centrum.cz> wrote:

> It does, I use following quite a lot:
>  
> property var foo: (function (arg1, arg2) { return arg1 + arg2; })
> property var elsewhere: foo()

Yes, for the project resolution phase it's fine. But using the function in a rule is a bit more involved (and requires the master branch).


Christian

>  
> ______________________________________________________________
> > Od: Christian Kandeler <christian.kandeler at qt.io>
> > Komu: qbs at qt-project.org
> > Datum: 17.05.2018 10:25
> > Předmět: Re: [Qbs] Qt Quick Tests and custom import paths
> >  
> On Wed, 16 May 2018 18:01:40 +0200
>  Federico Frenguelli <synasius at gmail.com> wrote:
>  
>  > > If functions were properly supported as properties, there'd be a simple
>  > > generic solution:
>  > >
>  > > AutotestRunner {
>  > >     additionalArgsFunc: function(testArtifact)  {
>  > >         var myArgs = [];
>  > >         var additionalImportPaths =
>  > > testArtifact.quickpaths.additionalImportPaths;
>  > >         for (var i in additionalImportPaths)
>  > >              myArgs.push("-import", additionalImportPaths[i]);
>  > >         return myArgs;
>  > >     })
>  > > }
>  > >
>  > > In fact, I think this is already possible, though the implementation (on
>  > > the AutotestRunner side) would look rather awful, involving eval().
>  > > So maybe that's the way to go? Higher-level concepts might not be flexible
>  > > enough. For instance, the approach sketched above also allows you to get
>  > > the necessary information from product or project properties, or even from
>  > > the environment.
>  > >    
>  > 
>  >  That could be a clear and flexible solution but is it possible to use
>  > function properties? Or you were thinking of wrapping the function
>  > definition in a string??  
>  
>  I think it can work like this already, using a variant property. 
>  
>  
>  Christian
>  _______________________________________________
>  Qbs mailing list
>  Qbs at qt-project.org
>  http://lists.qt-project.org/mailman/listinfo/qbs <http://lists.qt-project.org/mailman/listinfo/qbs>
> 



More information about the Qbs mailing list