bazel升级后版本破损

时间:2019-05-21 01:08:25

标签: bazel

我最近将bazel升级为0.25.2。 (忘记了哪个版本,但处于0.20的最低水平)

但是,由于升级后,我的bachgr / bazel-remote的bazel构建失败,并出现以下错误:

ERROR: /Users/<user>/Workspace/bazel-remote-cache/WORKSPACE:1:1: name 'http_archive' is not defined
ERROR: /Users/<user>/Workspace/bazel-remote-cache/WORKSPACE:9:1: name 'http_archive' is not defined
ERROR: /Users/<user>/Workspace/bazel-remote-cache/WORKSPACE:15:1: name 'git_repository' is not defined
ERROR: Error evaluating WORKSPACE file
ERROR: error loading package '': Encountered error while reading extension file 'go/image.bzl': no such package '@io_bazel_rules_docker//go': error loading package 'external': Could not load //external package
ERROR: error loading package '': Encountered error while reading extension file 'go/image.bzl': no such package '@io_bazel_rules_docker//go': error loading package 'external': Could not load //external package
INFO: Elapsed time: 0.068s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)

不确定为什么会这样吗?我看不到任何说明http_archivegit_repository的文档已被弃用。我是bazel的新手,有人可以帮助我了解发生了什么事吗?

1 个答案:

答案 0 :(得分:2)

http_archive在Bazel版本0.20.0至0.17.1中被标记为不推荐使用(有关更多信息,请参阅Bazel文档)

假设您正在使用Bazel 0.25.0:将添加到WORKSPACE文件中:

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

看看Bazel的Backward Compatibility网站:

  

Bazel在不断发展,我们有时会对Bazel进行更改   将不兼容,并且需要Bazel用户进行一些更改。

为防止您在以后的文档中出现此类错误,请在源代码中使用过的Bazel版本-例如,将其添加到WORKSPACE文件中:

load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version")

check_bazel_version("0.23.1")