mirror of
https://github.com/espressif/openthread.git
synced 2026-06-06 05:24:51 +00:00
Wrap astyle to return a non-zero error code when style checking fails. (#189)
This commit is contained in:
Executable
+44
@@ -0,0 +1,44 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2016, Nest Labs, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. Neither the name of the copyright holder nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
#
|
||||
# astye does not return a non-zero exit code. This wrapper exists with a
|
||||
# non-zero exit code if there is any output from astyle.
|
||||
#
|
||||
|
||||
die() {
|
||||
echo " *** ERROR: " $*
|
||||
exit 1
|
||||
}
|
||||
|
||||
set -x
|
||||
|
||||
[ -z `$@` ] || {
|
||||
[ $@ =~ .*dry-run.* ] || die
|
||||
}
|
||||
+1
-1
@@ -39,7 +39,7 @@ set -x
|
||||
[ $BUILD_TARGET != pretty-check ] || {
|
||||
export PATH=/tmp/astyle/build/gcc/bin:$PATH || die
|
||||
./configure || die
|
||||
make pretty || die
|
||||
make pretty-check || die
|
||||
}
|
||||
|
||||
[ $BUILD_TARGET != posix ] || {
|
||||
|
||||
+2
-1
@@ -47,7 +47,8 @@ SUBDIRS = \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DIST = \
|
||||
.astyle-opts \
|
||||
.astyle/astyle-opts \
|
||||
.astyle/astyle-wrap.sh \
|
||||
.default-version \
|
||||
bootstrap \
|
||||
bootstrap-configure \
|
||||
|
||||
+3
-3
@@ -268,9 +268,9 @@ AM_CONDITIONAL([OPENTHREAD_BUILD_OPTIMIZED], [test "${nl_cv_build_optimized}" =
|
||||
# Code style
|
||||
#
|
||||
|
||||
AC_CHECK_TOOL(ASTYLE, astyle)
|
||||
AC_SUBST(ASTYLE_PRETTY_ARGS, ["--options=\${abs_top_builddir}/.astyle-opts"])
|
||||
AC_SUBST(ASTYLE_PRETTY_CHECK_ARGS, ["--options=\${abs_top_builddir}/.astyle-opts --dry-run"])
|
||||
AC_SUBST(ASTYLE, ["\${abs_top_srcdir}/.astyle/astyle-wrap.sh"])
|
||||
AC_SUBST(ASTYLE_PRETTY_ARGS, ["astyle --options=\${abs_top_builddir}/.astyle/astyle-opts"])
|
||||
AC_SUBST(ASTYLE_PRETTY_CHECK_ARGS, ["astyle --options=\${abs_top_builddir}/.astyle/astyle-opts --dry-run"])
|
||||
|
||||
#
|
||||
# Tests
|
||||
|
||||
Reference in New Issue
Block a user