I'd like to write some profiling scripts on a project, and use action_listener
or aspect
to take action. However, it's better not modifying the project files. Is there any way to add some external dependencies without change WORKSPACE
file?
Asked
Active
Viewed 323 times
0

3usi9
- 103
- 2
1 Answers
0
WORKSPACE
workspace(name = "my_workspace")
load("//:bazel/third_party/my_profile_deps.bzl", "my_profile_deps")
my_profile_deps()
bazel/third_party/my_profile_deps.bzl
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
def my_profile_deps():
"""Fetch my profile deps."""
if True: # Switch to turn on/off
# ...
maybe(
http_archive,
name = "some_lib",
build_file = "...",
sha256 = "...",
strip_prefix = "..",
urls = [
"...",
"...",
],
)
Dependencies are only fetched if needed. Therefore, you can think of introducing configurable build attributes.

Vertexwahn
- 7,709
- 6
- 64
- 90