[size-report] support local check (#4866)

This commit is contained in:
Yakun Xu
2020-04-22 06:37:46 +08:00
committed by GitHub
parent 85f40acbe4
commit c034fd0c0c
3 changed files with 127 additions and 64 deletions
+17 -18
View File
@@ -31,27 +31,23 @@
# example compilation and programming.
#
die()
{
echo " *** ERROR: " $*
exit 1
}
set -e
install_packages_apt()
{
# apt update and install dependencies
sudo apt-get update || die
sudo apt-get --no-install-recommends install -y automake g++ libtool lsb-release make cmake ninja-build || die
sudo apt-get update
sudo apt-get --no-install-recommends install -y automake g++ libtool lsb-release make cmake ninja-build
PLATFORM=$(lsb_release -is)
if [ $PLATFORM = "Raspbian" ]; then
sudo apt-get --no-install-recommends install -y binutils-arm-none-eabi gcc-arm-none-eabi gdb-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib || die
if [ "$PLATFORM" = "Raspbian" ]; then
sudo apt-get --no-install-recommends install -y binutils-arm-none-eabi gcc-arm-none-eabi gdb-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib
else
# add gcc-arm-embedded ppa
sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa -y || die
sudo apt-get update || die
sudo apt-get --no-install-recommends install -y gcc-arm-embedded || die
sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa -y
sudo apt-get update
sudo apt-get --no-install-recommends install -y gcc-arm-embedded
fi
# add clang-format for pretty
@@ -59,6 +55,9 @@ install_packages_apt()
# add yapf for pretty
python3 -m pip install yapf || echo 'Failed to install python code formatter yapf. Install it manually if you need.'
# add mdv for local size report
python3 -m pip install mdv || echo 'Failed to install markdown render. Install it manually if you need.'
}
install_packages_opkg()
@@ -81,14 +80,14 @@ install_packages_brew()
brew install arm-none-eabi-gcc
# check for gcc for simulation
if ! which gcc; then
if ! command -v gcc; then
echo 'warning: clang/gcc needed for simulation'
echo 'warning: please install Command Line Tools from https://developer.apple.com/download/more/'
fi
# add clang-format for pretty
CLANG_FORMAT_VERSION="clang-format version 6.0"
which clang-format-6.0 || (which clang-format && (clang-format --version | grep -q "${CLANG_FORMAT_VERSION}")) || {
command -v clang-format-6.0 || (command -v clang-format && (clang-format --version | grep -q "${CLANG_FORMAT_VERSION}")) || {
brew install llvm@6
sudo ln -s "$(brew --prefix llvm@6)/bin/clang-format" /usr/local/bin/clang-format-6.0
}
@@ -105,13 +104,13 @@ install_packages_source()
install_packages()
{
PM=source
if which apt-get; then
if command -v apt-get; then
PM=apt
elif which rpm; then
elif command -v rpm; then
PM=rpm
elif which opkg; then
elif command -v opkg; then
PM=opkg
elif which brew; then
elif command -v brew; then
PM=brew
fi
install_packages_$PM