mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-02 05:04:08 +08:00
Working on formatting.
This commit is contained in:
parent
f23bed6823
commit
a703c8169e
@ -25,4 +25,3 @@ addons:
|
||||
apt:
|
||||
packages:
|
||||
- cmake
|
||||
- astyle
|
||||
|
||||
@ -63,16 +63,26 @@ endif()
|
||||
|
||||
add_subdirectory(test)
|
||||
|
||||
add_custom_target(format
|
||||
COMMAND scripts/format.sh 1
|
||||
set(astyle_exe ${CMAKE_BINARY_DIR}/astyle/src/bin/astyle)
|
||||
add_custom_command(OUTPUT ${astyle_exe}
|
||||
COMMAND wget http://sourceforge.net/projects/astyle/files/astyle/astyle%202.05.1/astyle_2.05.1_linux.tar.gz -O /tmp/astyle.tar.gz
|
||||
COMMAND tar -xvf /tmp/astyle.tar.gz
|
||||
COMMAND cd astyle/src && make -f ../build/gcc/Makefile
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
|
||||
add_custom_target(check_format
|
||||
COMMAND scripts/format.sh ${astyle_exe} 0
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
DEPENDS ${astyle_exe}
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
add_custom_target(check_format
|
||||
COMMAND scripts/format.sh
|
||||
add_custom_target(format
|
||||
COMMAND scripts/format.sh ${astyle_exe} 1
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
VERBATIM
|
||||
DEPENDS ${astyle_exe}
|
||||
)
|
||||
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#!/bin/bash
|
||||
echo pwd:$PWD
|
||||
format=$1
|
||||
astyle=$1
|
||||
format=$2
|
||||
format_wildcards="""
|
||||
./matrix/*.*pp
|
||||
./test/*.*pp
|
||||
@ -9,10 +10,10 @@ format_wildcards="""
|
||||
if [[ $format ]]
|
||||
then
|
||||
echo formatting
|
||||
astyle ${format_wildcards}
|
||||
$astyle ${format_wildcards}
|
||||
else
|
||||
echo checking format
|
||||
astyle --dry-run ${format_wildcards} | grep Formatted
|
||||
$astyle --dry-run ${format_wildcards} | grep Formatted
|
||||
if [[ $? -eq 0 ]]
|
||||
then
|
||||
echo need to format
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user