2

I recently upgraded bazel to 0.25.2. (Forgot from which version but in the low 0.20's)

But since upgrade my bazel build of buchgr/bazel-remote fails with the following errors:

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) 

Not sure why this is happening? I don't see any documentation which says http_archive or git_repository is deprecated. I am new to bazel, can someone help me understand what is going on?

1 Answer 1

3

http_archive was marked as deprecated in Bazel version 0.20.0 to 0.17.1 (take a look on the Bazel documentation for more information)

Assuming that you are using Bazel 0.25.0: Add to your WORKSPACE file:

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

Take a look at the Backward Compatibility site of Bazel:

Bazel is evolving, and we will make changes to Bazel that at times will be incompatible and require some changes from Bazel users.

To prevent you from such errors in the future document your used Bazel version in the source code - add for instance this to your WORKSPACE file:

load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version") check_bazel_version("0.23.1") 
Sign up to request clarification or add additional context in comments.

1 Comment

Add a hint for coming people who just found this answer. Currently, the .deb on the official site no longer provides old version. the old version can get from here github.com/bazelbuild/bazel/tags?after=0.19.0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.