Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add checking and verification support for includes using IWYU #23092

Merged
merged 16 commits into from
Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@ function show_help() {
echo "Example: $SCRIPT_NAME --tizen-sdk-path ~/tizen-sdk --tizen-version 6.0 --install-dependencies"
echo
echo "Options:"
echo " --help Display this information"
echo " -h, --help Display this information"
echo " --tizen-sdk-path Set directory where Tizen will be installed. Default is $TIZEN_SDK_ROOT"
echo " --tizen-sdk-data-path Set directory where Tizen have data. Default is $TIZEN_SDK_DATA_PATH"
echo " --install-dependencies This options install all dependencies."
echo " --tizen-version Select Tizen version. Default is $TIZEN_VERSION"
echo " --override-secret-tool Without password manager circumvents the requirement of having functional D-Bus Secrets service"
echo " --override-secret-tool Circumvent the requirement of having functional D-Bus Secrets service."
echo
echo "Note:"
echo "The script should run fully with ubuntu. For other distributions you may have to manually"
echo "install all needed dependencies. Use the script specifying --tizen-sdk-path with or"
echo "without --tizen-version. The script will only install the tizen platform for Matter."
echo "without --tizen-version. The script will only install Tizen platform for Matter."
}

# ------------------------------------------------------------------------------
Expand All @@ -66,7 +66,7 @@ function error() {
# ------------------------------------------------------------------------------
# Info print function
function info() {
echo "$COLOR_GREEN$1$COLOR_NONE"
echo "$COLOR_GREEN[INFO]: $1$COLOR_NONE"
}

# ------------------------------------------------------------------------------
Expand All @@ -78,7 +78,7 @@ function warning() {
# ------------------------------------------------------------------------------
# Show dependencies
function show_dependencies() {
warning "Need dependencies for use this script installation SDK: cpio wget unzip unrpm"
warning "Need dependencies for use this script installation SDK: cpio unrpm unzip wget"
warning "Need dependencies for Tizen SDK: JAVA JRE >=8.0"
}

Expand Down Expand Up @@ -135,10 +135,11 @@ function install_tizen_sdk() {

TIZEN_SDK_SYSROOT="$TIZEN_SDK_ROOT/platforms/tizen-$TIZEN_VERSION/mobile/rootstraps/mobile-$TIZEN_VERSION-device.core"

# Get tizen studio CLI
info "Get tizen studio CLI [...]"
cd "$TMP_DIR" || return

# Get Tizen Studio CLI
info "Downloading Tizen Studio CLI..."

# Download
URL="http://download.tizen.org/sdk/tizenstudio/official/binary/"
PKG_ARR=(
Expand All @@ -150,7 +151,7 @@ function install_tizen_sdk() {
download "$URL" "${PKG_ARR[@]}"

# Get toolchain
info "Get toolchain"
info "Downloading Tizen toolchain..."

# Download
URL="http://download.tizen.org/sdk/tizenstudio/official/binary/"
Expand All @@ -159,11 +160,11 @@ function install_tizen_sdk() {
"sbi-toolchain-gcc-9.2.cpp.app_2.2.16_ubuntu-64.zip")
download "$URL" "${PKG_ARR[@]}"

# Get tizen sysroot
info "Get tizen sysroot"
# Get Tizen sysroot
info "Downloading Tizen sysroot..."

# Base sysroot
# Different versions of tizen have different rootstrap versions
# Different versions of Tizen have different rootstrap versions
URL="http://download.tizen.org/sdk/tizenstudio/official/binary/"
PKG_ARR=(
"mobile-$TIZEN_VERSION-core-add-ons_*_ubuntu-64.zip"
Expand Down Expand Up @@ -224,7 +225,7 @@ function install_tizen_sdk() {
download "$URL" "${PKG_ARR[@]}"

# Install all
info "Installation Tizen SDK [...]"
info "Installing Tizen SDK..."

unzip -o '*.zip'
cp -rf data/* "$TIZEN_SDK_ROOT"
Expand All @@ -234,12 +235,12 @@ function install_tizen_sdk() {

# Install secret tool or not
if ("$SECRET_TOOL"); then
info "Override secret tool"
info "Overriding secret tool..."
cp "$SCRIPT_DIR/secret-tool.py" "$TIZEN_SDK_ROOT/tools/certificate-encryptor/secret-tool"
chmod 0755 "$TIZEN_SDK_ROOT/tools/certificate-encryptor/secret-tool"
fi

# Configure tizen cli
# Configure Tizen CLI
echo "TIZEN_SDK_INSTALLED_PATH=$TIZEN_SDK_ROOT" >"$TIZEN_SDK_ROOT/sdk.info"
echo "TIZEN_SDK_DATA_PATH=$TIZEN_SDK_DATA_PATH" >>"$TIZEN_SDK_ROOT/sdk.info"
ln -sf "$TIZEN_SDK_DATA_PATH/.tizen-cli-config" "$TIZEN_SDK_ROOT/tools/.tizen-cli-config"
Expand All @@ -251,9 +252,12 @@ function install_tizen_sdk() {
ln -sf ../../lib/libcap.so.2 "$TIZEN_SDK_SYSROOT/usr/lib/libcap.so"
ln -sf openssl1.1.pc "$TIZEN_SDK_SYSROOT/usr/lib/pkgconfig/openssl.pc"

info "Done."
echo

# Information on necessary environment variables
warning "You must add the appropriate environment variables before proceeding with matter."
echo "$COLOR_YELLOW"
warning "Before proceeding with Matter export environment variables as follows:"
echo -n "$COLOR_YELLOW"
echo "export TIZEN_VESRSION=\"$TIZEN_VERSION\""
echo "export TIZEN_SDK_ROOT=\"$(realpath "$TIZEN_SDK_ROOT")\""
echo "export TIZEN_SDK_TOOLCHAIN=\"\$TIZEN_SDK_ROOT/tools/arm-linux-gnueabi-gcc-9.2\""
Expand All @@ -264,7 +268,7 @@ function install_tizen_sdk() {

while (($#)); do
case $1 in
--help)
-h | --help)
show_help
exit 0
;;
Expand Down Expand Up @@ -308,20 +312,19 @@ if [ "$INSTALL_DEPENDENCIES" = true ]; then
show_dependencies
exit 1
fi
else
show_dependencies
fi

# ------------------------------------------------------------------------------
# Checking dependencies needed to install the tizen platform
for PKG in 'cpio' 'unzip' 'wget' 'unrpm'; do
# Checking dependencies needed to install Tizen platform
info "Checking required tools: cpio, java, unrpm, unzip, wget"
for PKG in 'cpio' 'java' 'unrpm' 'unzip' 'wget'; do
if ! command -v "$PKG" &>/dev/null; then
warning "Not found $PKG"
error "Required tool not found: $PKG"
dep_lost=1
fi
done
if [[ $dep_lost ]]; then
error "You need install dependencies before [HINT]: On Ubuntu-like distro run: sudo apt install ${DEPENDENCIES[@]}"
echo "[HINT]: sudo apt-get install ${DEPENDENCIES[*]}"
exit 1
fi

Expand Down
1 change: 1 addition & 0 deletions integrations/docker/images/chip-build-vscode/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ ENV ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb

ENV TIZEN_VERSION 6.0
ENV TIZEN_SDK_ROOT /opt/tizen-sdk
ENV TIZEN_SDK_TOOLCHAIN $TIZEN_SDK_ROOT/tools/arm-linux-gnueabi-gcc-9.2
ENV TIZEN_SDK_SYSROOT $TIZEN_SDK_ROOT/platforms/tizen-$TIZEN_VERSION/mobile/rootstraps/mobile-$TIZEN_VERSION-device.core

ENV FVP_CORSTONE_300_PATH=/opt/FVP_Corstone_SSE-300
Expand Down
21 changes: 21 additions & 0 deletions integrations/docker/images/chip-build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,22 @@ RUN set -x \
clang \
clang-format \
clang-tidy \
clang-12 \
curl \
flex \
g++ \
git \
git-lfs \
gperf \
iproute2 \
iwyu \
jq \
lcov \
libavahi-client-dev \
libavahi-common-dev \
libcairo-dev \
libcairo2-dev \
libclang-12-dev \
libdbus-1-dev \
libdbus-glib-1-dev \
libdmalloc-dev \
Expand Down Expand Up @@ -120,6 +123,24 @@ RUN set -x \
&& rm -rf bloaty \
&& : # last line

# Need newer version of include-what-you-use
# iwyu_tool default use python from env must be linked
RUN set -x \
&& ln -s /usr/bin/python3 /usr/bin/python \
&& cd /tmp \
&& git clone https://github.com/include-what-you-use/include-what-you-use.git \
&& cd include-what-you-use \
&& git checkout clang_12 \
&& cp -Rf iwyu_tool.py /bin/iwyu_tool \
&& mkdir build \
&& cd build \
&& cmake -G "Unix Makefiles" -DCMAKE_PREFIX_PATH=/usr/lib/llvm-12 .. \
&& make \
&& cp -Rf bin /usr \
&& cd ../../ \
&& rm -rf include-what-you-use* \
&& : # last line

# Build glib-2.0 from source with enabled thread sanitizer. This is needed for
# running CHIP tests with TSAN enabled. When running applications with TSAN
# all shared libraries should be built with TSAN enabled, otherwise TSAN might
Expand Down
2 changes: 1 addition & 1 deletion integrations/docker/images/chip-build/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.6.11 Version bump reason: install nodejs into chip-build image, since github js actions seem to need it.
0.6.12 Version bump reason: Add checking and verification support for includes using IWYU
Loading