Qbs

Blog Documentation Get Qbs Community
  • Qbs Manual
  • QbsModules
  • vcs
  • Qbs 2.4.0
  • vcs

    Provides support for version control systems. More...

    Since: Qbs 1.10

    Properties

    Detailed Description

    The vcs module provides the current state of the project's repository via the repoState property. By default, a C header is also generated, allowing for simple retrieval of the repository state directly from within your C/C++ sources. This is useful to embed information into binaries about the exact state of the repository from which they were built.

    For example:

    #include <vcs-repo-state.h>
    #include <iostream>
    
    int main()
    {
        std::cout << "I was built from " << VCS_REPO_STATE << std::endl;
    }

    Above, a header file called vcs-repo-state.h is created, defining a macro called VCS_REPO_STATE, which expands to a character constant describing the current state of the repository. For Git, this would be the current HEAD's commit hash.

    Property Documentation

    headerFileName : string

    The name of the C header file to be created.

    Set this to undefined if you do not want a header file to be generated.

    Default: "vcs-repo-state.h"


    repoDir : string

    The root directory of the repository.

    Default: The top-level project directory (project.sourceDirectory).


    repoState : string

    The current state of the repository.

    For example, in Git this is the commit hash of the current HEAD.

    Default: Undefined


    toolFilePath : string

    Set this property if the tool has an unusual name in your local installation, or if it is located in a directory that is not in the build environment's PATH.

    Default: The file name of the version control tool corresponding to type.


    type : string

    The version control system used in the project.

    Currently, the supported values are "git" and "svn".

    Default: auto-detected