Skip to content

Commit

Permalink
Add format-check, tidy, and tidy-check targets + a check target (and …
Browse files Browse the repository at this point in the history
…a fix target!)

Closes #22.

There are potentially other tools we could use for the tidy target (`run-clang-tidy`; see #35).
Additionally there's `clang-apply-replacements` which remains in the container and in `common.ninja` but isn't used. Intead check is currently just tidy + fmt. This is probably fine.

More words on this in the next commit.
  • Loading branch information
rrbutani committed Oct 20, 2019
1 parent 58ba9a7 commit 7fdd901
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions misc/gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,9 @@ function prelude {
compiler_rt_dir = ${COMPILER_RT_DIR}
newlib_dir = ${NEWLIB_DIR}
# Our placeholder file to fool compdb:
void = \$builddir/\$unused_file
header_search_dirs =$(
for dir in "${include_dirs[@]}"; do
echo -ne " $\n -I$dir"
Expand Down Expand Up @@ -646,11 +649,13 @@ function body {
# $1 : default build type (i.e. debug, release, etc.)
function conclusion {
local files_to_format=$(
local files_to_format
files_to_format=$(
for f in "${object_paths[@]}"; do
{ [[ $f =~ .*\.s$ ]] ||
[[ $f =~ .*\.S$ ]] ||
[[ $f =~ ^\${common_dir}.* ]]; } ||
[[ $f =~ ^\$\{common_dir\}.* ]]; } ||
echo -ne " $\n $(ninja_escaped_string "${f}")"
# echo -ne " $\n '${f}'"
done
Expand Down Expand Up @@ -706,9 +711,21 @@ function conclusion {
build compile_commands.json: compdb
build compdb: phony compile_commands.json
build format: format${files_to_format[@]}
build format: format \$void${files_to_format[@]}
build fmt: phony format
build format-check: format_check \$void${files_to_format[@]}
build fmt-check: phony format-check
build tidy: tidy \$void${files_to_format[@]} $
| compile_commands.json
build tidy-check: tidy_check \$void${files_to_format[@]} $
| compile_commands.json
build fix: phony tidy fmt
build check: phony tidy-check format-check
# A regenerate build statement that runs unconditionally.
build regenerate: regenerate
${regen_docker_flags}
Expand Down

0 comments on commit 7fdd901

Please sign in to comment.