[英]Extract a flat list of dependencies from Bazel file
Is there a library out there to extract the following dependencies as a flat list, or would something have to be custom written?是否有一个库可以将以下依赖项提取为平面列表,还是必须自定义编写?
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_jar")
def include_java_deps():
http_jar(
name = "com_google_inject_guice",
sha256 = "b378ffc35e7f7125b3c5f3a461d4591ae1685e3c781392f0c854ed7b7581d6d2",
url = "https://repo1.maven.org/maven2/com/google/inject/guice/4.0/guice-4.0.jar",
)
http_jar(
name = "org_sonatype_sisu_inject_cglib",
sha256 = "42e1dfb26becbf1a633f25b47e39fcc422b85e77e4c0468d9a44f885f5fa0be2",
url = "https://repo1.maven.org/maven2/org/sonatype/sisu/inject/cglib/2.2.1-v20090111/cglib-2.2.1-v20090111.jar",
)
http_jar(
name = "javax_inject_javax_inject",
sha256 = "91c77044a50c481636c32d916fd89c9118a72195390452c81065080f957de7ff",
url = "https://repo1.maven.org/maven2/javax/inject/javax.inject/1/javax.inject-1.jar",
)
This should be the desired output, extracting a flat list of the dependencies and concatenating the respective version.这应该是所需的 output,提取依赖项的平面列表并连接各自的版本。
com.google.inject:guice@4.0
org.sonatype.sisu.inject:cglib@2.2.1-v20090111
javax.inject:javax.inject@1
Maybe bazel sync
can help here.也许bazel sync
可以在这里提供帮助。 Via this command, you can create a resolved file (eg resolved.bzl
)通过此命令,您可以创建一个已解析的文件(例如resolved.bzl
)
bazel sync --experimental_repository_resolved_file=resolved.bzl
This file is a.json file.这个文件是一个.json文件。 With content similar to this:内容与此类似:
"repositories": [
{
"rule_class": "@bazel_tools//tools/build_defs/repo:http.bzl%http_archive",
"attributes": {
"url": "",
"urls": [
"https://github.com/embree/embree/archive/v2.16.5.zip"
],
"sha256": "9c4c0c385a7725946648578c1b58e887caa8b4a675a9356e76b9501d9e2e9e42",
"netrc": "",
"auth_patterns": {},
"canonical_id": "",
"strip_prefix": "embree-2.16.5",
"type": "",
"patches": [],
"patch_tool": "",
"patch_args": [
"-p0"
],
"patch_cmds": [],
"patch_cmds_win": [],
"build_file": "//ThirdParty:embree.BUILD",
"build_file_content": "",
"workspace_file_content": "",
"name": "embree"
},
"output_tree_hash": "b96d3a8db2ddd4bbc7ccde297a1d12e8be48c768bddde1ade53a4987861a1fe7"
}
]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.