Skip to content

In Docs: clarify BUILD vs. BUILD.bazel #4517

Closed

Description

@davidstanke

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?

Activity

  1. ixdy commented on Jan 24, 2018

    @ixdy
    Contributor

    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.

  2. ixdy commented on Jan 24, 2018

    @ixdy
    Contributor

    for cross-reference, the original BUILD.bazel discussion was in #552.

  3. sergetron commented on Mar 29, 2018

    @sergetron
    Contributor

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

  4. mhsmith commented on Sep 10, 2018

    @mhsmith

    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.

  5. pauldraper commented on Oct 27, 2018

    @pauldraper
    Contributor

    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?)

  6. added
    untriagedHas not yet been seen by appropriate subteam
    team-BazelGeneral Bazel product/strategy issues
    on Oct 28, 2018
  7. katre commented on Oct 29, 2018

    @katre
    Collaborator

    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.

  8. laurentlb commented on Oct 31, 2018

    @laurentlb
    Contributor

    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.

  9. pauldraper commented on Nov 1, 2018

    @pauldraper
    Contributor

    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.

  10. ittaiz commented on Nov 1, 2018

    @ittaiz
    Member
  11. laurentlb commented on Nov 1, 2018

    @laurentlb
    Contributor

    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).

  12. 19 remaining items

  13. added
    P3We're not considering working on this, but happy to review a PR. (No assignee)
    and removed
    P2We'll consider working on this in future. (Assignee optional)
    on Dec 8, 2020
  14. softprops commented on Mar 7, 2021

    @softprops

    To echo previous comments I ran into an issue with a mixed grade build on OS X. Gradle uses a build directory. A BUILD file and build directory cannot coexist in a case insensitive file system

    +1 for .bazel. It makes it clear for the uninitiated to draw a line between the existence of a file and what it's used for based on its file extension much like any other file name.

  15. added a commit that references this issue on Apr 8, 2021
  16. added
    team-DocumentationDocumentation improvements that cannot be directly linked to other team labels
    on Dec 5, 2022
  17. added a commit that references this issue on Jan 30, 2023
  18. saraadams commented on May 4, 2023

    @saraadams
    Contributor

    #18251 is now live and improves the documentation on BUILD file names.

  19. six8 commented on Feb 12, 2025

    @six8

    The docs now clarify the technical precedence if both BUILD and BUILD.bazel exist, but does not clarify what the preferred usage is.

    I prefer the explicitness of BUILD.bazel for all the reasons already mentioned.

    Without an official recommendation, this is left to "whatever the team prefers". Which has its pros and cons.

    We now have a repo of mixed BUILD and BUILD.bazel because even if the team prefers BUILD, some modules have to use BUILD.bazel because they have existing build files or directories. So, on large or legacy projects, "always use BUILD" isn't viable. But "always use BUILD.bazel is".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3We're not considering working on this, but happy to review a PR. (No assignee)help wantedSomeone outside the Bazel team could own thisteam-DocumentationDocumentation improvements that cannot be directly linked to other team labelsteam-OSSIssues for the Bazel OSS team: installation, release processBazel packaging, websitetype: documentation (cleanup)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions