From 60d6c6b5b3da572adeb652cc7ac384ab51ba880f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=82osz=20Tomkiel?= Date: Tue, 10 Sep 2024 04:27:25 +0200 Subject: [PATCH] [devcontainer] Version bump and enhanced UX. (#35403) * Version bump, remove unnecessary libs * Allow environment location modification * Add apt installs to base image * Speed-up image building * Remove unneeded apt installs * Expose and document important env variable * Add all pigweed environments to .gitignore * Revert and reformat comment * Compatibility fix --- .devcontainer/Dockerfile | 38 +++++++++++-------- .devcontainer/devcontainer.json | 5 ++- .gitignore | 3 +- .../vscode/chip-build-vscode/Dockerfile | 5 ++- 4 files changed, 31 insertions(+), 20 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index da4e2c4171171e..386253bb609e8e 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -24,22 +24,19 @@ ARG USER_UID=1000 ARG USER_GID=$USER_UID ENV LANG en_US.utf8 -# these are installed for terminal/dev convenience. If more tooling for build is required, please -# add them to chip-build (in integrations/docker/images/chip-build) + +# These are installed for terminal/dev convenience. If more tooling for build is required, please +# add them to chip-build (in integrations/docker/images/chip-build). RUN apt-get update \ && apt-get install -y locales \ && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 \ - && apt-get -fy install git vim emacs sudo \ + && apt-get -fy install vim emacs sudo \ apt-utils dialog zsh \ - iproute2 procps lsb-release \ + lsb-release \ bash-completion \ - build-essential cmake cppcheck valgrind \ - wget curl telnet \ + valgrind \ docker.io \ - iputils-ping net-tools \ - libncurses5 \ - libncursesw5 \ - libpython2.7 \ + iputils-ping \ && : RUN groupadd -g $USER_GID $USERNAME \ @@ -55,13 +52,22 @@ RUN curl https://raw.githubusercontent.com/restyled-io/restyler/master/bin/resty RUN mkdir -p /opt/sdk/sdks/ \ && chown -R $USERNAME:$USERNAME \ /opt/sdk/sdks/ `# NXP uses a patch_sdk script to change SDK files` \ - /opt/NordicSemiconductor/nrfconnect/ `# $USERNAME needs to own west configuration to build nRF Connect examples` \ - $IDF_PATH `# $USERNAME needs to own the esp-idf and tools for the examples to build` \ + $ANDROID_HOME \ + $IDF_TOOLS_PATH \ + && find $AMEBA_PATH -name "inc_lp" -print0 | xargs -0 chown -R $USERNAME:$USERNAME \ + && find $AMEBA_PATH -name "inc_hp" -print0 | xargs -0 chown -R $USERNAME:$USERNAME \ + && find $AMEBA_PATH -name "project_lp" -print0 | xargs -0 chown -R $USERNAME:$USERNAME \ + && find $AMEBA_PATH -name "project_hp" -print0 | xargs -0 chown -R $USERNAME:$USERNAME \ + && chmod -R +x \ + $ANDROID_HOME/tools/bin `# sdkmanager for accepting licenses`\ + && chmod -R +w \ $IDF_TOOLS_PATH \ - $SYSROOT_AARCH64 `# allow read/write access to header and libraries` \ - $ANDROID_HOME `# allow licenses to be accepted` \ - $AMEBA_PATH `# AmebaD requires access to change build_info.h` \ - $IMX_SDK_ROOT \ + && find $AMEBA_PATH -name "inc_lp" -print0 | xargs -0 chmod -R +w \ + && find $AMEBA_PATH -name "inc_hp" -print0 | xargs -0 chmod -R +w \ + && find $AMEBA_PATH -name "project_lp" -print0 | xargs -0 chmod -R +w \ + && find $AMEBA_PATH -name "project_hp" -print0 | xargs -0 chmod -R +w \ + # Safe directory is preffered over chown. + && git config --global --add safe.directory "*" \ && : # Fix Tizen SDK paths for new user diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 4d5be76434e8f8..9c7f6aeaef881b 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -14,9 +14,12 @@ "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ], - "initializeCommand": "bash .devcontainer/build.sh --tag matter-dev-environment:local --version 22", + "initializeCommand": "bash .devcontainer/build.sh --tag matter-dev-environment:local --version 74", "image": "matter-dev-environment:local", "remoteUser": "vscode", + "containerEnv": { + "PW_ENVIRONMENT_ROOT": "${containerWorkspaceFolder}/.environment-vscode" + }, "customizations": { "vscode": { // Add the IDs of extensions you want installed when the container is created in the array below. diff --git a/.gitignore b/.gitignore index 1c2d1430263594..98dc6780fccc2a 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,7 @@ out/ /src/darwin/Framework/build/ # Pigweed Environment -.environment/ +.environment*/ build_overrides/pigweed_environment.gni # Temporary Directories @@ -84,4 +84,3 @@ examples/*/esp32/dependencies.lock # jupyter temporary files .ipynb_checkpoints - diff --git a/integrations/docker/images/vscode/chip-build-vscode/Dockerfile b/integrations/docker/images/vscode/chip-build-vscode/Dockerfile index 9d6e24b1d259ea..37726292c8db6c 100644 --- a/integrations/docker/images/vscode/chip-build-vscode/Dockerfile +++ b/integrations/docker/images/vscode/chip-build-vscode/Dockerfile @@ -130,7 +130,6 @@ ENV NXP_K32W0_SDK_ROOT=/opt/k32w/core ENV NXP_K32W1_SDK_ROOT=/opt/k32w/k32w1 ENV NXP_SDK_ROOT=/opt/nxp-sdk/rw61x ENV OPENOCD_PATH=/opt/openocd/ -ENV PW_ENVIRONMENT_ROOT=/home/vscode/pigweed/env ENV QEMU_ESP32=/opt/espressif/qemu/qemu-system-xtensa ENV QEMU_ESP32_DIR=/opt/espressif/qemu ENV SYSROOT_AARCH64=/opt/ubuntu-22.04.1-aarch64-sysroot @@ -144,6 +143,10 @@ ENV ZEPHYR_NXP_BASE=/opt/nxp-zephyr/zephyrproject/zephyr ENV ZEPHYR_NXP_SDK_INSTALL_DIR=/opt/nxp-zephyr/zephyr-sdk-0.16.5 ENV NXP_UPDATE_SDK_SCRIPT_DOCKER=/opt/nxp/nxp_matter_support/scripts/update_nxp_sdk.py +# Places bootstrap files there instead of the default one which is `.environment`. +# NOTE: This directory is NOT persistent. +ENV PW_ENVIRONMENT_ROOT=/home/vscode/pigweed/env + ENV TIZEN_VERSION 7.0 ENV TIZEN_SDK_ROOT /opt/tizen-sdk ENV TIZEN_SDK_TOOLCHAIN $TIZEN_SDK_ROOT/tools/arm-linux-gnueabi-gcc-9.2