Skip to content

Commit 20bec3d

Browse files
committed
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 [email protected]
1 parent dc84775 commit 20bec3d

File tree

7 files changed

+13
-193
lines changed

7 files changed

+13
-193
lines changed

build/static-checkers/add_cppcheck_for_target.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2015 Samsung Electronics Co., Ltd.
1+
# Copyright 2015-2016 Samsung Electronics Co., Ltd.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
# Cppcheck launcher
16-
set(CMAKE_CPPCHECK ${CMAKE_SOURCE_DIR}/tools/cppcheck/cppcheck.sh)
16+
set(CMAKE_CPPCHECK cppcheck)
1717

1818
# Definition of cppcheck targets
1919
add_custom_target(cppcheck)
@@ -54,6 +54,7 @@
5454
add_custom_target(cppcheck.${TARGET_NAME}
5555
COMMAND ${CMAKE_CPPCHECK} -j8 --error-exitcode=1 --language=c++ --std=c++11
5656
--enable=warning,style,performance,portability,information
57+
--exitcode-suppressions=${CMAKE_SOURCE_DIR}/tools/cppcheck/suppressions-list
5758
${CPPCHECK_DEFINES_LIST} ${CPPCHECK_SOURCES_LIST} ${CPPCHECK_INCLUDES_LIST}
5859
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
5960
else()

docs/DEVELOPMENT.md

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Development
22
### Setting Up Prerequisites
3-
Currently, only Ubuntu 14.04+ officially supported as primary development environment.
3+
Currently, only Ubuntu 14.04+ is officially supported as primary development environment.
44

55
There are several dependencies, that should be installed manually. The following list is required for building:
66
- `gcc` or `g++` higher than `4.8.2`
@@ -9,24 +9,15 @@ There are several dependencies, that should be installed manually. The following
99
- `cmake` higher than `2.8.12.2`
1010
- `make` higher than `3.81`
1111
- `bash` higher than `4.3.11`
12+
- `cppcheck` higher than 1.61
13+
- `vera++` higher than 1.2.1
1214

1315
```bash
14-
sudo apt-get install gcc g++ gcc-arm-none-eabi cmake
15-
```
16-
17-
These tools are required for development:
18-
- `cppcheck` requires `libpcre`
19-
- `vera++` requires `tcl`, `tk` and `boost`
20-
21-
```bash
22-
sudo apt-get install libpcre3 libpcre3-dev
23-
sudo apt-get install tcl8.6 tcl8.6-dev tk8.6-dev libboost-all-dev
16+
sudo apt-get install gcc g++ gcc-arm-none-eabi cmake cppcheck vera++
2417
```
2518

2619
Upon first build, `make` would try to setup prerequisites, required for further development and pre-commit testing:
2720
- STM32F3 and STM32F4 libraries
28-
- cppcheck 1.66
29-
- vera++ 1.2.1
3021

3122
```bash
3223
make prerequisites -j

tools/cppcheck/cppcheck.sh

Lines changed: 0 additions & 29 deletions
This file was deleted.

tools/cppcheck/suppressions-list

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
operatorEqVarError
22
noConstructor
33
duplicateExpression
4+
5+
// FIXME: false positive in cppcheck 1.61 (will disappear once distro ships with 1.69)
6+
variableScope:*/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.cpp

tools/precommit.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
# Copyright 2015 Samsung Electronics Co., Ltd.
3+
# Copyright 2015-2016 Samsung Electronics Co., Ltd.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# 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
4040
VERA_CONFIGURATION_PATH="./tools/vera++"
4141

4242
SOURCES_AND_HEADERS_LIST=`find . -type d \( $VERA_DIRECTORIES_EXCLUDE_LIST \) -prune -or -name "*.c" -or -name "*.cpp" -or -name "*.h"`
43-
./tools/vera++/vera.sh -r $VERA_CONFIGURATION_PATH -p jerry $SOURCES_AND_HEADERS_LIST -e --no-duplicate
43+
vera++ -r $VERA_CONFIGURATION_PATH -p jerry $SOURCES_AND_HEADERS_LIST -e --no-duplicate
4444
STATUS_CODE=$?
4545

4646
if [ $STATUS_CODE -ne 0 ]

tools/prerequisites.sh

Lines changed: 1 addition & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
# Copyright 2015 Samsung Electronics Co., Ltd.
3+
# Copyright 2015-2016 Samsung Electronics Co., Ltd.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -99,114 +99,6 @@ function setup_from_zip() {
9999
chmod -R u-w "$DEST" || fail_msg "$FAIL_MSG. Failed to remove write permission from '$DEST' directory contents."
100100
}
101101

102-
function setup_cppcheck() {
103-
NAME="$1"
104-
shift
105-
106-
DEST=$(pwd)/"$1"
107-
shift
108-
109-
URL="$1"
110-
shift
111-
112-
CHECKSUM="$1"
113-
shift
114-
115-
FAIL_MSG="Failed to setup '$NAME' prerequisite"
116-
117-
if [ "$CLEAN_MODE" == "no" ]
118-
then
119-
echo "$CHECKSUM $NAME" >> $TMP_DIR/.prerequisites
120-
grep -q "^$CHECKSUM $NAME\$" $TMP_DIR/.prerequisites.prev && return 0
121-
122-
echo "Setting up $NAME prerequisite"
123-
fi
124-
125-
if [ -e "$DEST" ]
126-
then
127-
chmod -R u+w "$DEST" || fail_msg "$FAIL_MSG. Failed to add write permission to '$DEST' directory contents."
128-
rm -rf "$DEST" || fail_msg "$FAIL_MSG. Cannot remove '$DEST' directory."
129-
fi
130-
131-
if [ "$CLEAN_MODE" == "yes" ]
132-
then
133-
return 0
134-
fi
135-
136-
wget --no-check-certificate -O "$TMP_DIR/$NAME.tar.bz2" "$URL" || fail_msg "$FAIL_MSG. Cannot download '$URL' archive."
137-
138-
echo "$CHECKSUM $TMP_DIR/$NAME.tar.bz2" | $SHA256SUM --check || fail_msg "$FAIL_MSG. Archive's checksum doesn't match."
139-
140-
tar xjvf "$TMP_DIR/$NAME.tar.bz2" -C "$TMP_DIR" || fail_msg "$FAIL_MSG. Failed to unpack archive."
141-
142-
(
143-
cd "$TMP_DIR/$NAME" || exit 1
144-
make -j HAVE_RULES=yes CFGDIR="$DEST/cfg" || exit 1
145-
) || fail_msg "$FAIL_MSG. Failed to build cppcheck."
146-
147-
mkdir "$DEST" || fail_msg "$FAIL_MSG. Failed to create '$DEST' directory."
148-
mkdir "$DEST/cfg" || fail_msg "$FAIL_MSG. Failed to create '$DEST/cfg' directory."
149-
150-
cp "$TMP_DIR/$NAME/cppcheck" "$DEST" || fail_msg "$FAIL_MSG. Failed to copy cppcheck to '$DEST' directory."
151-
cp "$TMP_DIR/$NAME/cfg/std.cfg" "$DEST/cfg" || fail_msg "$FAIL_MSG. Failed to copy cfg/std.cfg to '$DEST/cfg' directory."
152-
153-
remove_gitignore_files_at "$DEST"
154-
chmod -R u-w "$DEST" || fail_msg "$FAIL_MSG. Failed to remove write permission from '$DEST' directory contents."
155-
}
156-
157-
function setup_vera() {
158-
NAME="$1"
159-
shift
160-
161-
DEST=$(pwd)/"$1"
162-
shift
163-
164-
URL="$1"
165-
shift
166-
167-
CHECKSUM="$1"
168-
shift
169-
170-
FAIL_MSG="Failed to setup '$NAME' prerequisite"
171-
172-
if [ "$CLEAN_MODE" == "no" ]
173-
then
174-
echo "$CHECKSUM $NAME" >> $TMP_DIR/.prerequisites
175-
grep -q "^$CHECKSUM $NAME\$" $TMP_DIR/.prerequisites.prev && return 0
176-
177-
echo "Setting up $NAME prerequisite"
178-
fi
179-
180-
if [ -e "$DEST" ]
181-
then
182-
chmod -R u+w "$DEST" || fail_msg "$FAIL_MSG. Failed to add write permission to '$DEST' directory contents."
183-
rm -rf "$DEST" || fail_msg "$FAIL_MSG. Cannot remove '$DEST' directory."
184-
fi
185-
186-
if [ "$CLEAN_MODE" == "yes" ]
187-
then
188-
return 0
189-
fi
190-
191-
wget --no-check-certificate -O "$TMP_DIR/$NAME.tar.gz" "$URL" || fail_msg "$FAIL_MSG. Cannot download '$URL' archive."
192-
193-
echo "$CHECKSUM $TMP_DIR/$NAME.tar.gz" | $SHA256SUM --check || fail_msg "$FAIL_MSG. Archive's checksum doesn't match."
194-
195-
tar xzvf "$TMP_DIR/$NAME.tar.gz" -C "$TMP_DIR" || fail_msg "$FAIL_MSG. Failed to unpack archive."
196-
197-
(
198-
cd "$TMP_DIR/$NAME" || exit 1
199-
mkdir build || exit 1
200-
cd build || exit 1
201-
cmake .. -DCMAKE_INSTALL_PREFIX="$DEST" || exit 1
202-
make -j || exit 1
203-
make install || exit 1
204-
) || fail_msg "$FAIL_MSG. Failed to build vera++ 1.2.1."
205-
206-
remove_gitignore_files_at "$DEST"
207-
chmod -R u-w "$DEST" || fail_msg "$FAIL_MSG. Failed to remove write permission from '$DEST' directory contents."
208-
}
209-
210102
HOST_OS=`uname -s`
211103

212104
if [ "$HOST_OS" == "Darwin" ]
@@ -238,16 +130,6 @@ setup_from_zip "stm32f4" \
238130
"8e67f7b930c6c02bd7f89a266c8d1cae3b530510b7979fbfc0ee0d57e7f88b81" \
239131
"STM32F4-Discovery_FW_V1.1.0/*"
240132

241-
setup_cppcheck "cppcheck-1.69" \
242-
"./third-party/cppcheck" \
243-
"http://downloads.sourceforge.net/project/cppcheck/cppcheck/1.69/cppcheck-1.69.tar.bz2" \
244-
"4bd5c8031258ef29764a4c92666384238a625beecbb2aceeb7065ec388c7532e"
245-
246-
setup_vera "vera++-1.2.1" \
247-
"./third-party/vera++" \
248-
"https://bitbucket.org/verateam/vera/downloads/vera++-1.2.1.tar.gz" \
249-
"99b123c8f6d0f4fe9ee90397c461179066a36ed0d598d95e015baf2d3b56956b"
250-
251133
if [ "$CLEAN_MODE" == "no" ]
252134
then
253135
mv $TMP_DIR/.prerequisites $PREREQUISITES_INSTALLED_LIST_FILE || fail_msg "Failed to write '$PREREQUISITES_INSTALLED_LIST_FILE'"

tools/vera++/vera.sh

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)