Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bazel BUILD files conflicts with a build/ folder

Tags:

bazel

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?

like image 775
Steren Avatar asked Apr 04 '17 11:04

Steren


People also ask

What is BUILD file in Bazel?

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.

How do I run a Bazel build file?

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.

Where do Bazel builds go?

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.

How does Bazel build work?

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.


1 Answers

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!

like image 167
John Cater Avatar answered Nov 14 '22 06:11

John Cater