To integrate Bartleby in a Bazel repository, it at first is necessary to import the source code, using for instance the http_archive
rule:
# in WORKSPACE or WORKSPACE.bazel
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "com_sandboxquantum_bartleby",
sha256 = "61f870bf4a9f4f53f8998f844297130ff079d0ce6d866f7a06180246ca8f3426", # replace with the latest release
urls = ["https://github.com/sandbox-quantum/bartleby/releases/download/0.1.0/bartleby-v0.1.0.tar.gz"], # replace with the latest release
)
Then, we have to load the Bartleby dependencies:
# Loads bartleby external repositories.
load("@com_sandboxquantum_bartleby//bartleby:repositories.bzl", "bartleby_repositories")
bartleby_repositories()
# Loads an initializes bartleby dependencies.
load("@com_sandboxquantum_bartleby//bartleby:deps.bzl", "bartleby_deps")
bartleby_deps()
Full example
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
_COMMIT = "01f9b7dd86cf415b5591deff4ba759345cc0af36"
_SHA256 = "efaa650c4c96ee671a73406fe9a625783e8ec404b7e4bdbf49a3e36b440754f0"
http_archive(
name = "com_sandboxquantum_bartleby",
sha256 = _SHA256,
strip_prefix = "bartleby-{commit}".format(commit = _COMMIT),
urls = ["https://github.com/sandbox-quantum/bartleby/archive/{commit}.tar.gz".format(commit = _COMMIT)],
)
load("@com_sandboxquantum_bartleby//bartleby:repositories.bzl", "bartleby_repositories")
bartleby_repositories()
load("@com_sandboxquantum_bartleby//bartleby:deps.bzl", "bartleby_deps")
bartleby_deps()
- See also
http_archive
rule
-
Bazel rule
-
bazel/WORKSPACE.bazel example