格式化程序:Graph-info JSON

本节旨在展示使用以下任何命令时 JSON 格式输出的一个示例

  • conan graph info xxxx --format=json

  • conan create xxxx --format=json

  • conan install xxxx --format=json

  • conan export-pkg xxxx --format=json

输出显示每个命令中 Conan 处理的图形信息。

警告

此 JSON 输出为实验性功能,可能会发生更改。

例如,由 conan graph info --require=zlib/1.2.11 -r=conancenter --format=json > graph.json 生成的 JSON 输出

graph.json
{
    "graph": {
        "nodes": {
            "0": {
                "ref": "conanfile",
                "id": "0",
                "recipe": "Cli",
                "package_id": null,
                "prev": null,
                "rrev": null,
                "rrev_timestamp": null,
                "prev_timestamp": null,
                "remote": null,
                "binary_remote": null,
                "build_id": null,
                "binary": null,
                "invalid_build": false,
                "info_invalid": null,
                "name": null,
                "user": null,
                "channel": null,
                "url": null,
                "license": null,
                "author": null,
                "description": null,
                "homepage": null,
                "build_policy": null,
                "upload_policy": null,
                "revision_mode": "hash",
                "provides": null,
                "deprecated": null,
                "win_bash": null,
                "win_bash_run": null,
                "default_options": null,
                "options_description": null,
                "version": null,
                "topics": null,
                "package_type": "unknown",
                "settings": {
                    "os": "Macos",
                    "arch": "x86_64",
                    "compiler": "apple-clang",
                    "compiler.cppstd": "gnu17",
                    "compiler.libcxx": "libc++",
                    "compiler.version": "12.0",
                    "build_type": "Release"
                },
                "options": {},
                "options_definitions": {},
                "generators": [],
                "python_requires": null,
                "system_requires": {},
                "recipe_folder": null,
                "source_folder": null,
                "build_folder": null,
                "generators_folder": null,
                "package_folder": null,
                "cpp_info": {
                    "root": {
                        "includedirs": [
                            "include"
                        ],
                        "srcdirs": null,
                        "libdirs": [
                            "lib"
                        ],
                        "resdirs": null,
                        "bindirs": [
                            "bin"
                        ],
                        "builddirs": null,
                        "frameworkdirs": null,
                        "system_libs": null,
                        "frameworks": null,
                        "libs": null,
                        "defines": null,
                        "cflags": null,
                        "cxxflags": null,
                        "sharedlinkflags": null,
                        "exelinkflags": null,
                        "objects": null,
                        "sysroot": null,
                        "requires": null,
                        "properties": null
                    }
                },
                "conf_info": {},
                "label": "cli",
                "dependencies": {
                    "1": {
                        "ref": "zlib/1.2.11",
                        "run": false,
                        "libs": true,
                        "skip": false,
                        "test": false,
                        "force": false,
                        "direct": true,
                        "build": false,
                        "transitive_headers": null,
                        "transitive_libs": null,
                        "headers": true,
                        "package_id_mode": null,
                        "visible": true
                    }
                },
                "context": "host",
                "test": false
            },
            "1": {
                "ref": "zlib/1.2.11#ffa77daf83a57094149707928bdce823",
                "id": "1",
                "recipe": "Cache",
                "package_id": "d0599452a426a161e02a297c6e0c5070f99b4909",
                "prev": "1440f4f447208c8e6808936b4c6ff282",
                "rrev": "dc0e384f0551386cd76dc29cc964c95e",
                "rrev_timestamp": 1703667991.3458598,
                "prev_timestamp": 1703668372.8517942,
                "remote": null,
                "binary_remote": null,
                "build_id": null,
                "binary": "Missing",
                "invalid_build": false,
                "info_invalid": null,
                "name": "zlib",
                "user": null,
                "channel": null,
                "url": "https://github.com/conan-io/conan-center-index",
                "license": "Zlib",
                "author": null,
                "description": "A Massively Spiffy Yet Delicately Unobtrusive Compression Library (Also Free, Not to Mention Unencumbered by Patents)",
                "homepage": "https://zlib.net",
                "build_policy": null,
                "upload_policy": null,
                "revision_mode": "hash",
                "provides": null,
                "deprecated": null,
                "win_bash": null,
                "win_bash_run": null,
                "default_options": {
                    "shared": false,
                    "fPIC": true
                },
                "options_description": null,
                "version": "1.2.11",
                "topics": [
                    "zlib",
                    "compression"
                ],
                "package_type": "static-library",
                "settings": {
                    "os": "Macos",
                    "arch": "x86_64",
                    "compiler": "apple-clang",
                    "compiler.cppstd": "gnu17",
                    "compiler.libcxx": "libc++",
                    "compiler.version": "12.0",
                    "build_type": "Release"
                },
                "options": {
                    "fPIC": "True",
                    "shared": "False"
                },
                "options_definitions": {
                    "shared": [
                        "True",
                        "False"
                    ],
                    "fPIC": [
                        "True",
                        "False"
                    ]
                },
                "generators": [],
                "python_requires": null,
                "system_requires": {},
                "recipe_folder": "/Users/franchuti/.conan2/p/zlib774aa77541f8b/e",
                "source_folder": null,
                "build_folder": null,
                "generators_folder": null,
                "package_folder": null,
                "cpp_info": {
                    "root": {
                        "includedirs": [
                            "include"
                        ],
                        "srcdirs": null,
                        "libdirs": [
                            "lib"
                        ],
                        "resdirs": null,
                        "bindirs": [
                            "bin"
                        ],
                        "builddirs": null,
                        "frameworkdirs": null,
                        "system_libs": null,
                        "frameworks": null,
                        "libs": null,
                        "defines": null,
                        "cflags": null,
                        "cxxflags": null,
                        "sharedlinkflags": null,
                        "exelinkflags": null,
                        "objects": null,
                        "sysroot": null,
                        "requires": null,
                        "properties": null
                    }
                },
                "conf_info": {},
                "label": "zlib/1.2.11",
                "info": {
                    "settings": {
                        "os": "Macos",
                        "arch": "x86_64",
                        "compiler": "apple-clang",
                        "compiler.cppstd": "gnu17",
                        "compiler.libcxx": "libc++",
                        "compiler.version": "12.0",
                        "build_type": "Release"
                    },
                    "options": {
                        "fPIC": "True",
                        "shared": "False"
                    }
                },
                "dependencies": {},
                "context": "host",
                "test": false
            }
        },
        "root": {
            "0": "None"
        },
        "overrides": {},
        "resolved_ranges": {},
        "replaced_requires": {}
    }
}