[Qbs] Qbs system settings

2017-12-12 Thread Christian Gagneraud

Hi there,

I would like to setup qbs profile system wide, I have tried using the 
'--settings-dir' (eg qbs-setup-qt --settings-dir /etc/xdg), but then 
qbs-config doesn't seem to read the system settings.


$ /opt/qt/5.6/bin/qtpaths --paths GenericConfigLocation
/root/.config:/etc/xdg
$ /opt/qt/5.6/bin/qtpaths --paths ConfigLocation
/root/.config:/etc/xdg

I would expect that qbs-config would see profiles defined system-wise 
too. But it seems that i need to use qbs-config --settings-dir


Can Qbs pick up build profiles defined system-wide?

I have try as well with --settings-dir /etc/xdg/QtProject, but it 
doesn't make any difference


Thanks,
Chris


___
Qbs mailing list
Qbs@qt-project.org
http://lists.qt-project.org/mailman/listinfo/qbs


[Qbs] PSA: Qbs repository URL has changed

2017-12-12 Thread Jake Petroules
Hi all,

This message is to inform any users who may have a Qbs checkout, that the URL 
has changed. The old repository URL was qt-labs/qbs, and it has now changed to 
qbs/qbs:

https://code.qt.io/cgit/qbs/qbs.git/

Please update your git remotes as necessary.
-- 
Jake Petroules - jake.petrou...@qt.io
The Qt Company - Silicon Valley
Qbs build tool evangelist - qbs.io

___
Qbs mailing list
Qbs@qt-project.org
http://lists.qt-project.org/mailman/listinfo/qbs


Re: [Qbs] Need help with setting up a code generator

2017-12-12 Thread Christian Kandeler
On Tue, 12 Dec 2017 14:20:01 +0100
Ola Røer Thorsen  wrote:

> To run the command inside the outputArtifacts script, I'll use the Process
> object, right?

Yes.

> What is the exact condition for when this script is run? Is it only
> whenever any of the inputs are modified (or the qbs file I guess)?

Whenever any input has a timestamp newer than any output, or if a property 
accessed in the rule has changed its value since the last run, or if the rule 
source code has changed.
Modifications to the qbs file only cause rule re-execution if there are 
relevant changes as described above.

> What's the simplest way to define a dummy command in the prepare-script?

var cmd = new JavaScriptCommand();
cmd.silent = true; // Or cmd.description = "";
cmd.sourceCode = function() {}


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


Re: [Qbs] qm-file build as internal resource

2017-12-12 Thread Christian Kandeler
On Tue, 12 Dec 2017 14:26:31 +0300
Карелин Павел  wrote:

> But unfortunately your recipe did not work. I see that qm-files 
> are created in the assembly directory, but there is no resulting 
> qrc-file. 

Are you sure you are using qbs >= 1.10?

> In addition, I have a couple more groups with resources. Will 
> these groups be handled correctly?

Yes, the qrc files are independent of each other.

> P.S. I can provide a link to the project on github, if that helps.

If you are using the latest qbs release and it still does not work, then yes, 
please do.


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


Re: [Qbs] Need help with setting up a code generator

2017-12-12 Thread Ola Røer Thorsen
>
>
> > Does this mean I need to know the exact list of files the code generator
> > outputs before it is run? Normally I'd only know that after having run
> the
> > code generator and look into it's output directory.
>
> Then you'll have to run the tool in the outputArtifacts script already.
> Unless the tool has some special "dry-run" option, the actual command could
> then become a dummy.
> The cleaner solution, assuming the tool is under your control, would be to
> give it such an option that prints a suitably formatted list of the outputs
> it would produce.
>
>
I'm not able to change the tool unfortunately. So I'll have to cope even if
it's less than optimal.

- If any of the input files (headers and templates) are modified, the
generator tool must be run, and all the .cpp files it produces must be
rebuilt.
- The number of output files depend on the contents of any of the input
files and is beyond my control
- I can have the generator output text files containing the names of the
generated files.

To run the command inside the outputArtifacts script, I'll use the Process
object, right?

What is the exact condition for when this script is run? Is it only
whenever any of the inputs are modified (or the qbs file I guess)?

What's the simplest way to define a dummy command in the prepare-script?


> var generatorArgs = [
> > product.sourceDirectory + "/api/some*files.h"),
>
> This looks like the wrong thing to do. If you pass some wildcard strings
> instead of actual files, you are circumventing the build system, as it
> cannot do change tracking on the expanded files.
> Instead, you should only pass actual file paths derived from the rule
> inputs.
>
> > Why does the Command object add the '' around strings with * in them, and
> > is there some way to avoid that?
>
> To prevent shell expansion, as the arguments are supposed to go to the
> command as-is. There has not yet been a use case to opt out of this, and I
> don't think yours is a valid one (as explained above).
>
>
Ok fair enough. It's how the generator tool is usually called here, but I
can create a list from the inputs array instead.

Thanks again for all the help!

Ola
___
Qbs mailing list
Qbs@qt-project.org
http://lists.qt-project.org/mailman/listinfo/qbs


Re: [Qbs] qm-file build as internal resource

2017-12-12 Thread Карелин Павел



12.12.2017 11:49, Christian Kandeler пишет:

On Mon, 11 Dec 2017 19:58:27 +0300
Карелин Павел  wrote:


I'm build a third-party project. The peculiarity of the project is that
qm-files are represented as internal resources.
Now I solved the problem with a terrible hack:
1) Created the 'Translations' product
Product {
      name: "Translations"
      type: "qm"
      destinationDirectory: project.sourceDirectory + "/translations"

      Depends { name: "Qt.core" }
      files: ["*.ts"]
}

2) The results of the work 'Translations' are located in the
project.sourceDirectory + "/translations" directory
3) The main product made dependent on 'Translations'
Depends { name: "Translations" }

4) In the main product I cling the created qm-files through a qrc-resource
      Group {
      name: "translations"
      files: ["translations/translations.qrc"]
      }

Is it possible to solve this task in another way?
qm-resources should be placed by the path ":translations/"

You left out some details, so I have to take a guess. I assume you are listing the qm 
files "manually" in the qrc file, and that's what you want to get rid of?
In that case, something like the following looks adequate:

QtApplication { // Or whatever the main product is
 Group {
 name: "translations"
 files: ["/*.ts"]
 }
 Group {
 fileTagsFilter: ["qm"]
 fileTags: ["qt.core.resource_data"]
 }

 // See doc.qt.io/qbs/qt-modules.html#core-properties
 // for details.
 Qt.core.resourceSourceBase: Qt.core.qmDir
 Qt.core.resourcePrefix: "translations"
}

This should auto-generate the qrc file.
Christian, you were right in your guess. Indeed, the file 
translations.qrc is filled manually. Sorry that did not write about this 
at once. But unfortunately your recipe did not work. I see that qm-files 
are created in the assembly directory, but there is no resulting 
qrc-file. In addition, I have a couple more groups with resources. Will 
these groups be handled correctly?


    Group {
    name: "smileys"
    files: {
    var f = [];
    if (project.useSmileys === "yes")
    f = ["smileys/emojione.qrc"];
    else if (project.useSmileys === "min")
    f = ["smileys/smileys.qrc"];
    return f;
    }
    }

    Group {
    name: "resources"
    files: [
    "res.qrc",
    ]
    }


P.S. I can provide a link to the project on github, if that helps.




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


___
Qbs mailing list
Qbs@qt-project.org
http://lists.qt-project.org/mailman/listinfo/qbs


Re: [Qbs] Need help with setting up a code generator

2017-12-12 Thread Christian Kandeler
On Tue, 12 Dec 2017 10:30:18 +0100
Ola Røer Thorsen  wrote:

> Is there some way to debug-print the contents of these groups as I go along
> writing the qbs file?

You could use the status command. Or, if you are using Qt Creator, they are 
simply listed in the project tree.

> Does this mean I need to know the exact list of files the code generator
> outputs before it is run? Normally I'd only know that after having run the
> code generator and look into it's output directory.

Then you'll have to run the tool in the outputArtifacts script already. Unless 
the tool has some special "dry-run" option, the actual command could then 
become a dummy.
The cleaner solution, assuming the tool is under your control, would be to give 
it such an option that prints a suitably formatted list of the outputs it would 
produce.

> Currently I'm trying to print the contents of headerInputs and
> templateInputs like this,
> 
> var headerInputs = inputs["generator.in.headers"];
> var templateInputs = inputs["generator.in.templates"];
> 
> console.warn("headerInputs: " + headerInputs);
> console.warn("templateInputs: " + templateInputs);

You'd typically use JSON.stringify here.

> But the output says "headerInputs: undefined" and "templateInputs:
> undefined"

That means you don't have any inputs with these tags. Double-check the 
spelling. There must be some sort of match though, because otherwise the rule 
would not have run (assuming you did not force it by setting alwaysRun or 
requiresInputs).
You can see all the inputs, including their file tags, by printing 
JSON.stringify(inputs).

> > prepare: {
> > var generatorArgs = [];
> > // Generate the command-line arguments for the generator tool
> > // from the inputs and outputs variables.
> > var cmd = new Command("generator", generatorArgs);
> > cmd.description = "Running generator";
> > return [cmd];
> > }
> >
> >  
> I've hit some issue with the argument list/array. One of my argument
> strings contain a wildcard '*', which casues that string to be wrapped with
> '.
> 
> var generatorArgs = [
> product.sourceDirectory + "/api/some*files.h"),

This looks like the wrong thing to do. If you pass some wildcard strings 
instead of actual files, you are circumventing the build system, as it cannot 
do change tracking on the expanded files.
Instead, you should only pass actual file paths derived from the rule inputs. 

> Why does the Command object add the '' around strings with * in them, and
> is there some way to avoid that?

To prevent shell expansion, as the arguments are supposed to go to the command 
as-is. There has not yet been a use case to opt out of this, and I don't think 
yours is a valid one (as explained above).


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


Re: [Qbs] Need help with setting up a code generator

2017-12-12 Thread Ola Røer Thorsen
Thanks a lot for the help, Christian!

2017-12-11 13:27 GMT+01:00 Christian Kandeler :

> Group {
> name: "header inputs"
> files: ["dir1/*.h"]
> fileTags: ["generator.in.headers"]
> }
> Group {
> name: "template inputs"
> prefix: "dir2/"
> files: ["*.tpl", "*.h", "*.cpp]
> fileTags: ["generator.in.templates"]
> }
>
>
Is there some way to debug-print the contents of these groups as I go along
writing the qbs file?


> Rule {
> // See https://doc.qt.io/qbs/rule-item.html for details.
> multiplex: true // Probably. Not entirely clear from your
> description
>

Yes multiplex seems to be the correct option here.


> inputs: ["generator.in.headers", "generator.in.templates"]
>
> // I assume the number of output files is dynamic and depends on
> // the number and/or contents of the input files.
> outputFileTags: ["h", "cpp"]
> outputArtifacts: {
> // The following two are arrays of artifact objects.
> // Their file paths are available via the filePath property.
> var headerInputs = inputs["generator.in.headers"];
> var templateInputs = inputs["generator.in.templates"];
>
> var outList = [];
> // Do what you need to do here to calculate the output
> // from the input artifacts. The return value is a list of
> // objects with properties filePath and fileTags.
> return outList;
> }
>

Does this mean I need to know the exact list of files the code generator
outputs before it is run? Normally I'd only know that after having run the
code generator and look into it's output directory.

Currently I'm trying to print the contents of headerInputs and
templateInputs like this,

var headerInputs = inputs["generator.in.headers"];
var templateInputs = inputs["generator.in.templates"];

console.warn("headerInputs: " + headerInputs);
console.warn("templateInputs: " + templateInputs);

But the output says "headerInputs: undefined" and "templateInputs:
undefined"


> prepare: {
> var generatorArgs = [];
> // Generate the command-line arguments for the generator tool
> // from the inputs and outputs variables.
> var cmd = new Command("generator", generatorArgs);
> cmd.description = "Running generator";
> return [cmd];
> }
>
>
I've hit some issue with the argument list/array. One of my argument
strings contain a wildcard '*', which casues that string to be wrapped with
'.

var generatorArgs = [
product.sourceDirectory + "/api/some*files.h"),
"-o", product.buildDirectory + "/gen/",
];

The actual command line has the first string wrapped in ' ' because of the
* in the string (wildcards are used for the input to the generator tool).
The code generator doesn't cope with the wrapping in '' (neither will "ls"
or any other command). Here is the resulting command line:

/home/x/bin/generator '/home/xxx/api/some*files.h' -o
/home/xxx/build-xxx-Desktop_Qt_5_10_0_GCC_64bit-Debug/qtc_Desktop_Qt_5_10_0_GCC_64bit_Debug/xxx.3a7a69e5/gen/

Why does the Command object add the '' around strings with * in them, and
is there some way to avoid that?

Best regards,
Ola
___
Qbs mailing list
Qbs@qt-project.org
http://lists.qt-project.org/mailman/listinfo/qbs


Re: [Qbs] qm-file build as internal resource

2017-12-12 Thread Christian Kandeler
On Mon, 11 Dec 2017 19:58:27 +0300
Карелин Павел  wrote:

> I'm build a third-party project. The peculiarity of the project is that 
> qm-files are represented as internal resources.
> Now I solved the problem with a terrible hack:
> 1) Created the 'Translations' product
> Product {
>      name: "Translations"
>      type: "qm"
>      destinationDirectory: project.sourceDirectory + "/translations"
> 
>      Depends { name: "Qt.core" }
>      files: ["*.ts"]
> }
> 
> 2) The results of the work 'Translations' are located in the 
> project.sourceDirectory + "/translations" directory
> 3) The main product made dependent on 'Translations'
> Depends { name: "Translations" }
> 
> 4) In the main product I cling the created qm-files through a qrc-resource
>      Group {
>      name: "translations"
>      files: ["translations/translations.qrc"]
>      }
> 
> Is it possible to solve this task in another way?
> qm-resources should be placed by the path ":translations/"

You left out some details, so I have to take a guess. I assume you are listing 
the qm files "manually" in the qrc file, and that's what you want to get rid of?
In that case, something like the following looks adequate:

QtApplication { // Or whatever the main product is
Group {
name: "translations"
files: ["/*.ts"]
}
Group {
fileTagsFilter: ["qm"]
fileTags: ["qt.core.resource_data"]
}

// See doc.qt.io/qbs/qt-modules.html#core-properties
// for details.
Qt.core.resourceSourceBase: Qt.core.qmDir
Qt.core.resourcePrefix: "translations"
}

This should auto-generate the qrc file.


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