Skip to content

Commit

Permalink
add instructions for hermetic build
Browse files Browse the repository at this point in the history
Sorry, I did forget to update the documentation in my previous PR.
I also did run into a problem with where the .clang-tidy file lies. I also added that to the doc.
  • Loading branch information
adrianimboden authored and erenon committed Nov 21, 2022
1 parent b8c0567 commit 31d62bf
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ bazel build //... \
--@bazel_clang_tidy//:clang_tidy_config=//:clang_tidy_config
```

:exclamation: the config-file will not be forced by adding it to the clang-tidy command line. Therefore it must be in one of the parents of all source files. It is recommended to put it in the root directly besides the WORKSPACE file.


Now if you don't want to type this out every time, it is recommended that you
add a config in your .bazelrc that matches this command line;

Expand All @@ -71,6 +74,13 @@ Now from the command line this is a lot nicer to use;
bazel build //... --config clang-tidy
```

### use a non-system clang-tidy
by default, bazel_clang_tidy uses the system provided clang-tidy.
If you have a hermetic build, you can use your own clang-tidy target like this:
```
build:clang-tidy --@bazel_clang_tidy//:clang_tidy_executable=@local_config_cc//:clangtidy_bin
```

## Features

- Run clang-tidy on any C++ target
Expand Down Expand Up @@ -102,4 +112,3 @@ To see the tool in action:
## Requirements

- Bazel 4.0 or newer (might work with older versions)
- clang-tidy on $PATH. (if not, edit `run_clang_tidy.sh`)

0 comments on commit 31d62bf

Please sign in to comment.