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.bzlmeans loadingfile.bzlfrom the packagefoo/barin the "current" repository.@bazel_tools//tools/build_defs/repo:http.bzlmeans loadhttp.bzlfrom the packagetools/build_defs/repofrom the repositorybazel_tools. (bazel_toolsis a special repository that is built into bazel itself)See:
https://bazel.build/concepts/labels
https://bazel.build/external/overview