conan graph build-order-merge

$ conan graph build-order-merge -h
usage: conan graph build-order-merge [-h] [-f FORMAT] [--out-file OUT_FILE]
                                     [-v [V]] [-cc CORE_CONF] [--file [FILE]]
                                     [--reduce]

Merge more than 1 build-order file.

options:
  -h, --help            show this help message and exit
  -f FORMAT, --format FORMAT
                        Select the output format: json, html
  --out-file OUT_FILE   Write the output of the command to the specified file
                        instead of stdout.
  -v [V]                Level of detail of the output. Valid options from less
                        verbose to more verbose: -vquiet, -verror, -vwarning,
                        -vnotice, -vstatus, -v or -vverbose, -vv or -vdebug,
                        -vvv or -vtrace
  -cc CORE_CONF, --core-conf CORE_CONF
                        Define core configuration, overwriting global.conf
                        values. E.g.: -cc core:non_interactive=True
  --file [FILE]         Files to be merged
  --reduce              Reduce the build order, output only those to build.
                        Use this only if the result will not be merged later
                        with other build-order

conan graph build-order 命令中所述,构建顺序有两种类型:recipe(配方)和 configuration(配置)。只有相同类型的构建顺序才能合并,否则命令将返回错误。

请注意,只有未通过 --reduce 参数精简的构建顺序才能合并。

合并不同输入文件的结果也可以通过 conan graph build-order-merge --reduce 参数进行精简,其行为将保持一致:只保留需要从源代码构建的元素。

当合并两个或更多“构建顺序”文件时,合并结果将包含一个 profiles(配置文件)部分,如下所示:

"profiles": {
    "build_order_win": {
        "args": "-pr:h=\"profile1\" -s:h=\"os=Windows\" ..."
    },
    "build_order_nix": {
        "args": "-pr:h=\"profile2\" -s:h=\"os=Linux\" ..."
    }
}

其中 build_order_winbuild_order_nix 是作为合并输入使用的“构建顺序”文件名,它们将会在构建顺序中每个 package(包)的 filenames 字段中被引用。这样,在构建多种配置时,可以更容易地获取构建构建顺序中特定包二进制文件所需的命令行参数。

请注意,当一个合并后的构建顺序包含多个 filenames(文件名)时,例如:

{
    "package_id": "efa83b160a55b033c4ea706ddb980cd708e3ba1b",
    "context": "build",
    "binary": "Build",
    "filenames": [
        "build_order_win",
        "build_order_nix"
    ],
    "build_args": "--tool-requires=dep/0.1 --build=dep/0.1",
    "info": {
        "settings": {
            "build_type": "Release"
        }
    }
}

"profiles": {
    "build_order_win": {
        "args": "-pr:h=\"profile1\" -s:h=\"os=Windows\" ..."
    },
    "build_order_nix": {
        "args": "-pr:h=\"profile2\" -s:h=\"os=Linux\" ..."
    }
}

那么,要使用的 filename(文件名)是第一个,在此示例中是 build_order_win,因为 context(上下文)和 build_args(构建参数)参数与此配置文件信息匹配。其他文件名作为参考,指示还有哪些单独的构建顺序文件列出了此 package_id(包 ID)用于构建。