Questions tagged [bazel-rules]
274 questions
0
votes
1 answer
How can ignore bazel features like `treat_warnings_as_errors` only on some files?
I have a library like the following in my bazel build file for C++:
cc_library(
name = "mylib",
srcs = [
"main.cpp",
"file1.cpp",
"file2.cpp",
...
],
hdrs = [
"main.h",
"file1.h",
…

Maf
- 696
- 1
- 8
- 23
0
votes
2 answers
How to load multiple dependencies in py3_image bazel rule
I recently started working with bazel so admittedly, have little knowledge of bazel intricacies. I'm using bazel to generate docker images but I want to use multiple deps inside the py3_image rule.
I have a BUILD.bazel which has python rule as…

shiv
- 165
- 1
- 20
0
votes
1 answer
Short include paths in bazel C/C++ project
I'm new to using bazel and I don't know how to make the path of my includes not have to be a full path. You can see the comment in src/main/main.c file.
My directory tree:
.
├── WORKSPACE
├── src
│ ├── lib
│ │ ├── BUILD
│ │ └── mytypes.h
│…

barroco
- 3,018
- 6
- 28
- 38
0
votes
1 answer
BAZEL: Query all targets in bazel rule
Here is code structure
| //base_folder
├── file0.txt
├── BUILD
├── folder1
| ├── BUILD
| ├── file1
├── folder2
| ├── BUILD
| ├── file2
I'd like to know all the files or target information to do a further process.
I can use bazel query…

ReneSun
- 23
- 2
- 5
0
votes
1 answer
How do I get the workspace directory at runtime in a Bazel go_test
I'm using the go_test rule from rule_go in Bazel, and I'd like to access the workspace directory at runtime. I can't find it in the environment variables, and $PWD is the temp sandbox directory. How can I access this variable? Ideally, it's…

michaelsnowden
- 6,031
- 2
- 38
- 83
0
votes
1 answer
How to resolve circular dependencies for artifacts in bazel?
My application is dependent upon the following artifact
com.oracle.jdbc:ojdbc8
which has a circular dependency with
com.oracle.jdbc:ucp
The build fails with the following error
ERROR:…

user12331
- 486
- 7
- 22
0
votes
1 answer
Bazel files not created by genrule
I am trying to generate python source code from flatbuffer schema and using the generated code in another application. But it just doesn't seem to work.
I have created a simple reproducible code that highlights the issue that I am facing. Following…

harman
- 333
- 2
- 11
0
votes
1 answer
Bazel rules_docker push container with Docker image SHA-256 tag
I would like to push a Docker image to a registry with as tag the SHA-256 digest of the image. I am using Bazel and more specifically container_push from docker_rules. Unfortunately, I am unable to retrieve the image's digest and tag the image with…

nickdecooman
- 153
- 11
0
votes
1 answer
Bazel Question: `filegroup` to `declare_directory`
I have a general question about how to make filegroup into a declare_directory.
So what I can think about is like,
filegroup -> pkg_tar -> untar_to_dir(A rule to untar the tarball into the declare_directory).
It would work, and I already proved it.…

Yanjun Zhu
- 1
- 2
0
votes
1 answer
Bazel Package: How to export build artifacts to another directory with external dependency?
I am new to Bazel. I have a project which is built with Bazel. It also used some third-party libraries which are also build from bazel (from source).
I am now trying to export my project as a standalone library to others. I can compile my project as…

ReneSun
- 23
- 2
- 5
0
votes
1 answer
Bazel sh_test doesn't find node
I am trying to run a script which needs node. I have node installed in my machine.
I can run sh_binary by bazel run //:sh_bin and the script runs node just fine:
sh_binary(
name = "sh_bin",
data = [
],
srcs =…

Yar
- 7,020
- 11
- 49
- 69
0
votes
1 answer
Having two dependent actions in a single rule
Edit: The example below did actually work, I misinterpreted the output the compiler gave me. The answer may still be helpful to some.
Is there a way for an action in a rule to generate a file that is consumed by a later action in that same…

David Heuschmann
- 3
- 2
0
votes
1 answer
How to configure workspace to add a dependency only for a particular platform?
I am using bazel to build my golang project. I want to use fips compliant crypto libraries.
I have made these changes in my WORKSPACE.bazel -
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies",…

Aditya Maheshwari
- 29
- 1
- 8
0
votes
1 answer
Using macros with bazel build
I am using macro for enabling logging in my code. Also, I am using bazel build.
Currently i need to change my .cpp file to include #define to enable this macro. Is there a way that i can provide this alongwith bazel build command ?

debonair
- 2,505
- 4
- 33
- 73
0
votes
1 answer
Docker install via Snap on WSL internal error, cannot create transient scope: DBus error "org.freedesktop.DBus.Error.UnixProcessIdUnknown"
Running a Bazel rule container_run_and_commit that throws the following error.
internal error, please report: running "docker" failed: cannot create transient scope: DBus error "org.freedesktop.DBus.Error.UnixProcessIdUnknown": [Process with ID 8…

a11hard
- 1,904
- 4
- 19
- 41