Questions tagged [bazel]

Bazel is a build tool that builds code quickly and reliably. It is used to build the majority of Google's software, and thus it has been designed to handle build problems present in Google's development.

From the Documentation: Overview:

What is Bazel?

Bazel is an open-source build and test tool similar to Make, Maven, and Gradle. It uses a human-readable, high-level build language. Bazel supports projects in multiple languages and builds outputs for multiple platforms. Bazel supports large codebases across multiple repositories, and large numbers of users.

Why should I use Bazel?

Bazel offers the following advantages:

  • High-level build language. Bazel uses an abstract, human-readable language to describe the build properties of your project at a high semantical level. Unlike other tools, Bazel operates on the concepts of libraries, binaries, scripts, and data sets, shielding you from the complexity of writing individual calls to tools such as compilers and linkers.

  • Bazel is fast and reliable. Bazel caches all previously done work and tracks changes to both file content and build commands. This way, Bazel knows when something needs to be rebuilt, and rebuilds only that. To further speed up your builds, you can set up your project to build in a highly parallel and incremental fashion.

  • Bazel is multi-platform. Bazel runs on Linux, macOS, and Windows. Bazel can build binaries and deployable packages for multiple platforms, including desktop, server, and mobile, from the same project.

  • Bazel scales. Bazel maintains agility while handling builds with 100k+ source files. It works with multiple repositories and user bases in the tens of thousands.

  • Bazel is extensible. Many languages are supported, and you can extend Bazel to support any other language or framework.


Resource


Presentation


Community


Related Plugins

3196 questions
171
votes
3 answers

What are the differences between Bazel and Gradle?

Google just open-sourced its build tool Bazel. What are the differences between this tool and Gradle? What can it do that Gradle cannot, what does it do better, and what does Gradle do better?
user11171
  • 3,821
  • 5
  • 26
  • 35
58
votes
2 answers

Tensorflow Compile Runs For A Long Time

So I am trying to compile TensorFlow from the source (using a clone from their git repo from 2019-01-31). I installed Bazel from their shell script…
Zonyl
  • 726
  • 5
  • 13
51
votes
4 answers

Bazel build verbose compiler commands logging

How can I increase the verbosity of the build process? Bazel seems to print compiler commands only if something goes wrong during the build. I would like to see which compiler comands the cc_library rule fires, even if everything seems to be fine,…
Jan
  • 1,359
  • 1
  • 13
  • 18
48
votes
2 answers

How can I ask Bazel to rerun a cached test?

I'm trying to analyze and fix a flaky test which is often green. My problem is that once the test passes Bazel doesn't re-run it until any of the inputs have changed. I saw you can ask Bazel to re-run a target but AFAICT it's only until the first…
Ittai
  • 5,625
  • 14
  • 60
  • 97
46
votes
5 answers

Xcode version must be specified to use an Apple CROSSTOOL

I try to build tensorflow-serving using bazel but I've encountered some errors during the building ERROR:/private/var/tmp/_bazel_Kakadu/3f0c35881c95d2c43f04614911c03a57/external/local_config_cc/BUILD:49:5: in apple_cc_toolchain rule…
Ivan Shelonik
  • 1,958
  • 5
  • 25
  • 49
31
votes
2 answers

Run Tensorflow unit tests

Is there any way to run Tensorflow unit tests manually? I want to perform sanity checks while modifying TF source code. I see there are many _test.py files with classes that perform many test operations and I can't figure out how to run them. There…
Maksym Diachenko
  • 552
  • 1
  • 4
  • 11
28
votes
1 answer

What is the added advantage of using Bazel over Gradle?

I was reading about the Android Testing Samples project and noticed that a "new" build tool named Bazel is being used for building Android projects: Experimental Bazel Support Some of these samples can be built with Bazel on Linux. These samples…
shizhen
  • 12,251
  • 9
  • 52
  • 88
27
votes
3 answers

How to set C++ standard version when build with Bazel?

I'm kinda new to C++. I know how to set C++ version with CMake, but don't know how to set C++ version in Bazel. Maybe set with the copts parameter in cc_libary but I have to set this in every cc_libary?
ryancheung
  • 2,999
  • 3
  • 24
  • 25
26
votes
5 answers

Tensorflow: Cuda compute capability 3.0. The minimum required Cuda capability is 3.5

I am installing tensorflow from source (documentation). Cuda driver version: nvcc: NVIDIA (R) Cuda compiler driver Cuda compilation tools, release 7.5, V7.5.17 When I ran the following command : bazel-bin/tensorflow/cc/tutorials_example_trainer…
Abhijay Ghildyal
  • 4,044
  • 6
  • 33
  • 54
26
votes
2 answers

Is there a way to limit the number of CPU cores Bazel uses?

Is there a way to tell Bazel when building how many CPU cores it can use? TL;DR I build TensorFlow on a VMware Workstation and being a virtual machine I can adjust the number of processors and cores for the virtual machine. In the process of…
Guy Coder
  • 24,501
  • 8
  • 71
  • 136
25
votes
2 answers

How do I get the commands executed by Bazel

I was wondering if there is a way to get Bazel to list, output, display, etc., all of the commands that can be executed from a command line that are run during a build after a clean. I do not care if the output is to the screen, in a file, etc. I…
Guy Coder
  • 24,501
  • 8
  • 71
  • 136
24
votes
2 answers

How to generate compile_commands.json for a C++ Bazel project

In a C++ Bazel project, I want to use tools like Clang Tools or RTags, etc. For that I need to generate a compile_commands.json file. The solution is trivial for CMake with the CMAKE_EXPORT_COMPILE_COMMANDS. For simple Makefiles you can still use…
Picaud Vincent
  • 10,518
  • 5
  • 31
  • 70
23
votes
1 answer

How to get the log messages from test via bazel?

I am using bazel to build and run tests for my project. I want to get more insight into how my tests are running. I want to be able to see the output captured by the logger in my java app. I have tried adding -s parameter to start my tests, like so:…
Anthony Kong
  • 37,791
  • 46
  • 172
  • 304
22
votes
3 answers

Nest can't resolve dependencies in the RootTestModule context when I use Bazel Test

I need to run my tests in the bezel. how can I solve this mysterious problem? I have a nestjs project contains multiple apps and libs. When I run the test yarn jest --config ./jest.config.json libs/lib1, it works perfectly. However when I run with…
Hossein Mayboudi
  • 395
  • 1
  • 4
  • 12
22
votes
3 answers

C++ project with Bazel and GTest

I want to create a Bazel C++ project with gtest for unit tests. What is the minimal setup? (I only have Bazel installed on my computer and I am running under Linux)
Picaud Vincent
  • 10,518
  • 5
  • 31
  • 70
1
2 3
99 100