-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
In Docs: clarify BUILD vs. BUILD.bazel #4517
Comments
before commenting on that issue, I also confirmed that bazel seems to prefer |
for cross-reference, the original |
This will be a massive search-and-replace effort on both docs.bazel.build and GitHub. Prioritizing low unless someone objects. |
Both `BUILD` and `BUILD.bazel` could be used as the bazel project file and `BUILD.bazel` is preferred (see bazelbuild/bazel#4517 (comment)) This fix changes generated BUILD in third_party packages to `BUILD.bazel`. This will help avoid conflict with `BUILD` or `build` file/directory names in third party packages. For example, while working on 19461 I noticed that apache thrift package consists of a `build` directory and that causes issues in case-insensitive systems like macOS. This PR should help avoid such conflict issues. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
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. |
Downside: it's more characters to type. |
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:
bazelbuild/intellij#368
…On Thu, Nov 1, 2018 at 7:52 PM Paul Draper ***@***.***> 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
<#4517 (comment)>,
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). |
I believe this is the current recommended default. Refs: bazelbuild/bazel#4517
I believe this is the current recommended default. Refs: bazelbuild/bazel#4517
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? |
Bazel supports both BUILD and BUILD.bazel files and in this issue: [1] there is a discussion to prefer BUILD.bazel over BUILD naming convention. Detect BUILD.bazel files as Python code in addition to BUILD files. [1] bazelbuild/bazel#4517 Change-Id: Iabc719b914fcd08ef6e73c314f09f924540c3794
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. |
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
Highlight files named `BUILD` as if they were Python. These files will almost universally contain code written in starlark which is a subset of Python. While some build systems, like Bazel, are trying to recommend using a suffix bazelbuild/bazel#4517 like `BUILD.bazel`, consensus is not universal and there is a large body of code as well as other build systems like Pants which also default to the extensionless `BUILD` name. This fix will provide proper syntax highlighting with the `bat` tool.
Both `BUILD` and `BUILD.bazel` could be used as the bazel project file and `BUILD.bazel` is preferred (see bazelbuild/bazel#4517 (comment)) This fix changes generated BUILD in third_party packages to `BUILD.bazel`. This will help avoid conflict with `BUILD` or `build` file/directory names in third party packages. For example, while working on 19461 I noticed that apache thrift package consists of a `build` directory and that causes issues in case-insensitive systems like macOS. This PR should help avoid such conflict issues. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Plenty of related issues across GH projects - Bazel supports build files named either `BUILD` or `BUILD.bazel`. In bazelbuild/bazel#4517 the community recommends the more explicit `BUILD.bazel` naming. This will also help us disambiguate bazel and blaze build file scripts when necessary.
Plenty of related issues across GH projects - Bazel supports build files named either `BUILD` or `BUILD.bazel`. In bazelbuild/bazel#4517 the community recommends the more explicit `BUILD.bazel` naming. This will also help us disambiguate bazel and blaze build file scripts when necessary.
Plenty of related issues across GH projects - Bazel supports build files named either `BUILD` or `BUILD.bazel`. In bazelbuild/bazel#4517 the community recommends the more explicit `BUILD.bazel` naming. This will also help us disambiguate bazel and blaze build file scripts when necessary.
The documentation currently refers to `BUILD` files with only a small side note that the may be called `BUILD.bazel`, namely where packages are defined. Instead, add a more prominent note to the page explaining `BUILD` files and clarify there that both namings are valid, that `BUILD.bazel` takes precendence, and that the documentation will talk just about `BUILD` files for simplicity's sake. Additionally, link to that page from the package definition section. Progress on bazelbuild#4517
The documentation currently refers to `BUILD` files with only a small side note that the may be called `BUILD.bazel`, namely where packages are defined. Instead, add a more prominent note to the page explaining `BUILD` files and clarify there that both namings are valid, that `BUILD.bazel` takes precendence, and that the documentation will talk just about `BUILD` files for simplicity's sake. Additionally, link to that page from the package definition section. Progress on #4517 Closes #18251. PiperOrigin-RevId: 529378158 Change-Id: If74903e0a9ffd4410a9c65c1fc9f3e5959fe83a7
#18251 is now live and improves the documentation on |
The documentation currently refers to `BUILD` files with only a small side note that the may be called `BUILD.bazel`, namely where packages are defined. Instead, add a more prominent note to the page explaining `BUILD` files and clarify there that both namings are valid, that `BUILD.bazel` takes precendence, and that the documentation will talk just about `BUILD` files for simplicity's sake. Additionally, link to that page from the package definition section. Progress on bazelbuild#4517 Closes bazelbuild#18251. PiperOrigin-RevId: 529378158 Change-Id: If74903e0a9ffd4410a9c65c1fc9f3e5959fe83a7
One can use either
BUILD
orBUILD.bazel
as the filename for config files. AIUI, the preferred name isBUILD.bazel
(because why? because this?) but the docs mostly referenceBUILD
. Can we update the docs to use the preferred version, as well as adding information about which one is preferred, and why?The text was updated successfully, but these errors were encountered: