Bazel: In Docs: clarify BUILD vs. BUILD.bazel

Created on 24 Jan 2018  Â·  19Comments  Â·  Source: bazelbuild/bazel

One can use either BUILD or BUILD.bazel as the filename for config files. AIUI, the preferred name is BUILD.bazel (because why? because this?) but the docs mostly reference BUILD. Can we update the docs to use the preferred version, as well as adding information about which one is preferred, and why?

P3 help wanted team-XProduct documentation (cleanup)

Most helpful comment

As for Jan 20, 2020, the BUILD alliance is delivering an overwhelming victory against the BUILD.bazel coalition.

Much to the disappointment of the Bazel documentation writers, resistance is limited to a mere handful of web and Go projects.

This decisive outcome once again proves the eternal truth:

Convenience is King

BUILD (42)

BUILD.bazel (7)

All 19 comments

before commenting on that issue, I also confirmed that bazel seems to prefer BUILD.bazel; if you have a BUILD.bazel file and a BUILD file, it'll ignore the latter.

for cross-reference, the original BUILD.bazel discussion was in https://github.com/bazelbuild/bazel/issues/552.

This will be a massive search-and-replace effort on both docs.bazel.build and GitHub. Prioritizing low unless someone objects.

It doesn't need to be searched-and-replaced, but it does need to be mentioned as an alternative in case an existing project has a name conflict. Right now the BUILD.bazel name doesn't seem to be mentioned on docs.bazel.build at all, except on the Android NDK page, where it's used without explanation.

I too am confused about which is conventional, or the pros/cons.

What will be least confusing to contributors to my OSS project?

(And for that matter, why does Bazel need both?)

General advice, I think, should be to always use BUILD.bazel, unless you have an existing codebase that doesn't.

Bazel has both for this reason: we have a very large codebase that uses only "BUILD" files, but there are many legitimate cases where users cannot name files "BUILD", and so they need an alternative.

BUILD.bazel is more explicit. If you have a BUILD.bazel file on your GitHub repository, users can understand what it is more easily (or they can find out easily). It also has less risk of collision.

Downside: it's more characters to type.

This will be a massive search-and-replace effort on both docs.bazel.build and GitHub.

At the very least, documentation can include @katre and @laurentlb's prescription (unless it is not true).

Pre-1.0 would be a great time to document something as simple as a preferred/recommend file extension.

BTW,
intellij bazel plugin still creates BUILD files and doesn't even allow
customizing the default option:
https://github.com/bazelbuild/intellij/issues/368

On Thu, Nov 1, 2018 at 7:52 PM Paul Draper notifications@github.com wrote:

This will be a massive search-and-replace effort on both docs.bazel.build
and GitHub.

At the very least, documentation can include @katre
https://github.com/katre and @laurentlb https://github.com/laurentlb's
prescription (unless it is not true).

Pre-1.0 would be a great time to document something as simple as a
preferred/recommend file extension.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/bazelbuild/bazel/issues/4517#issuecomment-435123499,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABUIF3qnKWppOMWNsUTlXR7c64Xrgkd7ks5uqzTCgaJpZM4Rro-Y
.

I'll be happy to review a pull request for the documentation (most of the doc is in https://github.com/bazelbuild/bazel/tree/master/site).

A year on, do we have consensus on this? Are we officially recommending projects to use BUILD.bazel over BUILD?

Seconded. Consensus would be great on this issue, as we're in the process of Bazelifying a lot more of Stripe's codebase and it's not clear which file name is most idiomatic.

Additionally, it would be great if Bazel's own codebase embraced the recommended naming convention.

As for Jan 20, 2020, the BUILD alliance is delivering an overwhelming victory against the BUILD.bazel coalition.

Much to the disappointment of the Bazel documentation writers, resistance is limited to a mere handful of web and Go projects.

This decisive outcome once again proves the eternal truth:

Convenience is King

BUILD (42)

BUILD.bazel (7)

Internally We (Wix) use only BUILD.bazel because of conflicts we had with
BUILD files and directories.

IMHO the stats below aren’t the real story because rulesets usually live in
a clean bazel only world where you won’t have interferences with other
stacks.

In real life and large codebase this interference is annoying. I’d actually
like to be able to turn off support for BUILD file via flag (probably need
a warn flag also so that I can go ask my rule sets to make these changes as
well).

On Tue, 21 Jan 2020 at 0:19 Paul Draper notifications@github.com wrote:

As for Jan 20, 2020, the BUILD alliance is delivering an overwhelming
victory against the BUILD.bazel coalition.

Much to the disappointment of the Bazel documentation writers, resistance
is limited to a mere handful of web and Go projects. (Though it would seem
not even Bazel documentation
https://github.com/bazelbuild/bazel/tree/master/site itself can resist
the power of the great BUILD.)

This decisive outcome once again proves the maxim:
Convenience is King BUILD (42)

BUILD.bazel (7)

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/bazelbuild/bazel/issues/4517?email_source=notifications&email_token=AAKQQF4FMOE6TWQHPZYF67TQ6YPN5A5CNFSM4ENOR6MKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJN6DGI#issuecomment-576446873,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAKQQF2NIDWHESPUEU35UYDQ6YPN5ANCNFSM4ENOR6MA
.

FWIW, I agree BUILD.bazel is objectively better:

  1. Better file-type detection for IDEs
  2. Doesn't conflict with Buck and Pants which also use BUILD
  3. Lower chance of conflict generally, especially on case insensitive file systems

(I also predict BUILD will always be more popular, though I'd like to be wrong.)

Deprecate BUILD for bazel (obviously for blaze it’s not an option) and see
how it’s solved :)

On Fri, 24 Jan 2020 at 21:59 Paul Draper notifications@github.com wrote:

I agree BUILD.bazel is better:

  1. Better file-type detection for IDEs
  2. Lower chance of conflict, especially on case insensitive file
    systems

(My prediction is that BUILD will also be most popular, but I'd like to be
proven wrong.)

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/bazelbuild/bazel/issues/4517?email_source=notifications&email_token=AAKQQF5EXM27J2FZDCEUYBDQ7NCAXA5CNFSM4ENOR6MKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJ35LCY#issuecomment-578278795,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAKQQFY2LOH46PHLVPHS5RTQ7NCAXANCNFSM4ENOR6MA
.

Particularly when adding Bazel to existing projects, the BUILD.bazel name is often necessary to avoid conflicts with existing things named build - as others said, especially on case insensitive file systems. As more existing projects out there make the move, more people will encounter this friction.

I'm happy to review PRs for this.

@laurentlb a PR for docs?
What do you think about being able to turn off support for BUILD?

Was this page helpful?
0 / 5 - 0 ratings