orshachar
orshachar

Reputation: 5037

apply code / macro for all subpackages BUILD.bazel files

Using bazel, I have a repetitive call to load() function at the beginning of all BUILD.bazel file.

Moreover, now I see that to test out my code (that extends bazel to another language) - I need to call some macro function in all of my build files.

Is there any way to apply custom code in all subpackages (without the need to write anything in the BUILD.bazel files)?

Upvotes: 1

Views: 401

Answers (1)

zlalanne
zlalanne

Reputation: 914

You can put in load statements into the tools/build_rules/prelude_bazel file in your workspace. For example the Skydoc rules documentation rules mention adding the following to your prelude_bazel file.

load(
    "@io_bazel_skydoc//skylark:skylark.bzl",
    "skydoc_repositories",
    "skylark_library",
    "skylark_doc",
)

Upvotes: 1

Related Questions