I'm trying to find anything about '@' sign in load function in Bazel. We can load things like this
load("//foo/bar:file.bzl", library_alias )
But also like this
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
I couldn't find reason or purpuse of this. Does '@'works as '<>'in include in C/Cpp? I tried looking into Bazel/Starlark repos, but it yield no results.
The first argument to load()
is a label to the build file you want to load from. The @
is part of the general syntax of labels. It means the label is referring to something from outside the repository in which the label appears.
//foo/bar:file.bzl
means loading file.bzl
from the package foo/bar
in the "current" repository.
@bazel_tools//tools/build_defs/repo:http.bzl
means load http.bzl
from the package tools/build_defs/repo
from the repository bazel_tools
. (bazel_tools
is a special repository that is built into bazel itself)
See: