Questions tagged [bazel-rules]
274 questions
0
votes
1 answer
Bazel 3.5.1 version download
I have a dockerfile:
FROM golang:latest
RUN apt update &&\
apt-get install unzip &&\
apt install -y default-jdk &&\
apt-get install -y python3-pip python3.5
RUN go get github.com/bazelbuild/bazelisk
COPY . /data
WORKDIR…

Avenger
- 793
- 11
- 31
0
votes
1 answer
How to bazel gazelle --update-repos with private repository
How do you run bazel gazelle update-repo command when you have private repository when your go.mod file has private repository in there
❯ bazel run //:gazelle -- update-repos -from_file=search/go.mod
INFO: Analyzed target //:gazelle (0 packages…

Huy Le
- 37
- 6
0
votes
1 answer
Conditionally create a Bazel rule based on --config
I'm working on a problem in which I only want to create a particular rule if a certain Bazel config has been specified (via '--config'). We have been using Bazel since 0.11 and have a bunch of build infrastructure that works around former…

user961826
- 564
- 6
- 14
0
votes
1 answer
Genrule does not output the "$@" symbol in the final output file
I am writing a genrule as follows :
genrule(
name = "create_run_script",
outs = ["run_script.sh"],
executable = True,
cmd = """
cat > $@ << EOF
#!/bin/bash
cd ../dir/
exec ./program "$$@"
EOF
""",
)
When I…

marc
- 797
- 1
- 9
- 26
0
votes
1 answer
bazel run immediately Segmentation faults
I am trying to use a locally built package (this one) within an existing bazel project. It bazel builds without any errors, but when I try to bazel run it, it immediately segfaults. I tried building it in debug mode, but when I run it in debug mode…

cmoses
- 196
- 1
- 2
- 16
0
votes
1 answer
Usage of Bazel to build polyglot projects
I have a Kotlin JVM project that runs some JavaScript in an native runtime. Currently, the different language sources are defined in separate repositories and the JS file is webpacked and packaged as a JAR to be specified as a dependency of the JVM…

Jeremiah Zucker
- 162
- 13
0
votes
2 answers
Create a Bazel archives tar for an airgapped environment
I created a Bazel archive tar using the steps provides in the Bazel docs. Most of the packages are being loaded locally except for this one. Please see error below.
C:\Developers\examples-master\java-tutorial>bazel build…

Oliver Mathias
- 1
- 1
0
votes
1 answer
Is there a way to change private attribute of an Aspect progammatically?
Say I have something like the following.
def _foo_aspect_impl(target, ctx):
# operations
return FooInfo(...)
foo_aspect = aspect(implementation = _foo_aspect_impl,
attr_aspects = ['deps'],
attrs = dict(
_tool = attr.Label(
…

xiay
- 855
- 8
- 19
0
votes
1 answer
Checking if an array of package.json dependency is sorted in alphanumeric order in typeScript
I want to check if an array of package.json dependencies and devDependencies are sorted in alphanumeric order in typeScript. If it is not sorted then it should return the dep name which is falling out of place.
I want to build a bazel rule checking…

Jyoti Mishra
- 21
- 7
0
votes
1 answer
Bazel: how to create genrule that uses cmd on linux and cmd_bat on windows?
I'd like to make Bazel rules that don't depend on Bash on Windows.
I see that in a genrule, you can use cmd_bat instead of cmd (which requires bash). But how can I define the rule so that there is a cmd attribute and a cmd_bat attribute, and on…

matthias_buehlmann
- 4,641
- 6
- 34
- 76
0
votes
1 answer
Modifying include paths in custom C++ Bazel rule
I'm building some custom C++ Bazel rules, and I need to add support for modifying the include paths of the C++ headers, the same way cc_library headers can be modified with strip_include_prefix.
My custom rule is implemented using ctx.actions.run…

Conor Taylor
- 2,998
- 7
- 37
- 69
0
votes
1 answer
Have all Bazel packages expose their documentation files (or any file with a given extension)
Bazel has been working great for me recently, but I've stumbled upon a question for which I have yet to find a satisfactory answer:
How can one collect all files bearing a certain extension from the workspace?
Another way of phrasing the question:…

Shastick
- 1,218
- 1
- 12
- 29
0
votes
0 answers
I get java.lang.UnsatisfiedLinkError when try to call a native function from my project configured with bazel
I have created a cc_library in my bazel Build file and added the deps in android_binary rule
Bazel BUILD:
cc_library(
name = "native_libs",
srcs = glob([
"app/src/main/jni/**/*.cc",
"app/src/main/jni/**/*.h",
]),
)
…
0
votes
1 answer
Bazel-buildfarm - specifying concurrency of worker
I am trying to build TensorFlow using bazel-buildfarm. I have a server and a single worker setup using the example configurations available at https://github.com/bazelbuild/bazel-buildfarm (see examples/ directory). The lone worker is on a 72-core…

esw405
- 23
- 3
0
votes
1 answer
Minimal Bazel BUILD and WORKSPACE files for compiling "monster" example including sample_text.cpp
I'm new to both FlatBuffers and Bazel. Can anyone post a minimal example for compiling flatc itself, the monster_generated.h file, and then sample_text.cpp?
When I run:
bazel build flatbuffers:flatc
I get the following error:
Unable to find…

Sean
- 393
- 2
- 11