Questions tagged [bazel-rules]
274 questions
0
votes
1 answer
Can we use ceedling with Bazel?
I'm working on unit tests for a c embedded project with Bazel, first I tested the code with Ceedling (Unity and cmock) and It worked. And now, I'm trying to merge to Bazel but I did not find any document about using ceedling with Bazel.

Nesmo07
- 15
- 3
0
votes
1 answer
How to limit rule to a subset of cpp toolchains?
I have a rule like this
do_action = rule (
implementation = _impl,
attrs = {
...
"_cc_toolchain": attr.label(default = Label("@bazel_tools//tools/cpp:current_cc_toolchain")),
},
fragments = ["cpp"],
toolchains =…

warchantua
- 1,154
- 1
- 10
- 24
0
votes
1 answer
Bazel rules for Qt6 on Linux: How to copy required libs?
Currently, I am working on an experiment to support Qt6 via Bazel. My code can be found here.
On Linux with Bazel and GCC9 installed you can test my Qt6 Bazel rules via:
git clone https://github.com/Vertexwahn/rules_qt6
cd rules_qt6
bazel run…

Vertexwahn
- 7,709
- 6
- 64
- 90
0
votes
1 answer
Is there a simple way to see what Bazel "Make" Variables are expanded to?
Is there a tool for checking what variables in https://docs.bazel.build/versions/master/be/make-variables.html will actually be expanded to? That can potentially help debugging and also understanding these variables.

Zhu Li
- 585
- 6
- 18
0
votes
1 answer
Expand a Bazel rule output's directory into a flat output of another rule
I'm trying to package a bundle for uploading to Google Cloud. I have an output of pkg_web from an angular build that I did, which, if I pass into this custom rule I'm generating, is a File object that is a directory of the files. The custom rule I…

normmcgarry
- 661
- 2
- 6
- 22
0
votes
1 answer
Link CMake package with bazel cmake_external
To link pytorch c++ library with CMake, you really just need find_package(Torch REQUIRED) and use
-DCMAKE_PREFIX_PATH=/absolute/path/to/libtorch
You can download the source here:…

Jack Shi
- 23
- 1
- 5
0
votes
1 answer
How can I dynamically generate a bazel test suite?
I want to dynamically generate Bazel test rules based on the output of a complicated python script (uses imports etc., can't be ported to Starlark unfortunately).
Is it possible to run this script, parsing its output and creating the test rules…

therealtypon
- 455
- 2
- 5
- 12
0
votes
1 answer
What is the output type in Bazel?
In Bazel you can define an attribute type, which could be int or string ... or output
What does it mean to have a type of attribute as output?
Here's an example:
def _something(ctx):
print("The username is: ", ctx.attr.username)
…

Marco Dinatsoli
- 10,322
- 37
- 139
- 253
0
votes
1 answer
How to package generated python files in custom Bazel rule or genrule?
Let's say I have a scripts which generates Java and Python code. The files it generates depends on the input config, it can vary based on the config. Now, in the case of Java, I can write a simple genrule, point to invoke the script and then call…

JRodDynamite
- 12,325
- 5
- 43
- 63
0
votes
2 answers
Is there a bazel rule that supports publishing a go binary?
On successful build of a go binary (cli) I would like to publish the binary to a repository manager e.g. Artifactory. I have found various references to uploading jar dependencies but nothing specific to the rules_go
Can anyone point me in the right…

Graham Brooks
- 21
- 3
0
votes
1 answer
Executing a native_binary inside a bazel rule
@bazel_skylib//rules:native_binary.bzl defines the native_binary rule which can be used to wrap native executables inside a bazel target. I used it to wrap a packaging tool called packfolder.exe from the Sciter SDK.
I placed the binary into my…

Mark
- 5,286
- 5
- 42
- 73
0
votes
1 answer
Bazel rule for javadoc fails to pass input sources
I am trying to create a javadoc based on the javadoc.bzl
I have added in my BUILD file under the root of my project to load the rule:
load("//rules:javadoc.bzl", "javadoc")
javadoc(
name = "api-docs",
srcs = glob(["**/*.java"])
)
But when…

Jim
- 3,845
- 3
- 22
- 47
0
votes
1 answer
How do you query for all packages defined by an external repostiory in Bazel
For instance take "com_google_protobuf" defined by https://github.com/protocolbuffers/protobuf.
It should show some list like
:timestamp
:duration
.
.
.
You can get a list of these if a package in your own repository already depends on a rule from…

Keiros
- 69
- 1
- 9
0
votes
1 answer
pkg_rules problems on Windows 10
I want to use rules_pkg
I have the following setup: Windows 10 x64 (Version 2004, Bazel 3.7.0, Visual Studio 16 2019, MSYS2 x86_64)
My minimal setup looks like this:
WORKSPACE.bazel
load("@bazel_tools//tools/build_defs/repo:http.bzl",…

Vertexwahn
- 7,709
- 6
- 64
- 90
0
votes
1 answer
gazelle+protobuf problem: does not have mandatory providers: 'GoLibrary'
From gazelle-generated BUILD files, I get the following error when I run bazel build //foo/bar/protos/...:
ERROR: .../foo/bar/protos/BUILD.bazel:15:17: in deps attribute of go_proto_library rule //foo/bar/protos:protos_go_proto:…

JayEye
- 457
- 5
- 15