-
-
Notifications
You must be signed in to change notification settings - Fork 691
To BUILD or to BUILD.bazel, that is the question #866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
We're in the process of updating our documentation (#810). We should fix this. BUILD.bazel should be preferred for new projects. Bazel recognizes both names but prefers BUILD.bazel if both are present. The problem with BUILD is that it frequently collides with files or directories named "build" on case-insensitive file systems in projects that didn't previously use Bazel. The BUILD.bazel name was introduced about a year ago to avoid that collision. |
Thanks @jayconrod - that makes a lot of sense. It was also the main https://bazel.build/ site that still has a lot of BUILD references, FYI. |
We have now switched to the new documentation, which I believe only uses BUILD.bazel files. Bazel does not take a stance on BUILD vs BUILD.bazel. We (rules_go) have chosen to strongly favor the latter because as Jay said it is far less likely to cause issues in existing repositories. This is more important for us because we are automatically generating these files. |
Best practices currently suggest calling the files BUILD.bazel and not simply BUILD. This is more explicit and creates less contention in projects that have `build/` directories (which is quite common). On case-insensitive filesystems this can be particularly problematic. Auto-generating tools (such as "Gazelle") are making files called BUILD.bazel as well, so this is suggested for consistency in all non legacy projects. If both BUILD and BUILD.bazel files are present, the BUILD.bazel will be preferred...further cementing its status as "canon". bazel-contrib/rules_go#866 bazelbuild/bazel#4517
Discussion at bazel-contrib/rules_go#866 Change-Id: I4b0f02e6aa68998e8876733f73b40a9a16f7e158
#576 renamed BUILD -> BUILD.bazel, so gazelle is now generating BUILD.bazel files. But most/all docs still reference
BUILD
, notBUILD.bazel
, and it's a little confusing to me. I presume the docs are just lagging, and we should useBUILD.bazel
everywhere now? Is there a link to why we should useBUILD.bazel
?The text was updated successfully, but these errors were encountered: