use same clang-format-lint-action in Makefile and CI

pull/896/head^2
Bignaux Ronan 2023-03-19 12:27:57 +01:00 committed by AKuHAK
parent 6c85d49fb9
commit c3a2ef45e1
4 changed files with 24 additions and 5 deletions

View File

@ -1,2 +1,4 @@
./modules/isofs/lz4.c
./modules/isofs/lz4.h
./modules/network/lwNBD
./thirdparty/clang-format-lint-action

3
.gitignore vendored
View File

@ -44,7 +44,8 @@ IOPRP_img.c
#
# 3rd party
#
*modules/network/lwNBD/
*modules/network/lwNBD
*thirdparty/clang-format-lint-action
# language
lng/lang_*.lng

View File

@ -322,11 +322,12 @@ pc_tools_win32:
echo "Building WIN32 iso2opl, opl2iso and genvmc..."
$(MAKE) _WIN32=1 -C pc
format:
find . -type f -a \( -iname \*.h -o -iname \*.c \) | xargs clang-format -i
cfla = "thirdparty/clang-format-lint-action"
format-check: download_cfla
@python3 $(cfla)/run-clang-format.py --clang-format-executable $(cfla)/clang-format/clang-format12 -r .
format-check:
@! find . -type f -a \( -iname \*.h -o -iname \*.c \) | xargs clang-format -style=file -output-replacements-xml | grep "<replacement " >/dev/null
format: download_cfla
@python3 $(cfla)/run-clang-format.py --clang-format-executable $(cfla)/clang-format/clang-format12 -r . -i true
$(EE_ASM_DIR):
@mkdir -p $@
@ -746,6 +747,9 @@ download_lng:
download_lwNBD:
./download_lwNBD.sh
download_cfla:
./download_cfla.sh
$(TRANSLATIONS_LNG): $(LNG_DIR)lang_%.lng: $(LNG_SRC_DIR)%.yml $(BASE_LANGUAGE) $(LANG_COMPILER)
python3 $(LANG_COMPILER) --make_lng --base $(BASE_LANGUAGE) --translation $< $@

12
download_cfla.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
REPO_URL="https://github.com/DoozyX/clang-format-lint-action.git"
REPO_FOLDER="thirdparty/clang-format-lint-action"
COMMIT="c3b2c943e924028b93a707a5b1b017976ab8d50c"
if test ! -d "$REPO_FOLDER"; then
git clone $REPO_URL "$REPO_FOLDER" || { exit 1; }
(cd $REPO_FOLDER && git checkout "$COMMIT" && cd -) || { exit 1; }
else
(cd "$REPO_FOLDER" && git fetch origin && git checkout "$COMMIT" && cd - )|| exit 1
fi