I am migrating my Cmake project to Bazel. At the root of my project is a build
folder that I use to run Cmake.
To migrate to Bazel, I need to create a BUILD
file at the root of my project. However, on macOS, I cannot create it due to the presence of my build
folder.
Can I use a different name for Bazel's BUILD
files? Or should I get rid of my build
folder?
By definition, every package contains a BUILD file, which is a short program. BUILD files are evaluated using an imperative language, Starlark. They are interpreted as a sequential list of statements. In general, order does matter: variables must be defined before they are used, for example.
To run Bazel, go to your base workspace directory or any of its subdirectories and type bazel . % bazel help [Bazel release bazel-<version>] Usage: bazel <command> <options> ... Available commands: analyze-profile Analyzes build profile data.
Workspace. The workspace is typically the directory where Bazel constructs your project's build files from your source code. It contains various source files in a nested hierarchical fashion. At the highest or root level of your workspace, your project might also have a dedicated WORKSPACE text file.
Bazel build process When running a build or a test, Bazel does the following: Loads the BUILD files relevant to the target. Analyzes the inputs and their dependencies, applies the specified build rules, and produces an action graph. Executes the build actions on the inputs until the final build outputs are produced.
Bazel also supports using BUILD.bazel as the filename, which should resolve this issue (BUILD.bazel is preferred if both BUILD.bazel and BUILD exist).
Please try using that and see if it helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With