A command is what Qbs executes at build time. It is represented in the language by an object of type
Command, which runs a process, or
Command represents a process that will be invoked at build time. Its constructor arguments are the binary to run and a list of command-line arguments. For instance:
var insaneCommand = new Command("rm", ["-r", "/"]);
The Rule item documentation shows a
Command in context.
Within the source code, the special identifiers
product (giving access to project and product properties, respectively) as well as
outputs are available. As the example shows, arbitrary properties can be set on the command object and then used within the source code. This technique is typically used to forward values from the prepare script to the command. The Rule item documentation shows a
The following properties are available in both
|string||empty||A message that is displayed when the command is executed.|
|string||empty||A detailed description that is displayed when the command is executed.|
|string||empty||A tag that can be used to influence how the |
All other values are mapped to the default color.
|string||empty||Determines which job pool the command will use. An empty string, which is the default, stands for the global job pool. See here and here for more information on job pools.|
|bool||false||A flag that controls whether the |
Note: If this property is
|int||-1||Time limit for the command execution in seconds. If the command does not finish within the timeout, it is cancelled. In case of a |
This property was introduced in Qbs 1.15.
|stringList||empty||The list of arguments to invoke the command with. Explicitly setting this property overrides an argument list provided when instantiating the object.|
|stringList||empty||A list of environment variables that are added to the common build environment. They are provided as a list of strings in the form "varName=value".|
|int||0||The maximum exit code from the process to interpret as success. Setting this should rarely be necessary, as all well-behaved applications use values other than zero to indicate failure.|
|string||undefined||The binary to invoke. Explicitly setting this property overrides a path provided when instantiating the object.|
|stringList||undefined||Names of environment variables that the invoked binary considers. If one of these variables changes in the build environment, the command will be re-run even if the input files are still up to date.|
|int||32000 on Windows, -1 elsewhere||If this value is greater than zero and less than the length of the full command line, and if |
|int||0||Index of the first argument to include in the response file. For example this may be used in conjunction with a compiler wrapper where the first argument (the path to the compiler) must be included on the raw command line.|
|string||empty||The prefix that informs |
|function||undefined||A function that takes as input the command's actual standard error output and returns a string that is presented to the user as the command's standard error output. If it is not set, the output is shown unfiltered.|
|function||undefined||A function that takes as input the command's actual standard output and returns a string that is presented to the user as the command's standard output. If it is not set, the output is shown unfiltered.|
|string||empty||The program's working directory.|
|string||undefined||Redirects the filtered standard output content to |
|string||undefined||Redirects the filtered standard error output content to |
© 2018 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.