Fwd: Any example on how to use per_file_opt?

21 views
Skip to first unread message

Minjie Fang

unread,
Jul 2, 2021, 9:06:04 AM7/2/21
to bazel-...@googlegroups.com
Hello, I have a question about how to use the bazel build option 'per_file_opt' correctly.
Say I have several directories in my repository like math/, common/ that I want to compile with copts -Wall, -Werror, but all the code in third_party/ and from external repos introduced in WORKSPACE that need to be excluded.

My current solution is to verbosely list all directories that need copts:
`build --per_file_opt=+//(common|map|math)/.*@-Wall,-Werror`.

I'm wondering if there is a blacklisting way to do this? Something like 
`build --per_file_opt=-external|third_party@-Wall,-Werror`?

I've tried several regex combinations but none would work. Hope I can get some help from you, much appreciated!
Reply all
Reply to author
Forward
0 new messages