@@ -7,14 +7,9 @@ root=$(git rev-parse --show-toplevel)
7
7
test -d ${root} /cores/esp8266
8
8
test -d ${root} /libraries
9
9
10
- # allow `env CLANG_FORMAT=clang-format-13`, or some other version
11
- # default to v13, latest stable version from https://apt.llvm.org
12
- CLANG_FORMAT=${CLANG_FORMAT:- clang-format-13}
13
-
14
- # TODO: waiting for llvm-14 to allow --style=file:<path-to-file>
15
- makeClangFormatStyle () {
16
- python3 -c ' import sys,yaml; sys.stdout.write(yaml.dump(yaml.safe_load(open(sys.argv[1], "r")), default_flow_style=True)); sys.stdout.flush();' $1
17
- }
10
+ # allow `env CLANG_FORMAT=clang-format-N`, or some other version
11
+ # default to v15, latest stable version from ubuntu-latest Github Actions image
12
+ CLANG_FORMAT=${CLANG_FORMAT:- clang-format-15}
18
13
19
14
# ########################################
20
15
# 'all' variable should be "cores/esp8266 libraries"
@@ -37,14 +32,14 @@ tests
37
32
38
33
cd $root
39
34
40
- style=$( makeClangFormatStyle $ {root} /tests/clang-format-core.yaml)
35
+ style=${root} /tests/clang-format-core.yaml
41
36
for target in $all ; do
42
37
if [ -d " $target " ]; then
43
38
find $target \
44
39
' (' -name " *.cpp" -o -name " *.c" -o -name " *.h" ' )' \
45
- -exec $CLANG_FORMAT --verbose --style=" $style " -i {} \;
40
+ -exec $CLANG_FORMAT --verbose --style=" file: $style " -i {} \;
46
41
else
47
- $CLANG_FORMAT --verbose --style=" $style " -i $target
42
+ $CLANG_FORMAT --verbose --style=" file: $style " -i $target
48
43
fi
49
44
done
50
45
55
50
# exclude=$(git submodule --quiet foreach git rev-parse --show-toplevel | grep libraries)
56
51
57
52
if [ -z $1 ] ; then
58
- style=$( makeClangFormatStyle $ {root} /tests/clang-format-arduino.yaml)
53
+ style=${root} /tests/clang-format-arduino.yaml
59
54
find libraries \
60
55
-path libraries/ESP8266SdFat -prune -o \
61
56
-path libraries/Ethernet -prune -o \
62
57
-path libraries/SoftwareSerial -prune -o \
63
- -name ' *.ino' -exec $CLANG_FORMAT --verbose --style=" $style " -i {} \;
58
+ -name ' *.ino' -exec $CLANG_FORMAT --verbose --style=" file: $style " -i {} \;
64
59
fi
65
60
66
61
# ########################################
0 commit comments