Qt Creator 2.7: QBS project manager under the hood

    Greetings friends! In early February, the IDE Qt Creator 2.7 beta was announced, and on March 21, 2.7.0 was released.
    So, of the notable changes in the new release were:
    • Improved toolkit support (Kits);
    • Further support for C ++ 11;
    • Changes in QML and Qt Quick2.

    Many small changes such as merge support for the git plugin, improvements in the debugger, but in general the release is not revolutionary, but evolutionary.
    You know, I will not detail all the changes, they can be read in the press release .
    One noticeable innovation for me is the appearance in the main branch of the QBS support plugin. I wrote about the qbs system earlier on the hub . Since then, a lot of water has flowed, and someone might have thought that the project has stalled, but no, the construction of communism is at an accelerated pace, and I will try to give a brief overview of some of the changes.



    1. Support for qbs projects (QbsProjectManager plugin)


    (Note: until the release came out, there were problems with the build, and with stability under Windows).
    How to assemble? If you want to manually, of course, rather than use the finished assembly. I will just reduce the time you read, I won’t write commands for git.
    • do a checkout or just save the QBS repository archive
      qt.gitorious.org/qt-labs/qbs/trees/master ” or “git: //gitorious.org/qt-labs/qbs.git”
    • similar operations with the Qt Creator source tree
      qt.gitorious.org/qt-creator/qt-creator/trees/master ” or “git: //gitorious.org/qt-creator/qt-creator.git"
    • collect qbs from the source directory
      qmake -r qbs.pro && make

    • open the qtcreator.pro project, add environment variables
      QBS_BUILD_DIR = path / to / folder / qbs
      QBS_SOURCE_DIR = path / to / folder / qbs
      If you configured the shadow build, you need to fix these paths.
    • We start the Qt Creator assembly, and if everything goes well, then you will get the IDE binaries and the plugin with QBS support.


    If everything went fine, compilation errors (it happens!), Then two ways:
    • try an older version of qbs (roll back two weeks ago)
    • try to fix it yourself.

    In addition, the fastest way is to simply download the binary assembly and enable the QBS Project Manager plugin in the settings.

    2. Current plugin features


    They are more than modest. You can build a project. And you can not collect!

    You can also scan the qbs file (for example, files were added, and the list of files was set with a mask) to rebuild the tree. Naturally, it remains possible to run a project under the debugger, like a qmake project.
    How the assembly itself goes: as with qmake, in the output of the assembly (Compile Output) we see the output of qbs. For the most part, it is very concise, until errors or warnings occur. Assembly can be interrupted. And thank God that such an opportunity already exists)
    Assembly pin
    15:32:58: Running steps for project qtcreator ...
    compiling tcpportsgatherer.cpp
    compiling textfileformat.cpp
    compiling treewidgetcolumnstretcher.cpp
    compiling uncommentselection.cpp
    compiling unixutils.cpp
    moc wizard.cpp
    moc wizard.h
    compiling faketooltip.cpp
    moc faketooltip.h
    moc tips.h
    compiling tipcontents.cpp
    moc tooltip.h
    compiling tooltip.cpp
    The following products could not be built: QmlJSEditor, GLSLEditor, Git, CodePaster, Perforce, ClearCase, Android, Welcome, Core, Aggregation, Find, Debugger, RemoteLinux, styleplugin, QtcSsh, AutotoolsProjectManager, FakeVim, CMakeProjectManager, ImageSTer, Qml Mercurial, CppTools, GenericProjectManager, PythonEditor, QmlProjectManager, zeroconf, UpdateInfo, Bookmarks, LanguageUtils, BinEditor, Subversion, QtSupport, Designer, ExtensionSystem, Utils, cpaster, qtcreator_process_stub, TaskListLocpreder, Macpreader, Docs, XPreder, Macpreader, Macrogram Help, qtcreator, Todo, Bazaar, TextEditor, ClassView, CPlusPlus, CVS, Qt4ProjectManager, ResourceEditor, translations, QmlJS, VcsBase, Madde, qtpromaker, CppEditor, QmlEditorWidgets, QmlProfiler, HelloWorldd, Valgrd Locor
    Build was canceled due to user request.
    15:33:05: Canceled build / deployment.
    15:33:05: Elapsed time: 00:05.
    


    Naturally, if there are errors, then you can see them in the assembly errors widget. There are flaws with parsing (errors are displayed twice actually), and with the warning icon (are displayed as errors). I hope this will be corrected.
    In addition, it is possible to rebuild one specific file from the context menu. In my opinion, this feature is still unstable (it hasn’t noticed any patterns in its behavior, but sometimes it even works).
    After downloading the qbs project for QtCreator, I managed to build it in 13 minutes (which is about two times faster, approximately faster than qmake + make).
    In the Run tab there is a basic setup of steps for building under qbs. When trying to add my own version, QtC crashed. It’s sad.


    3. The most delicious. What was added over the year?


    • Improved support for the clean command. Previously, it simply deleted the build directory, now various options have appeared;
    • Added the ability to specify a list of files using masks (and exceptions). Here is an example from the tests:
      patterns.qbs
      import qbs.base 1.0
      Application {
          type: 'application'
          name: 'HelloWorld'
          Depends { name: 'cpp' }
          cpp.defines: ['SOMETHING']
          //files: '../patternfiles/././.*\\..\\patternfiles/*s*r*c*\\foo.*'
          Group {
              files: 'src/foo.*'
              excludeFiles: 'src/foo.2.cpp'
              recursive: true
          }
          Group {
              cpp.defines: outer.concat(['HAVE_MAIN_CPP', cpp.debugInformation ? '_DEBUG' : '_RELEASE'])
              prefix: "src/"
              files: 'main.*'
          }
      }
      


    • Added support for deploy command;
    • The system of settings and profiles has been redesigned, in my opinion it has become more understandable - the “platforms” have been removed as a concept that has moved from QtC;
    • Improved run and install commands;
    • Reworked and significantly improved MSVC support - .PCH, .rc, .manifest files.
    • Now you can configure the assembly using Configure Probes. How to apply them can be found in the tests folder.
    • Expanded support for MacOS and Objective-C.


    What else can I add? I was not able to test even half of the QBS features, but I can say that the organization of cross-platform assemblies (under the arm toolchain) turned out to be very convenient and pleasant.
    In conclusion, it remains only to note that despite the rapid and explosive development, QBS is still under active development, and compatibility can still break (until the 1.0 release, which is good if it appears this year).
    You can also read my last article on QBS .

    Also popular now: