| # Copyright (c) 2022 Project CHIP Authors |
| # |
| # 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. |
| |
| # In order to avoid bootstrapping a separate environment for each in-tree |
| # example, reuse the environment from the root of the Matter SDK. Use the |
| # bootstrap script there to create the environment. |
| _bootstrap_root = "//third_party/connectedhomeip" |
| |
| import("${_bootstrap_root}/build_overrides/pigweed_environment.gni") |
| |
| # Rebase paths to our root. |
| # This rebasing is only done if the paths are repo-relative |
| # (i.e. start with "//") |
| if (defined(pw_env_setup_CIPD_ARM)) { |
| _split_CIPD_ARM = string_split(pw_env_setup_CIPD_ARM, "//") |
| if (_split_CIPD_ARM[0] == "") { |
| pw_env_setup_CIPD_ARM = |
| get_path_info("${_bootstrap_root}/${pw_env_setup_CIPD_ARM}", "abspath") |
| } |
| } |
| if (defined(pw_env_setup_CIPD_PIGWEED)) { |
| _split_CIPD_PIGWEED = string_split(pw_env_setup_CIPD_PIGWEED, "//") |
| if (_split_CIPD_PIGWEED[0] == "") { |
| pw_env_setup_CIPD_PIGWEED = |
| get_path_info("${_bootstrap_root}/${pw_env_setup_CIPD_PIGWEED}", |
| "abspath") |
| } |
| } |
| if (defined(pw_env_setup_CIPD_PYTHON)) { |
| _split_CIPD_PYTHON = string_split(pw_env_setup_CIPD_PYTHON, "//") |
| if (_split_CIPD_PYTHON[0] == "") { |
| pw_env_setup_CIPD_PYTHON = |
| get_path_info("${_bootstrap_root}/${pw_env_setup_CIPD_PYTHON}", |
| "abspath") |
| } |
| } |
| if (defined(pw_env_setup_VIRTUAL_ENV)) { |
| _split_VIRTUAL_ENV = string_split(pw_env_setup_VIRTUAL_ENV, "//") |
| if (_split_VIRTUAL_ENV[0] == "") { |
| pw_env_setup_VIRTUAL_ENV = |
| get_path_info("${_bootstrap_root}/${pw_env_setup_VIRTUAL_ENV}", |
| "abspath") |
| } |
| } |