[QBS] Get property from parent project

Christian Kandeler christian.kandeler at digia.com
Fri May 23 09:28:01 CEST 2014


On 05/22/2014 06:07 PM, Tim Hutt wrote:
> Product {
>     property string foo: "baz"
>     Rule {
>        prepare: {
>            var a = product.foo;
>

Sure it does. We use that all the time. Try again ;)
Here is a full example that I just tested:

$ cat > project.qbs
import qbs

Product {
     type: "foo"
     Group {
         files: "foo.txt"
         fileTags: "foo-source"
     }
     property string foo: "baz"
     Rule {
         inputs: "foo-source"
         Artifact {
             fileName: "foo.out"
             fileTags: "foo"
         }
         prepare: {
             var a = product.foo;
             var cmd = new JavaScriptCommand();
             cmd.silent = true;
             cmd.a = a;
             cmd.sourceCode = function() { print(a); }
             return cmd;
         }
     }
}
$ qbs -q
baz
$


Christian



More information about the Qbs mailing list