/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \contentspage list-of-language-items.html
    \previouspage probe-item.html
    \page product-item.html
    \nextpage project-item.html
    \ingroup list-of-language-items
    \ingroup list-of-items
    \keyword QML.Product

    \title Product Item
    \brief Represents the result of a build process.

    A \e product typically represents the result of a build process. It specifies a set of
    input and output files and a way to transform the former into the latter. For example, the
    following product sets up a very simple C++ application:
    \code
    Product {
        name: "helloworld"
        type: "application"
        files: "main.cpp"
        Depends { name: "cpp" }
    }
    \endcode
    The \c type property specifies what will be built (an executable). The \c files property specifies
    the input files (one C++ source file), and the \c Depends item pulls in the logic from the \c cpp module
    about how to do the necessary transformations.
    For some often-used types of products, \QBS pre-defines special derived items that save
    users some typing. These are:
    \list
        \li Application
        \li CppApplication
        \li DynamicLibrary
        \li StaticLibrary
    \endlist
    Therefore, the above example could also be written like this:
    \code
    CppApplication {
        name: "helloworld"
        files: "main.cpp"
    }
    \endcode
    Any property \c prop attached to this item is available in sub-items as \c product.prop, as
    well as in modules that are loaded from this product.

    \section1 Product Properties

    \table
        \header
            \li Property
            \li Type
            \li Default
            \li Description
        \row
            \li builtByDefault
            \li bool
            \li true
            \li If false, the product will only be built if this is explicitly requested,
                either by listing the product name as an argument to \c --products or by giving
                the \c build command the \c --all-products option.
        \row
            \li condition
            \li bool
            \li true
            \li If false, the product will not be built.
        \row
            \li name
            \li string
            \li empty string
            \li The name of the product. Used to identify the product in a \c Depends item, for
                example. The value of this property must be a simple JavaScript expression that
                does not depend on module properties or values that are non-local to this product.
                \div {style="font-size:80%"}
                \code
                CppApplication {
                    name: "hello" + "world"
                    // valid
                }
                CppApplication {
                    name: "app_" + qbs.targetOS.join("_")
                    // invalid
                }
                \endcode
                \enddiv
                To change the name of your product's target artifact, modify \c{Product.targetName}
                instead.
        \row
            \li type
            \li stringList
            \li empty list
            \li The file tags matching the product's target artifacts.
        \row
            \li targetName
            \li string
            \li \c{name} with illegal file name characters replaced by underscores
            \li The base file name of the product's target artifacts.
        \row
            \li destinationDirectory
            \li string
            \li product.buildDirectory
            \li The directory where the target artifacts will be located. If a relative path is
                given, the base directory will be \c project.buildDirectory.
        \row
            \li files
            \li stringList
            \li empty list
            \li A list of source files. Syntactic sugar to save a \c Group item for simple products.
                Relative paths are resolved using the parent directory of the project file
                that sets the property.
        \row
            \li excludeFiles
            \li stringList
            \li empty list
            \li A list of source files not to include. Useful with wildcards.
                For more information, see \l {Group Item}.

        \row
            \li consoleApplication
            \li bool
            \li linker-dependent
            \li If true, a console application is generated. If false, a GUI application is generated.
                Only takes effect on Windows.
                This property also influences the default application type on Apple platforms.
                If true, an application bundle is generated. If false, a normal executable is
                generated.
        \row
            \li qbsSearchPaths
            \li stringList
            \li project.qbsSearchPaths
            \li See the documentation of the \l {Project Item} property of the same name.
                The value set here will be merged with the one inherited from
                the project.
        \row
            \li version
            \li string
            \li undefined
            \li The version number of the product. Used in shared library filenames and generated
                Info.plist files in Apple application and framework bundles, for example.
    \endtable

    The following properties are relevant for product multiplexing only.
    Unless multiplexing is desired, they can be left at their default values.

    \note We do not promise backwards compatibility for multiplexing properties as they are likely
    to change in future \QBS versions.

    \table
        \header
            \li Property
            \li Type
            \li Default
            \li Description
        \row
            \li aggregate
            \li bool
            \li \c{undefined}
            \li If \c{true}, an aggregate product will be created that has dependencies on all
                multiplex instances of this product.
        \row
            \li multiplexedType
            \li stringList
            \li \c{undefined}
            \li Specifies the product type for the multiplexed product instances.
        \row
            \li multiplexByQbsProperties
            \li stringList
            \li \c{["profiles"]}
            \li Specifies which properties of the qbs module will be used for product multiplexing.
                Its value must be a subset of \c{["architectures", "buildVariants", "profiles"]}.
    \endtable

    The following properties are automatically set by \QBS and cannot be changed by the user:

    \table
        \header
            \li Property
            \li Type
            \li Description
        \row
            \li buildDirectory
            \li path
            \li The build directory for this product. This is the directory where generated files
                are placed.
        \row
            \li sourceDirectory
            \li path
            \li The source directory for this product. This is the directory of the file where this
                product is defined.
    \endtable
*/
