bazel

Bazel and py_test in sandbox - any way to define outputs?

て烟熏妆下的殇ゞ 提交于 2019-12-12 20:18:11
问题 I'm running multiple py_test() configurations on number of projects. Since there's a plenty of them, the default sandboxing mechanism seems convenient - tests don't intrude one another, and run in parallel for free. This comes with a cost, though, as to my understanding sandboxing will cause bazel to run the tests in temporary directories. Combined with py_test rule not defining any outs parameter (https://docs.bazel.build/versions/master/be/python.html), this likely means no generated file

How do I unzip a file in bazel properly if I don't know the contents of the zip?

痞子三分冷 提交于 2019-12-12 19:59:48
问题 I was to define a rule that unzips a given zip file. However, I don't know the contents of the zip, so I cannot specify outs in a genrule, for example. This seems like a common problem, and googling around leads me to people who have encountered similar scenarios, but I haven't yet seen a specific example of how to solve this. I want something like: genrule( name="unzip", src="file.zip", outs=glob(["**"]), # except you're not allowed to use glob here cmd = "unzip $(location file)", ) 回答1: You

Disable error prone in bazel

拜拜、爱过 提交于 2019-12-12 18:43:08
问题 I have a project with a lot of code. Some of this code doesn't pass error-prone inspections turned on by default in Bazel. I want to disable error-prone in bazel. Is it possible to do it without adding a command line argument via the WORKSPACE file? P.S. Disabling via command line works well 回答1: As Xiao Liang mentioned, you can add --javacopt="-XepDisableAllChecks" to your bazelrc , or you can also add it to tools/bazel.rc inside your workspace so that it can be checked in with the source

How to create a custom rule to copy folder and perform npm install

痴心易碎 提交于 2019-12-12 05:26:13
问题 I'm just starting with Bazel, I want to create a rule that copies my nodejs application (folder) inside the sandbox, copies other local packages (referenced in package.json using the file:// annotation) and perform a npm install action. The output directory should then be a distributable nodejs application with the node_modules/ already set and working (or this is what I want to get). I've tried by starting over this rule but I can't seem to perform any modification over it and I don't know

TensorFlow: Quantization Error “Analysis of target '//tensorflow/tools/graph_transforms:transform_graph' failed; build aborted.”

和自甴很熟 提交于 2019-12-12 04:38:15
问题 I am working to quantize my existing inception model graph in an attempt to reduce its size from ~89mb so something around 30mb as claimed according to the google tutorial here. The issue I am having is when I try to copy the following code snippet into mac OS terminal I get the following error. Code Snippet I try to copy and run: bazel build tensorflow/tools/graph_transforms:transform_graph bazel-bin/tensorflow/tools/graph_transforms/transform_graph \ --in_graph=/tmp/classify_image_graph_def

Build an android app using Tensorflow

馋奶兔 提交于 2019-12-12 04:23:33
问题 I'd like to separate the TensorFlow Android Camera Demo from the repo of Tensorflow. Is there a way to do that without changing anything to the tensorflow repo ? The final structure should be something like this: my_project |-- WORKSPACE |-- my_android_app | |-- BUILD | `-- ... |-- tensorflow | |-- tensorflow | | | |-- workspace.bzl | | | |-- tensorflow.bzl | | | `-- ... | |-- WORKSPACE | |-- BUILD . `-- ... In other words, how to import Tensorflow repo as a package in bazel ? 回答1: If you

For Gazelle, how can I drop src from the generated importpath?

可紊 提交于 2019-12-11 16:47:09
问题 Because of the GoPath convention, I have all the code under src directory in my repo. Hence, the generated BUILD.bazel files have src appended to the importpaths. But imports to the go code from within the repo need to not have src in them. Hence, I have to update the generated importpath each time I add a new go directory. I believe the support for go-prefix is on its way out. So I don't want to use that. I can always update the importpath and add a #keep at the end to prevent subsequent

Using select when defining a dict in Bazel

邮差的信 提交于 2019-12-11 15:52:02
问题 In bazel I often see following code: srcs = [ "foo/bar.c", ] + select({ "@org_tensorflow//tensorflow:linux_x86_64": [ "foo/baz.c", ], "//conditions:default": [], }) But how do I go with conditionally appending a dict like this? subs = { "#undef HWLOC_VERSION_MAJOR": "#define HWLOC_VERSION_MAJOR 2", } 回答1: That was completely non-intuitive, but I managed to do this in following way: common_subs = {"foo": "bar"} linux_subs = {"baz": "boo"} subs = select({ "@org_tensorflow//tensorflow:linux_x86

Default, platform specific, Bazel flags in bazel.rc

…衆ロ難τιáo~ 提交于 2019-12-11 14:16:51
问题 I was wondering if its possible for platform-specific default Bazel build flags. For example, we want to use --workspace_status_command but this must be a shell script on Linux and must point towards a batch script for Windows. Is there a way we can write in the tools/bazel.rc file something like... if platform=WINDOWS build: --workspace_status_command=status_command.bat if platform=LINUX build: --workspace_status_command=status_command.sh We could generate a .bazelrc file by having the users

Build Tensorflow on RPi3 with Bazel: C++ compilation of rule '@boringssl//:crypto' failed

久未见 提交于 2019-12-11 11:53:24
问题 Trying to run tensorflow on Raspberry PI 3B. Following the Guide on: https://github.com/samjabrahams/tensorflow-on-raspberry-pi/blob/master/GUIDE.md#3-build-bazel Everything goes fine until the following step: pi@raspberrypi:~/tf/tensorflow $ bazel build -c opt --jobs 1 --copt="-mfpu=neon-vfpv4" --copt="-funsafe-math-optimizations" --copt="-ftree-vectorize" --copt="-fomit-frame-pointer" --local_resources 1024,1.0,1.0 --verbose_failures tensorflow/tools/pip_package:build_pip_package gcc is 4.8