Remove cppcheck and vera++ from prerequisites

Rely on platform-provided versions. Thus, no need to download and
build them, neither to wrap them with shell scripts. CMake and
precommit updated to call the new tools. Development documentation
also updated/simplified.

PS: On my Ubuntu 14.04.3, cppcheck has version 1.61, while prereq
version was 1.69. The older version reports and fails on a strange
style issue in ecma/builtin-objects/ecma-builtin-helpers.cpp, for
which the only solution found was to suppress the cppcheck errors
with `variableScope` id for that file.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
Akos Kiss 2016-02-10 23:17:32 +01:00
parent dc84775207
commit 20bec3d73f
7 changed files with 13 additions and 193 deletions

View File

@ -1,4 +1,4 @@
# Copyright 2015 Samsung Electronics Co., Ltd.
# Copyright 2015-2016 Samsung Electronics Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -13,7 +13,7 @@
# limitations under the License.
# Cppcheck launcher
set(CMAKE_CPPCHECK ${CMAKE_SOURCE_DIR}/tools/cppcheck/cppcheck.sh)
set(CMAKE_CPPCHECK cppcheck)
# Definition of cppcheck targets
add_custom_target(cppcheck)
@ -54,6 +54,7 @@
add_custom_target(cppcheck.${TARGET_NAME}
COMMAND ${CMAKE_CPPCHECK} -j8 --error-exitcode=1 --language=c++ --std=c++11
--enable=warning,style,performance,portability,information
--exitcode-suppressions=${CMAKE_SOURCE_DIR}/tools/cppcheck/suppressions-list
${CPPCHECK_DEFINES_LIST} ${CPPCHECK_SOURCES_LIST} ${CPPCHECK_INCLUDES_LIST}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
else()

View File

@ -1,6 +1,6 @@
## Development
### Setting Up Prerequisites
Currently, only Ubuntu 14.04+ officially supported as primary development environment.
Currently, only Ubuntu 14.04+ is officially supported as primary development environment.
There are several dependencies, that should be installed manually. The following list is required for building:
- `gcc` or `g++` higher than `4.8.2`
@ -9,24 +9,15 @@ There are several dependencies, that should be installed manually. The following
- `cmake` higher than `2.8.12.2`
- `make` higher than `3.81`
- `bash` higher than `4.3.11`
- `cppcheck` higher than 1.61
- `vera++` higher than 1.2.1
```bash
sudo apt-get install gcc g++ gcc-arm-none-eabi cmake
```
These tools are required for development:
- `cppcheck` requires `libpcre`
- `vera++` requires `tcl`, `tk` and `boost`
```bash
sudo apt-get install libpcre3 libpcre3-dev
sudo apt-get install tcl8.6 tcl8.6-dev tk8.6-dev libboost-all-dev
sudo apt-get install gcc g++ gcc-arm-none-eabi cmake cppcheck vera++
```
Upon first build, `make` would try to setup prerequisites, required for further development and pre-commit testing:
- STM32F3 and STM32F4 libraries
- cppcheck 1.66
- vera++ 1.2.1
```bash
make prerequisites -j

View File

@ -1,29 +0,0 @@
#!/bin/bash
# Copyright 2014-2015 Samsung Electronics Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
REPOSITORY_DIR=$(dirname $0)/../..
CPPCHECK=$REPOSITORY_DIR/third-party/cppcheck/cppcheck
SUPPRESSIONS_LIST=$(dirname $0)/suppressions-list
if [ ! -x $CPPCHECK ]
then
exit 1;
fi
$CPPCHECK "$@" "--exitcode-suppressions=$SUPPRESSIONS_LIST"
status_code=$?
exit $status_code

View File

@ -1,3 +1,6 @@
operatorEqVarError
noConstructor
duplicateExpression
// FIXME: false positive in cppcheck 1.61 (will disappear once distro ships with 1.69)
variableScope:*/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.cpp

View File

@ -1,6 +1,6 @@
#!/bin/bash
# Copyright 2015 Samsung Electronics Co., Ltd.
# Copyright 2015-2016 Samsung Electronics Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -40,7 +40,7 @@ VERA_DIRECTORIES_EXCLUDE_LIST="-path ./third-party -o -path tests -o -path ./tar
VERA_CONFIGURATION_PATH="./tools/vera++"
SOURCES_AND_HEADERS_LIST=`find . -type d \( $VERA_DIRECTORIES_EXCLUDE_LIST \) -prune -or -name "*.c" -or -name "*.cpp" -or -name "*.h"`
./tools/vera++/vera.sh -r $VERA_CONFIGURATION_PATH -p jerry $SOURCES_AND_HEADERS_LIST -e --no-duplicate
vera++ -r $VERA_CONFIGURATION_PATH -p jerry $SOURCES_AND_HEADERS_LIST -e --no-duplicate
STATUS_CODE=$?
if [ $STATUS_CODE -ne 0 ]

View File

@ -1,6 +1,6 @@
#!/bin/bash
# Copyright 2015 Samsung Electronics Co., Ltd.
# Copyright 2015-2016 Samsung Electronics Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -99,114 +99,6 @@ function setup_from_zip() {
chmod -R u-w "$DEST" || fail_msg "$FAIL_MSG. Failed to remove write permission from '$DEST' directory contents."
}
function setup_cppcheck() {
NAME="$1"
shift
DEST=$(pwd)/"$1"
shift
URL="$1"
shift
CHECKSUM="$1"
shift
FAIL_MSG="Failed to setup '$NAME' prerequisite"
if [ "$CLEAN_MODE" == "no" ]
then
echo "$CHECKSUM $NAME" >> $TMP_DIR/.prerequisites
grep -q "^$CHECKSUM $NAME\$" $TMP_DIR/.prerequisites.prev && return 0
echo "Setting up $NAME prerequisite"
fi
if [ -e "$DEST" ]
then
chmod -R u+w "$DEST" || fail_msg "$FAIL_MSG. Failed to add write permission to '$DEST' directory contents."
rm -rf "$DEST" || fail_msg "$FAIL_MSG. Cannot remove '$DEST' directory."
fi
if [ "$CLEAN_MODE" == "yes" ]
then
return 0
fi
wget --no-check-certificate -O "$TMP_DIR/$NAME.tar.bz2" "$URL" || fail_msg "$FAIL_MSG. Cannot download '$URL' archive."
echo "$CHECKSUM $TMP_DIR/$NAME.tar.bz2" | $SHA256SUM --check || fail_msg "$FAIL_MSG. Archive's checksum doesn't match."
tar xjvf "$TMP_DIR/$NAME.tar.bz2" -C "$TMP_DIR" || fail_msg "$FAIL_MSG. Failed to unpack archive."
(
cd "$TMP_DIR/$NAME" || exit 1
make -j HAVE_RULES=yes CFGDIR="$DEST/cfg" || exit 1
) || fail_msg "$FAIL_MSG. Failed to build cppcheck."
mkdir "$DEST" || fail_msg "$FAIL_MSG. Failed to create '$DEST' directory."
mkdir "$DEST/cfg" || fail_msg "$FAIL_MSG. Failed to create '$DEST/cfg' directory."
cp "$TMP_DIR/$NAME/cppcheck" "$DEST" || fail_msg "$FAIL_MSG. Failed to copy cppcheck to '$DEST' directory."
cp "$TMP_DIR/$NAME/cfg/std.cfg" "$DEST/cfg" || fail_msg "$FAIL_MSG. Failed to copy cfg/std.cfg to '$DEST/cfg' directory."
remove_gitignore_files_at "$DEST"
chmod -R u-w "$DEST" || fail_msg "$FAIL_MSG. Failed to remove write permission from '$DEST' directory contents."
}
function setup_vera() {
NAME="$1"
shift
DEST=$(pwd)/"$1"
shift
URL="$1"
shift
CHECKSUM="$1"
shift
FAIL_MSG="Failed to setup '$NAME' prerequisite"
if [ "$CLEAN_MODE" == "no" ]
then
echo "$CHECKSUM $NAME" >> $TMP_DIR/.prerequisites
grep -q "^$CHECKSUM $NAME\$" $TMP_DIR/.prerequisites.prev && return 0
echo "Setting up $NAME prerequisite"
fi
if [ -e "$DEST" ]
then
chmod -R u+w "$DEST" || fail_msg "$FAIL_MSG. Failed to add write permission to '$DEST' directory contents."
rm -rf "$DEST" || fail_msg "$FAIL_MSG. Cannot remove '$DEST' directory."
fi
if [ "$CLEAN_MODE" == "yes" ]
then
return 0
fi
wget --no-check-certificate -O "$TMP_DIR/$NAME.tar.gz" "$URL" || fail_msg "$FAIL_MSG. Cannot download '$URL' archive."
echo "$CHECKSUM $TMP_DIR/$NAME.tar.gz" | $SHA256SUM --check || fail_msg "$FAIL_MSG. Archive's checksum doesn't match."
tar xzvf "$TMP_DIR/$NAME.tar.gz" -C "$TMP_DIR" || fail_msg "$FAIL_MSG. Failed to unpack archive."
(
cd "$TMP_DIR/$NAME" || exit 1
mkdir build || exit 1
cd build || exit 1
cmake .. -DCMAKE_INSTALL_PREFIX="$DEST" || exit 1
make -j || exit 1
make install || exit 1
) || fail_msg "$FAIL_MSG. Failed to build vera++ 1.2.1."
remove_gitignore_files_at "$DEST"
chmod -R u-w "$DEST" || fail_msg "$FAIL_MSG. Failed to remove write permission from '$DEST' directory contents."
}
HOST_OS=`uname -s`
if [ "$HOST_OS" == "Darwin" ]
@ -238,16 +130,6 @@ setup_from_zip "stm32f4" \
"8e67f7b930c6c02bd7f89a266c8d1cae3b530510b7979fbfc0ee0d57e7f88b81" \
"STM32F4-Discovery_FW_V1.1.0/*"
setup_cppcheck "cppcheck-1.69" \
"./third-party/cppcheck" \
"http://downloads.sourceforge.net/project/cppcheck/cppcheck/1.69/cppcheck-1.69.tar.bz2" \
"4bd5c8031258ef29764a4c92666384238a625beecbb2aceeb7065ec388c7532e"
setup_vera "vera++-1.2.1" \
"./third-party/vera++" \
"https://bitbucket.org/verateam/vera/downloads/vera++-1.2.1.tar.gz" \
"99b123c8f6d0f4fe9ee90397c461179066a36ed0d598d95e015baf2d3b56956b"
if [ "$CLEAN_MODE" == "no" ]
then
mv $TMP_DIR/.prerequisites $PREREQUISITES_INSTALLED_LIST_FILE || fail_msg "Failed to write '$PREREQUISITES_INSTALLED_LIST_FILE'"

View File

@ -1,28 +0,0 @@
#!/bin/bash
# Copyright 2015 Samsung Electronics Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
REPOSITORY_DIR=$(dirname $0)/../..
VERA=$REPOSITORY_DIR/third-party/vera++/bin/vera++
if [ ! -x $VERA ]
then
exit 1;
fi
$VERA "$@"
status_code=$?
exit $status_code