Skip to content

Commit

Permalink
tools: update to clang-format-10
Browse files Browse the repository at this point in the history
  • Loading branch information
julianoes committed Oct 1, 2020
1 parent 5c80b44 commit 34f3af9
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 15 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ jobs:
- name: test (mavsdk_server)
run: ./build/release/src/backend/test/unit_tests_backend

ubuntu18-proto-check:
name: ubuntu-18.04 (proto check)
runs-on: ubuntu-18.04
ubuntu20-proto-check:
name: ubuntu-20.04 (proto check)
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: install clang-format
run: sudo apt-get install -y clang-format-9
run: sudo apt-get install -y clang-format-10
- name: install dcsdkgen
run: |
cd proto/pb_plugins
Expand All @@ -99,14 +99,15 @@ jobs:
- name: check for diff
run: git diff --exit-code

ubuntu18-check-style:
name: ubuntu-18.04 (check style and docs)
runs-on: ubuntu-18.04
container: mavsdk/mavsdk-ubuntu-18.04
ubuntu20-check-style:
name: ubuntu-20.04 (check style and docs)
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: install dependencies
run: sudo apt-get install -y doxygen clang-format-10
- name: check style
run: ./tools/fix_style.sh .
- name: check docs
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile-Ubuntu-18.04
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN apt-get update \
build-essential \
ca-certificates \
ccache \
clang-format-9 \
clang-format-10 \
cmake \
colordiff \
doxygen \
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile-Ubuntu-20.04
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN apt-get update \
build-essential \
ca-certificates \
ccache \
clang-format-9 \
clang-format-10 \
cmake \
colordiff \
doxygen \
Expand Down
10 changes: 6 additions & 4 deletions tools/fix_style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
# This script runs clang-format over all files ending in .h, .c, .cpp listed
# by git in the given directory.

version_required_major="9"
version_required_major="10"

# Try to find the latest version of clang
if command -v clang-format-9 >/dev/null; then
if command -v clang-format-10 >/dev/null; then
clang_format=clang-format-10
elif command -v clang-format-9 >/dev/null; then
clang_format=clang-format-9
elif command -v clang-format-8 >/dev/null; then
clang_format=clang-format-8
Expand All @@ -27,14 +29,14 @@ if [[ $version =~ $semver_regex ]]; then
version_major=${BASH_REMATCH[1]}
if [ "$version_required_major" -gt "$version_major" ]; then
echo "Clang version $version_major too old (required: $version_required_major)"
echo "You can use clang-format-9 from docker:"
echo "You can use clang-format-10 from docker:"
echo ""
echo " 'tools/run-docker.sh tools/fix_style.sh .'"
exit 1

elif [ "$version_required_major" -lt "$version_major" ]; then
echo "Clang version $version_major too new (required: $version_required_major)"
echo "You can use clang-format-9 from docker:"
echo "You can use clang-format-10 from docker:"
echo ""
echo " 'tools/run-docker.sh tools/fix_style.sh .'"
exit 1
Expand Down
2 changes: 1 addition & 1 deletion tools/run-docker.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env sh

docker run -it --rm -v $(pwd):/home/user/MAVSDK:z -e LOCAL_USER_ID=`id -u` mavsdk/mavsdk-ubuntu-18.04-px4-sitl-v1.10 "$@"
docker run -it --rm -v $(pwd):/home/user/MAVSDK:z -e LOCAL_USER_ID=`id -u` mavsdk/mavsdk-ubuntu-20.04-px4-sitl-v1.11 "$@"

0 comments on commit 34f3af9

Please sign in to comment.