qbs reached mile stone 0.3

Published Tuesday April 16th, 2013
21 Comments on qbs reached mile stone 0.3
Posted in Build system

Qbs, our alternative build tool, has reached a new mile stone. Since the last one in December, qbs has had the following improvements:

The whole codebase has seen a major overhaul. Experiments from the prototype phase have been removed. The API for the Qt Creator plugin has been stabilized. The test suite has been extended to cover most features. On our internal test farm – the same that is used for Qt Creator – qbs is tested on Linux, OS X and Windows every time the testing infrastructure detects a new change in the repository.

Support for installing your built products has been added. To install your project to ~/foo/bar use

qbs install --install-root ~/foo/bar

The project loading phase got faster. On my machine, the times to generate the makefiles respectively create the build graph for Qt Creator 2.7 look like this:

Linux Windows
qmake -r 26.284 s 99.581 s
qbs resolve 13.813 s 5.510 s

The running time of incremental null builds, that is determining that nothing of your project has changed, look currently like this for Qt Creator 2.7 (same machine with Windows/Linux dual boot):

Linux Windows
(n)make 3.228s 45.199 s
jom n/a 25.098 s
qbs 1.884s 1.630 s

The performance gain stems from the fact that qbs only has to check the timestamps of the project’s source files. It already knows the timestamps of generated files from the previous build.
On Windows this approach gains us much more than on Linux because retrieving the file timestamps is so unbelievably slow.

Support for detecting changes of project settings has been improved. Changing properties like cpp.defines will now get noticed and result in a rebuild of the affected products.

Last but not least, Qt Creator 2.7 comes with an experimental Qbs project manager plugin. It provides support for loading and building qbs projects.

Do you like this? Share it
Share on LinkedInGoogle+Share on FacebookTweet about this on Twitter

Posted in Build system

21 comments

Jos says:

What would the qbs equivalent of this makefile look like?
======

intermediate1.txt: input1.txt
customcommand1 input1.txt intermediate1.txt
intermediate2.txt: input2.txt
customcommand2 input2.txt intermediate1.txt
output.txt: intermediate1.txt intermediate2.txt
customcommand3 intermediate1.txt intermediate2.txt output.txt

======

Alejandro Exojo says:

I mostly lurk the channel and just use Qbs to build stuff (I don’t write project files yet), but I can tell you that such Makefile doesn’t make much sense. Why “intermediate1.txt” is built with “customcommand1” and “intermediate2.txt” is built with “customcommand2”?

The usual way is to define patterns, like “*.cpp” or “*.ui” that tell the buildsystem that, when matched, should be processed one certain way.

I’m sure there is a way to do it with Qbs, you you will be disappointed in seeing that is very verbose compared to those lines. Of course, a simple project file for building a Qt project would be the opposite: extremely small, compared to a large sized Makefile where you had to add all the dependencies and compiler rules yourself.

Christian Kandeler says:

For instance:


import qbs 1.0

Product {
type: "output"

files: ["input1.txt", "input2.txt"]

Transformer {
inputs: "input1.txt"
Artifact {
fileName: "intermediate1.txt"
fileTags: "intermediate"
}
prepare: {
var cmd = new Command("customcommand1", [input.fileName, output.fileName]);
cmd.description = "customcommand1";
cmd.highlight = "codegen";
return cmd;
}
}

Transformer {
inputs: "input2.txt"
Artifact {
fileName: "intermediate2.txt"
fileTags: "intermediate"
}
prepare: {
var cmd = new Command("customcommand2", [input.fileName, output.fileName]);
cmd.description = "customcommand2";
cmd.highlight = "codegen";
return cmd;
}
}

Rule {
inputs: "intermediate"
multiplex: true
Artifact {
fileName: "output.txt"
fileTags: "output"
}
prepare: {
var args = [];
for (var i in inputs.intermediate)
args.push(inputs.intermediate[i].fileName);
args.push(output.fileName);
var cmd = new Command("customcommand3", args);
cmd.description = "customcommand3";
cmd.highlight = "codegen";
return cmd;
}
}
}

Of course, as Alejandro has already remarked, this kind of complexity is typically put into some module, and your project files would just list input files, perhaps tag them and assign some properties. You only write transformers and rules yourself if you need to implement some custom, non-standard logic.

waddlesplash says:

Now that QBS itself is so fast, can we get QBS to generate Ninja files? http://neugierig.org/software/chromium/notes/2011/02/ninja.html

Alejandro Exojo says:

Not applicable.

Qbs doesn’t generate Makefiles or any intermediate files. You write a Qbs file project, and then the qbs program parses it and proceeds with whatever it has to do. That means that invokes the compiler directly (or any other tool).

Tob says:

Great work.

Will Stokes says:

Awesome. I’m well aware of how painfully slow nmake and jom are when doing incremental builds on Windows. It’s one of the big reasons I avoid developing on Windows and stick with OSX since that way I’m so much more productive. I can’t wait for qbs and QtCreator support to stabilize so I can port my application over to it.

The only real solution for qmake (apart from using qbs instead)
is to create Visual Studio project files with qmake -tp vc and use those to do the incremental builds.

Hali Halisi says:

Congratulation for this achievement. Fixing the documentation building on Windows will also help much since learning how to use Qbs without some documentation is not as easy.
Again congratulation, Qbs solves some of the hassles one would face with other build systems.

Jörg Bornemann says:

Generating the docs with MinGW is unfortunately broken currently. It works with MSVC. There are documentation snapshots available at http://doc-snapshot.qt-project.org/qbs/index.html

…though something’s wrong with the style sheet there I just noticed.

Hali Halisi says:

Thanks.

michal says:

Deploying Qt applications is not the easiest thing. Will QBS ever allow to automatically detect Qt project dependencies? Currently it has to be done manually using ‘ld’ on Linux and dependency scanner on Windows. It would be great if QBS would detect and copy shared libraries into the install folder. Also, will QBS ever support Qt Installer Framework? It would be great if I could configure my project installer from QBS config file.

Kayra Akman says:

Good questions. An additional one could be:
Will QBS be also able to, optionally, copy the necessary C and C++ runtime dlls into install folder on Windows?

Christian Kandeler says:

You mean you’d like to have a self-contained installer directory, containing all the dependencies from the project files?

michal says:

Yes. QBS(and QMake) currently support ‘INSTALLS (in qmake)’ and ‘Group (in QBS)’. How about using it to copy autodetected dependencies as well. I can imagine something like this:

Application {
Product {
id: helloworld
type: "application"
}
Group {
name: "Autodetected dependencies"
files: helloworld.dependencies
qbs.install: true
qbs.installDir: "share/helloworldproject"
}
}

where product.dependencies would be resolved as file list.

Jörg Bornemann says:

Deploying Qt applications is something we want to tackle. That could be a build tool agnostic solution a la “macdeployqt for Windows” and/or built-in support for qbs.

Thomas says:

Hi,

I was wondering if you can post the sha1 that represents the ‘known to work’ 0.4. It would probably also be nice ot have tags in the git repo.

So I did a checkout and build it (on Win7/Qt484/vs2005), most seems to work except for the fact that the generated qbs-setup-qt.exe gives me an error when run;
bash: ./qbs-setup-qt.exe: Bad file number

I’m hoping that its a regression introduced so I can checkout a working one 😉

Cheers, very cool project!

Jörg Bornemann says:

I’ve added tags for 0.2 and 0.3 now.

I bet, it does work for you if you rename setup-qt.exe to find-qt.exe or something else that doesn’t mention “setup”, “update” or “install”. This is a feature of Windows’ UAC. We can fix this by modifying the application manifest.

Thomas says:

Oh my, thats a silly Windwos ‘feature’ 😉
Thanks, I renamed it and it now works.
I renamed it to “qbs-config-qt.exe”. Which IMOHO is better than ‘update’ or ‘install’ 😉

I’ll play some more with it! Cool stuff guys.

It’s actually a great and helpful piece of information. I’m satisfied that you just
shared this helpful information with us. Please keep us up to date like this.
Thanks for sharing.

Commenting closed.

Get started today with Qt Download now