Issue
I wish to run bazel build :...all
command and skip test
rules and targets. Is this possible?
I can conceive of two ways to distinguish the tests, either by their type (cc_test in my case), or by pattern-matching on the name, as the project I'm working in suffixes all test rules/targets with "_test".
Please, refrain from making comments telling me that I should always build and run tests upon compilation, unless Bazel actually makes it technically impossible to use "all" wildcard and also filter out all tests. We have a tiered system where builds and tests are all run together, and then after success, another system just builds the minimum artifacts.
Solution
There is bazel query. It's quite powerful so I advise to read through the documentation page to design the query command precisely. To quickly answer your concrete question, I think this will work for you:
bazel query '//... except kind(.*test, //...)' | xargs bazel build
Answered By - hlopko
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.