Skip to content

Commit

Permalink
use same clang-format-lint-action in Makefile and CI
Browse files Browse the repository at this point in the history
  • Loading branch information
bignaux authored and AKuHAK committed Mar 21, 2023
1 parent 6c85d49 commit c3a2ef4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .clang-format-ignore
@@ -1,2 +1,4 @@
./modules/isofs/lz4.c
./modules/isofs/lz4.h
./modules/network/lwNBD
./thirdparty/clang-format-lint-action
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -44,7 +44,8 @@ IOPRP_img.c
#
# 3rd party
#
*modules/network/lwNBD/
*modules/network/lwNBD
*thirdparty/clang-format-lint-action

# language
lng/lang_*.lng
Expand Down
12 changes: 8 additions & 4 deletions Makefile
Expand Up @@ -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 $@
Expand Down Expand Up @@ -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 $< $@

Expand Down
12 changes: 12 additions & 0 deletions download_cfla.sh
@@ -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

0 comments on commit c3a2ef4

Please sign in to comment.