使用 Bazel 拉取 Git 存储库返回未定义git_repository



我正在尝试运行 Bazelbuild 构建我的项目//...但是我收到以下错误

CPTI/工作区:1:1:未定义名称"git_repository">

这是我的WORKSPACE文件:

git_repository(
name = "org_pubref_rules_protobuf",
remote = "https://github.com/pubref/rules_protobuf",
tag = "v0.8.1",
#  commit = "d9523f3d443b6a4f3fabc72051d84eb5474d7745"
)
load("@org_pubref_rules_protobuf//cpp:rules.bzl", "cpp_proto_repositories")
#cpp_proto_repositories()
#BTW, @org_pubref_rules_protobuf already contains @com_google_googletest
load("//tools/build_defs:externals.bzl",
"new_patched_http_archive",
)
# The sparsehash BUILD is copied from https://github.com/livegrep/livegrep
new_patched_http_archive(
name = "com_github_sparsehash",
url = "https://github.com/sparsehash/sparsehash/archive/sparsehash-2.0.3.tar.gz",
sha256 = "05e986a5c7327796dad742182b2d10805a8d4f511ad090da0490f146c1ff7a8c",
build_file = "//third_party:BUILD.sparsehash",
strip_prefix = "sparsehash-sparsehash-2.0.3/",
patch_file = "//third_party:sparsehash.patch",
)

我找到了另一篇有答案的帖子 解决在 bazel 中使用 gRPC cpp 时的依赖问题

我添加了它,它奏效了。对不起,我以前没有找到它。

load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

最新更新