O.O.
O.O.

Reputation: 868

Bazel ignore subdirectory on full build

In my repository I have some files with the name "build" (automatically generated and/or imported, spread around elsewhere from where I have my bazel build files). These seem to be interpreted by Bazel as its BUILD files, and fail the full build I try to run with bazel build //...

Is there some way I can tell Bazel in a settings configuration file to ignore certain directories altogether? Or perhaps specify the build file names as something other than BUILD, like BUILD.bazel?

Or are my options:

Upvotes: 5

Views: 3472

Answers (1)

kris
kris

Reputation: 23601

I think this is a duplicate of the two questions you linked, but to expand on what you asked about in your comment:

You don't have to rename them BUILD.bazel, my suggestion is to add an empty BUILD.bazel to those directories. So you'd end up with:

my-project/
  BUILD
  src/
    build/
      stuff-bazel-shouldn't-mess-with
    BUILD.bazel  # Empty

Then Bazel will check for targets in BUILD.bazel, see that there are none, and won't try to parse the build/ directory.

And there is a distressing lack of documentation about BUILD vs. BUILD.bazel, at least that I could find.

Upvotes: 3

Related Questions