[Qbs] Need help with setting up a code generator
Ola Røer Thorsen
ola at silentwings.no
Tue Dec 12 14:20:01 CET 2017
>
>
> > 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20171212/faefe4f6/attachment.html>
More information about the Qbs
mailing list