mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 19:23:33 +08:00
Working on formatting.
This commit is contained in:
@@ -25,4 +25,3 @@ addons:
|
|||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
- cmake
|
- cmake
|
||||||
- astyle
|
|
||||||
|
|||||||
+14
-4
@@ -63,16 +63,26 @@ endif()
|
|||||||
|
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
|
|
||||||
add_custom_target(format
|
set(astyle_exe ${CMAKE_BINARY_DIR}/astyle/src/bin/astyle)
|
||||||
COMMAND scripts/format.sh 1
|
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}
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
|
DEPENDS ${astyle_exe}
|
||||||
VERBATIM
|
VERBATIM
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_target(check_format
|
add_custom_target(format
|
||||||
COMMAND scripts/format.sh
|
COMMAND scripts/format.sh ${astyle_exe} 1
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
VERBATIM
|
VERBATIM
|
||||||
|
DEPENDS ${astyle_exe}
|
||||||
)
|
)
|
||||||
|
|
||||||
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
|
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
|
||||||
|
|||||||
+4
-3
@@ -1,6 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
echo pwd:$PWD
|
echo pwd:$PWD
|
||||||
format=$1
|
astyle=$1
|
||||||
|
format=$2
|
||||||
format_wildcards="""
|
format_wildcards="""
|
||||||
./matrix/*.*pp
|
./matrix/*.*pp
|
||||||
./test/*.*pp
|
./test/*.*pp
|
||||||
@@ -9,10 +10,10 @@ format_wildcards="""
|
|||||||
if [[ $format ]]
|
if [[ $format ]]
|
||||||
then
|
then
|
||||||
echo formatting
|
echo formatting
|
||||||
astyle ${format_wildcards}
|
$astyle ${format_wildcards}
|
||||||
else
|
else
|
||||||
echo checking format
|
echo checking format
|
||||||
astyle --dry-run ${format_wildcards} | grep Formatted
|
$astyle --dry-run ${format_wildcards} | grep Formatted
|
||||||
if [[ $? -eq 0 ]]
|
if [[ $? -eq 0 ]]
|
||||||
then
|
then
|
||||||
echo need to format
|
echo need to format
|
||||||
|
|||||||
Reference in New Issue
Block a user