[QBS] run script after building products
Christian Kandeler
christian.kandeler at theqtcompany.com
Tue Mar 3 10:22:09 CET 2015
On 03/02/2015 08:16 PM, Stephan Gatzka wrote:
> I've to build a bare metal project, consisting of two elf binaries and
> an FPGA image.
>
> Building both elf binaries worked like charm. But after building both
> elf binaries I have to combine both elf files and the pre-built FPGA
> image into a single image. This involves some fancy calls to objcopy
> and dd.
>
> Now I'm struggling with the task how to implement that in a qbs product.
>
> This is my current structure:
> Project {
> name: "productName"
>
> Application {
> name: "app1"
> ...
> }
>
> Application {
> name: "app2"
> ...
> }
>
> Product {
> name: "image"
>
> Depends {
> name:"app1"
> required:true
"true" is the default.
> }
> Depends {
> name:"app2"
> required:true
> }
>
> }
> }
>
> Inside the image product I tried to make the calls to objcopy and dd
> in the prepare script of a Rule or a Transformer. I think I haven't
> totally understood the behavior or intention of the usings and input
> directives.
"usings" has a bad name and it will be called "inputsFromDependencies"
in qbs 1.4, which tells you what it means.
Your use case sounds rather straightforward to implement, but it's hard
to say what it should look like exactly without concrete knowledge about
your project. Anyway, here's a rough sketch:
Product {
name: "image"
type: ["custom-image"]
Rule {
usings: ["application"] // Provided you want to call objcopy on
the exeutables
Artifact {
filePath: ... // Whatever your output is
fileTags: ["custom-image"]
}
... // Possibly more artifacts here
prepare: {
var cmds = [];
// Add your Process commands here.
// The application products are available as
inputs["application"][0] and inputs["application"][1] (but not in a
guaranteed order).
return cmds;
}
}
}
Hope this helps a little.
Christian
More information about the Qbs
mailing list