From 9c9b1ab0569374553355b1e4859b53e6af08ee00 Mon Sep 17 00:00:00 2001 From: "Brian A. Ignacio" Date: Mon, 19 Feb 2024 11:54:03 +0800 Subject: [PATCH] add esp home kit sdk as framework (#1122) * add esp home kit sdk as framework * add to appendIdfAndToolsToPath * fix lint * fix init report obj * add examples to project wizard * fix duplicate install in docs --- README.md | 5 +++- docs/HARDWARE_SUPPORT.md | 3 ++ docs/SETTINGS.md | 3 +- docs/tutorial/additional_frameworks.md | 4 ++- docs/tutorial/new_project_wizard.md | 4 +-- i18n/en/package.i18n.json | 2 ++ i18n/es/package.i18n.json | 2 ++ i18n/ru/package.i18n.json | 2 ++ i18n/zh-CN/package.i18n.json | 2 ++ package.json | 17 +++++++++++ package.nls.json | 2 ++ schema.i18n.json | 5 ++++ src/config.ts | 1 + src/espHomekit/espHomekitDownload.ts | 39 ++++++++++++++++++++++++++ src/extension.ts | 28 ++++++++++++++++-- src/newProject/newProjectInit.ts | 11 ++++++++ src/newProject/newProjectPanel.ts | 3 ++ src/support/checkSpacesInSettings.ts | 4 +++ src/support/configurationAccess.ts | 4 +++ src/support/configurationSettings.ts | 1 + src/support/initReportObj.ts | 3 ++ src/support/types.ts | 3 ++ src/support/writeReport.ts | 3 ++ src/test/doctor.test.ts | 1 + src/utils.ts | 6 ++++ 25 files changed, 151 insertions(+), 7 deletions(-) create mode 100644 src/espHomekit/espHomekitDownload.ts diff --git a/README.md b/README.md index c4c230ad6..a3784bb99 100644 --- a/README.md +++ b/README.md @@ -133,6 +133,7 @@ Click F1 to show Visual studio code actions, then type **ESP-IDF** to | Install ESP-MDF | | | | Install ESP-Matter | | | | Install ESP-Rainmaker | | | +| Install ESP-HomeKit-SDK | | | | Launch IDF Monitor for CoreDump / GDB-Stub Mode | | | | Launch QEMU Server | | | | Launch QEMU Debug Session | | | @@ -176,7 +177,9 @@ Click F1 to show Visual studio code actions, then type **ESP-IDF** to 5. The **Install ESP-MDF** will clone ESP-MDF inside the selected directory and set `idf.espMdfPath` (`idf.espMdfPathWin` in Windows) configuration setting. -6. The **Show Examples Projects** command allows you create a new project using one of the examples in ESP-IDF, ESP-ADF, ESP-Matter or ESP-MDF directory if related configuration settings are correctly defined. +6. The **Install ESP-HomeKit-SDK** will clone ESP-HomeKit-SDK inside the selected directory and set `idf.espHomeKitSdkPath` (`idf.espHomeKitSdkPathWin` in Windows) configuration setting. + +7. The **Show Examples Projects** command allows you create a new project using one of the examples in ESP-IDF, ESP-ADF, ESP-Matter, ESP-HomeKit-SDK or ESP-MDF directory if related configuration settings are correctly defined. # Commands for tasks.json and launch.json diff --git a/docs/HARDWARE_SUPPORT.md b/docs/HARDWARE_SUPPORT.md index beeb8d3b7..863e2bc50 100644 --- a/docs/HARDWARE_SUPPORT.md +++ b/docs/HARDWARE_SUPPORT.md @@ -7,6 +7,7 @@ [ESP32-S2](https://www.espressif.com/en/products/socs/esp32-s2) [ESP32-S3](https://www.espressif.com/en/products/socs/esp32-s3) [ESP32-H2](https://www.espressif.com/en/products/socs/esp32-h2) +[ESP32-P4](https://www.espressif.com/en/products/socs/esp32-p4) The chips supported in the extension are directly dependent on the ESP-IDF and OpenOCD version you are using: @@ -27,4 +28,6 @@ In addition to ESP-IDF chips, there are several boards configurations files impl - [Espressif Rainmaker](https://github.com/espressif/esp-rainmaker) can be clone with the **ESP-IDF: Install ESP-Rainmaker** to a selected and set `idf.espRainmakerPath` (`idf.espRainmakerPathWin` in Windows) configuration setting. +- [ESP-HomeKit-SDK](https://github.com/espressif/esp-homekit-sdk) can be clone with the **Install ESP-HomeKit-SDK** command to the selected directory and set `idf.espHomeKitSdkPath` (`idf.espHomeKitSdkPathWin` in Windows) configuration setting. + > **NOTE:** Consider that if you are using other Espressif frameworks for your projects, not all ESP-IDF versions are compatible with an specific framework. For example, ESP-ADF might not work with the current ESP-IDF master branch. It is recommended that you configure the extension to use the ESP-IDF within the framework (most frameworks include compatible ESP-IDF as subdirectory) in the setup wizard or JSON Configuration as shown in [SETUP](./SETUP.md) documentation or [Install](./tutorial/install.md) tutorial. diff --git a/docs/SETTINGS.md b/docs/SETTINGS.md index 3b0f864fc..dc6e93081 100644 --- a/docs/SETTINGS.md +++ b/docs/SETTINGS.md @@ -159,7 +159,8 @@ These settings allow to support additional frameworks together with ESP-IDF: The **ESP-IDF: Install ESP-ADF** command will clone ESP-ADF and set `idf.espAdfPath` (`idf.espAdfPathWin` in Windows). The **ESP-IDF: Install ESP-MDF** command will clone ESP-MDF and set `idf.espMdfPath` (`idf.espMdfPathWin` in Windows). The **ESP-IDF: Install ESP-Matter** command will clone ESP-Matter and set `idf.espMatterPath`. The **ESP-IDF: Set ESP-MATTER Device Path (ESP_MATTER_DEVICE_PATH)** is used to define the device path for ESP-Matter. ESP-Matter is not supported in Windows. -The **ESP-IDF: Install Install ESP-Rainmaker** command will clone ESP-Rainmaker and set `idf.espRainmakerPath` (`idf.espRainmakerPathWin` in Windows) configuration setting. +The **ESP-IDF: Install ESP-Rainmaker** command will clone ESP-Rainmaker and set `idf.espRainmakerPath` (`idf.espRainmakerPathWin` in Windows) configuration setting. +The **ESP-IDF: Install ESP-HomeKit-SDK** command will clone ESP-HomeKit-SDK inside the selected directory and set `idf.espHomeKitSdkPath` (`idf.espHomeKitSdkPathWin` in Windows) configuration setting. The **ESP-IDF: Show Examples Projects** command allows you create a new project using one of the examples in ESP-IDF, ESP-ADF, ESP-Matter or ESP-MDF directory if related configuration settings are set, or to create projects from examples found in the Component Registry. diff --git a/docs/tutorial/additional_frameworks.md b/docs/tutorial/additional_frameworks.md index 606de89ce..a54443557 100644 --- a/docs/tutorial/additional_frameworks.md +++ b/docs/tutorial/additional_frameworks.md @@ -12,7 +12,9 @@ Besides ESP-IDF, you can install other frameworks to extend the extension functi 4. [Espressif Rainmaker](https://github.com/espressif/esp-rainmaker) can be clone with the **ESP-IDF: Install ESP-Rainmaker** to a selected and set `idf.espRainmakerPath` (`idf.espRainmakerPathWin` in Windows) configuration setting. -> **NOTE:** You can also just set each configuration setting with the framework directory path if you already have them. For example, on Visual Studio Code menu `View` -> `Command Palette..`. -> type `Preferences: Open Settings (UI)` and search for ESP-ADF to manually set this path. +5. [ESP-HomeKit-SDK](https://github.com/espressif/esp-homekit-sdk) can be clone with the **Install ESP-HomeKit-SDK** command to the selected directory and set `idf.espHomeKitSdkPath` (`idf.espHomeKitSdkPathWin` in Windows) configuration setting. + +> **NOTE:** You can also just set each configuration setting with the framework directory path if you already have them. For example, on Visual Studio Code menu `View` -> `Command Palette..`. -> type `Preferences: Open Settings (UI)` and search for ESP-ADF (or other framework) to manually set this path. > **NOTE:** Please review [ESP-IDF Settings](../SETTINGS.md) to see how to modify these configuration settings. diff --git a/docs/tutorial/new_project_wizard.md b/docs/tutorial/new_project_wizard.md index 03658621f..5364c8ec5 100644 --- a/docs/tutorial/new_project_wizard.md +++ b/docs/tutorial/new_project_wizard.md @@ -1,6 +1,6 @@ # New Project Wizard -This feature allows you to create a new project using the ESP-IDF, ESP-ADF and ESP-MDF frameworks and configure the extension settings and the project name. +This feature allows you to create a new project using the ESP-IDF, ESP-ADF, ESP-MDF and other supported frameworks and configure the extension settings and the project name. 1. Click menu View -> Command Palette... and search for the **ESP-IDF: New Project**. @@ -12,7 +12,7 @@ This feature allows you to create a new project using the ESP-IDF, ESP-ADF and E > **NOTE:** If using the custom board option, please take a look at [Configuring of OpenOCD for Specific Target](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/jtag-debugging/tips-and-quirks.html#configuration-of-openocd-for-specific-target) for more information about these openOCD configuration files and the [debugging tutorial](./debugging.md) for values examples. -3. After that click the `Choose Template` button and choose a template from Extension templates and, if configured; ESP-IDF, ESP-ADF and ESP-MDF frameworks. If you want to create a blank project, choose ESP-IDF `sample_project` or the extension `template-app`. +3. After that click the `Choose Template` button and choose a template from Extension templates and, if configured; ESP-IDF, ESP-ADF and other supported frameworks. If you want to create a blank project, choose ESP-IDF `sample_project` or the extension `template-app`.

New project templates diff --git a/i18n/en/package.i18n.json b/i18n/en/package.i18n.json index 22459df47..b602a266d 100644 --- a/i18n/en/package.i18n.json +++ b/i18n/en/package.i18n.json @@ -35,6 +35,7 @@ "espIdf.getEspMdf.title": "Install ESP-MDF", "espIdf.getEspMatter.title": "Install ESP-Matter", "espIdf.getEspRainmaker.title": "Install ESP-Rainmaker", + "espIdf.getEspHomeKitSdk.title": "Install ESP-HomeKit-SDK", "espIdf.installEspMatterPyReqs.title": "Install ESP-Matter Python Packages", "espIdf.installPyReqs.title": "Install ESP-IDF Extension Python Packages", "espIdf.openDocUrl.title": "Open ESP-IDF Documentation...", @@ -82,6 +83,7 @@ "param.espMdfPath": "Path to locate ESP-MDF framework (MDF_PATH)", "param.espMatterPath": "Path to locate ESP-Matter framework (ESP_MATTER_PATH)", "param.espRainmakerPath": "Path to locate ESP-Rainmaker framework (RMAKER_PATH)", + "param.espHomeKitSdkPath": "Path to locate ESP-HomeKit-SDK framework (HOMEKIT_PATH)", "param.toolsPath": "Path to locate ESP-IDF Tools (IDF_TOOLS_PATH)", "param.exportPaths": "Paths to be appended to PATH", "param.exportVars": "Variables to be added to system environment variables", diff --git a/i18n/es/package.i18n.json b/i18n/es/package.i18n.json index eb99b4eab..c468d236e 100644 --- a/i18n/es/package.i18n.json +++ b/i18n/es/package.i18n.json @@ -35,6 +35,7 @@ "espIdf.getEspMdf.title": "ESP-IDF: Instalar ESP-MDF", "espIdf.getEspMatter.title": "ESP-IDF: Instalar ESP-Matter", "espIdf.getEspRainmaker.title": "Instalar ESP-Rainmaker", + "espIdf.getEspHomeKitSdk.title": "Instalar ESP-HomeKit-SDK", "espIdf.installEspMatterPyReqs.title": "ESP-IDF: Instalar paquetes Python para ESP-Matter", "espIdf.installPyReqs.title": "ESP-IDF: Instalar paquetes Python para extensión ESP-IDF", "espIdf.openDocUrl.title": "ESP-IDF: Abrir documentación ESP-IDF...", @@ -86,6 +87,7 @@ "param.espMdfPath": "Ruta del entorno de trabajo ESP-MDF (MDF_PATH)", "param.espMatterPath": "Ruta del entorno del trabajo ESP-Matter (ESP_MATTER_PATH)", "param.espRainmakerPath": "Ruta del entorno del trabajo ESP-Rainmaker (RMAKER_PATH)", + "param.espHomeKitSdkPath": "Ruta del entorno del trabajo ESP-HomeKit-SDK (HOMEKIT_PATH)", "param.cmakeCompilerArgs": "Argumentos para la tarea de compilación CMake", "param.ninjaArgs": "Argumentos para la tarea de construcción Ninja", "param.useIDFKConfigStyle": "Habilitar/Deshabilitar validación de estilo ESP-IDF para archivos Kconfig", diff --git a/i18n/ru/package.i18n.json b/i18n/ru/package.i18n.json index cd912a4e7..251f51f9d 100644 --- a/i18n/ru/package.i18n.json +++ b/i18n/ru/package.i18n.json @@ -35,6 +35,7 @@ "espIdf.getEspMdf.title": "Установить ESP-MDF", "espIdf.getEspMatter.title": "Установить ESP-Matter", "espIdf.getEspRainmaker.title": "Установить ESP-Rainmaker", + "espIdf.getEspHomeKitSdk.title": "Установить ESP-HomeKit-SDK", "espIdf.installEspMatterPyReqs.title": "Установите пакеты Python ESP-Matter", "espIdf.installPyReqs.title": "Установите пакеты Python расширения ESP-IDF", "espIdf.openDocUrl.title": "Открыть документацию ...", @@ -82,6 +83,7 @@ "param.espMdfPath": "Путь фреймворка ESP-MDF (MDF_PATH)", "param.espMatterPath": "Путь фреймворка ESP-Matter (ESP_MATTER_PATH)", "param.espRainmakerPath": "Путь фреймворка ESP-Rainmaker (RMAKER_PATH)", + "param.espHomeKitSdkPath": "Путь фреймворка ESP-HomeKit-SDK (HOMEKIT_PATH)", "param.toolsPath": "Путь инструментов ESP-IDF (IDF_TOOLS_PATH)", "param.exportPaths": "Пути, добавляемые к PATH", "param.exportVars": "Переменные, которые нужно добавить к системным переменным окружения", diff --git a/i18n/zh-CN/package.i18n.json b/i18n/zh-CN/package.i18n.json index ef352ebe6..08f015d12 100644 --- a/i18n/zh-CN/package.i18n.json +++ b/i18n/zh-CN/package.i18n.json @@ -35,6 +35,7 @@ "espIdf.getEspMdf.title": "ESP-IDF: 安装 ESP-MDF", "espIdf.getEspMatter.title": "ESP-IDF: 安装 ESP-Matter", "espIdf.getEspRainmaker.title": "安装 ESP-Rainmaker", + "espIdf.getEspHomeKitSdk.title": "安装 ESP-HomeKit-SDK", "espIdf.installEspMatterPyReqs.title": "ESP-IDF: 安装 ESP-Matter Python 包", "espIdf.installPyReqs.title": "ESP-IDF: 安装 ESP-IDF 扩展 Python 包", "espIdf.openDocUrl.title": "ESP-IDF: 打开 ESP-IDF 文档...", @@ -86,6 +87,7 @@ "param.espMdfPath": "MDF_PATH 的路径", "param.espMatterPath": "ESP_MATTER_PATH 的路径", "param.espRainmakerPath": "RMAKER_PATH 的路径", + "param.espHomeKitSdkPath": "HOMEKIT_PATH 的路径", "param.useIDFKConfigStyle": "启用/禁用 ESP-IDF Kconfig 文件的样式验证", "param.showOnboardingOnInit": "在扩展激活时显示 ESP-IDF 配置窗口", "param.cmakeCompilerArgs": "CMake 编译任务的参数", diff --git a/package.json b/package.json index 5aedd17da..b12b96e6c 100644 --- a/package.json +++ b/package.json @@ -407,6 +407,12 @@ "description": "%param.espMatterPath%", "scope": "resource" }, + "idf.espHomeKitSdkPath": { + "type": "string", + "default": "${env:HOMEKIT_PATH}", + "description": "%param.espHomeKitSdkPath%", + "scope": "resource" + }, "idf.toolsPath": { "type": "string", "default": "${env:IDF_TOOLS_PATH}", @@ -449,6 +455,12 @@ "description": "%param.espRainmakerPath%", "scope": "resource" }, + "idf.espHomeKitSdkPathWin": { + "type": "string", + "default": "${env:HOMEKIT_PATH}", + "description": "%param.espHomeKitSdkPath%", + "scope": "resource" + }, "idf.port": { "type": "string", "default": "/dev/ttyUSB1", @@ -1203,6 +1215,11 @@ "title": "%espIdf.getEspRainmaker.title%", "category": "ESP-IDF" }, + { + "command": "espIdf.getEspHomeKitSdk", + "title": "%espIdf.getEspHomeKitSdk.title%", + "category": "ESP-IDF" + }, { "command": "espIdf.installEspMatterPyReqs", "title": "%espIdf.installEspMatterPyReqs.title%", diff --git a/package.nls.json b/package.nls.json index ba6576326..76c2cbc11 100644 --- a/package.nls.json +++ b/package.nls.json @@ -33,6 +33,7 @@ "espIdf.searchInEspIdfDocs.title": "Search in Documentation...", "espIdf.getEspAdf.title": "Install ESP-ADF", "espIdf.getEspMdf.title": "Install ESP-MDF", + "espIdf.getEspHomeKitSdk.title": "Install ESP-HomeKit-SDK", "espIdf.getEspMatter.title": "Install ESP-Matter", "espIdf.getEspRainmaker.title": "Install ESP-Rainmaker", "espIdf.installEspMatterPyReqs.title": "Install ESP-Matter Python Packages", @@ -82,6 +83,7 @@ "param.espMdfPath": "Path to locate ESP-MDF framework (MDF_PATH)", "param.espMatterPath": "Path to locate ESP-Matter framework (ESP_MATTER_PATH)", "param.espRainmakerPath": "Path to locate ESP-Rainmaker framework (RMAKER_PATH)", + "param.espHomeKitSdkPath": "Path to locate ESP-HomeKit-SDK framework (HOMEKIT_PATH)", "param.toolsPath": "Path to locate ESP-IDF Tools (IDF_TOOLS_PATH)", "param.exportPaths": "Paths to be appended to PATH", "param.exportVars": "Variables to be added to system environment variables", diff --git a/schema.i18n.json b/schema.i18n.json index 872e2d8b2..16db54db0 100644 --- a/schema.i18n.json +++ b/schema.i18n.json @@ -113,6 +113,7 @@ "espIdf.getEspMdf.title", "espIdf.getEspMatter.title", "espIdf.getEspRainmaker.title", + "espIdf.getEspHomeKitSdk.title", "espIdf.installEspMatterPyReqs.title", "espIdf.installPyReqs.title", "espIdf.openDocUrl.title", @@ -131,6 +132,7 @@ "espIdf.launchQemu.title", "espIdf.qemuDebug.title", "espIdf.flashUart.title", + "espIdf.saveDefSdkconfig.title", "espIdf.createDevContainer.title", "espIdf.partition.table.refresh.title", "espIdf.flashBinaryToPartition.title", @@ -157,6 +159,7 @@ "param.espMdfPath", "param.espMatterPath", "param.espRainmakerPath", + "param.espHomeKitSdkPath", "param.toolsPath", "param.exportPaths", "param.exportVars", @@ -175,6 +178,8 @@ "param.monitorNoReset", "param.monitorEnableTimestamps", "param.monitorCustomTimestampFormat", + "param.customTerminalExecutable.title", + "param.customTerminalExecutableArgs.title", "view.components.name", "configuration.title", "espIdf.apptrace.archive.refresh.title", diff --git a/src/config.ts b/src/config.ts index 297feb111..d9d12442e 100644 --- a/src/config.ts +++ b/src/config.ts @@ -57,6 +57,7 @@ export namespace ESP { "idf.espAdfPath", "idf.espMdfPath", "idf.espRainmakerPath", + "idf.espHomeKitSdkPath", "idf.gitPath", "idf.pythonBinPath", "idf.port", diff --git a/src/espHomekit/espHomekitDownload.ts b/src/espHomekit/espHomekitDownload.ts new file mode 100644 index 000000000..295bf1f63 --- /dev/null +++ b/src/espHomekit/espHomekitDownload.ts @@ -0,0 +1,39 @@ +/* + * Project: ESP-IDF VSCode Extension + * File Created: Monday, 29th January 2024 5:23:22 pm + * Copyright 2024 Espressif Systems (Shanghai) CO LTD + * + * 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. + */ + +import { Uri } from "vscode"; +import { AbstractCloning } from "../common/abstractCloning"; +import { readParameter } from "../idfConfiguration"; + +export class EspHomekitCloning extends AbstractCloning { + constructor(gitBinPath: string = "git") { + super( + "https://github.com/espressif/esp-homekit-sdk.git", + "ESP-HomeKit-SDK", + "master", + gitBinPath, + "https://gitee.com/EspressifSystems/esp-homekit-sdk" + ); + } +} + +export async function getEspHomeKitSdk(workspace: Uri) { + const gitPath = (await readParameter("idf.gitPath", workspace)) || "git"; + const homeKitInstaller = new EspHomekitCloning(gitPath); + await homeKitInstaller.getRepository("idf.espHomeKitSdkPath", workspace); +} diff --git a/src/extension.ts b/src/extension.ts index e6d0cd414..9fd3335e5 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -144,6 +144,7 @@ import { import { getFileList, getTestComponents } from "./espIdf/unitTest/utils"; import { saveDefSdkconfig } from "./espIdf/menuconfig/saveDefConfig"; import { createSBOM, installEspSBOM } from "./espBom"; +import { getEspHomeKitSdk } from "./espHomekit/espHomekitDownload"; // Global variables shared by commands let workspaceRoot: vscode.Uri; @@ -745,6 +746,10 @@ export async function activate(context: vscode.ExtensionContext) { registerIDFCommand("espIdf.getEspMdf", async () => getEspMdf(workspaceRoot)); + registerIDFCommand("espIdf.getEspHomeKitSdk", async () => + getEspHomeKitSdk(workspaceRoot) + ); + registerIDFCommand("espIdf.getEspMatter", async () => { if (process.platform === "win32") { return vscode.window.showInformationMessage( @@ -3400,9 +3405,18 @@ async function getFrameworksPickItems() { "idf.espMdfPath", workspaceRoot ) as string; - const matterPathDir = idfConf.readParameter("idf.espMatterPath") as string; + const matterPathDir = idfConf.readParameter( + "idf.espMatterPath", + workspaceRoot + ) as string; const rainmakerPathDir = idfConf.readParameter( - "idf.espRainmakerPath" + "idf.espRainmakerPath", + workspaceRoot + ) as string; + + const espHomeKitPathDir = idfConf.readParameter( + "idf.espHomeKitSdkPath", + workspaceRoot ) as string; const pickItems = []; @@ -3449,6 +3463,16 @@ async function getFrameworksPickItems() { target: rainmakerPathDir, }); } + const doesEspHomeKitSdkPathExists = await utils.dirExistPromise( + espHomeKitPathDir + ); + if (doesEspHomeKitSdkPathExists) { + pickItems.push({ + description: "ESP-HomeKit-SDK", + label: `Use current ESP-HomeKit-SDK (${espHomeKitPathDir})`, + target: espHomeKitPathDir, + }); + } } catch (error) { const errMsg = error.message ? error.message : "Error getting frameworks"; Logger.errorNotify(errMsg, error); diff --git a/src/newProject/newProjectInit.ts b/src/newProject/newProjectInit.ts index d5a3c04e3..af7138767 100644 --- a/src/newProject/newProjectInit.ts +++ b/src/newProject/newProjectInit.ts @@ -29,6 +29,7 @@ export interface INewProjectArgs { espIdfPath: string; espAdfPath: string; espMdfPath: string; + espHomeKitSdkPath: string; boards: IdfBoard[]; components: IComponent[]; serialPortList: string[]; @@ -77,6 +78,10 @@ export async function getNewProjectArgs( "idf.espMdfPath", workspace ) as string; + const espHomeKitSdkPath = idfConf.readParameter( + "idf.espHomeKitSdkPath", + workspace + ) as string; let templates: { [key: string]: IExampleCategory } = {}; templates["Extension"] = getExamplesList(extensionPath, "templates"); const idfExists = await dirExistPromise(espIdfPath); @@ -94,6 +99,11 @@ export async function getNewProjectArgs( const mdfTemplates = getExamplesList(espMdfPath); templates["ESP-MDF"] = mdfTemplates; } + const homekitSdkExists = await dirExistPromise(espHomeKitSdkPath); + if (homekitSdkExists) { + const homeKitSdkTemplates = getExamplesList(espHomeKitSdkPath); + templates["ESP-HOMEKIT-SDK"] = homeKitSdkTemplates; + } progress.report({ increment: 50, message: "Initializing wizard..." }); return { boards: espBoards, @@ -101,6 +111,7 @@ export async function getNewProjectArgs( espAdfPath: adfExists ? espAdfPath : undefined, espIdfPath: idfExists ? espIdfPath : undefined, espMdfPath: mdfExists ? espMdfPath : undefined, + espHomeKitSdkPath: homekitSdkExists ? espHomeKitSdkPath: undefined, serialPortList, targetList, templates, diff --git a/src/newProject/newProjectPanel.ts b/src/newProject/newProjectPanel.ts index 977b9b41e..c0227009a 100644 --- a/src/newProject/newProjectPanel.ts +++ b/src/newProject/newProjectPanel.ts @@ -82,6 +82,9 @@ export class NewProjectPanel { if (newProjectArgs.espMdfPath) { localResourceRoots.push(vscode.Uri.file(newProjectArgs.espMdfPath)); } + if (newProjectArgs.espHomeKitSdkPath) { + localResourceRoots.push(vscode.Uri.file(newProjectArgs.espHomeKitSdkPath)); + } this.panel = vscode.window.createWebviewPanel( NewProjectPanel.viewType, newProjectTitle, diff --git a/src/support/checkSpacesInSettings.ts b/src/support/checkSpacesInSettings.ts index 0e54c96f7..47f17c419 100644 --- a/src/support/checkSpacesInSettings.ts +++ b/src/support/checkSpacesInSettings.ts @@ -36,6 +36,10 @@ export function checkSpacesInSettings(reportedResult: reportObj) { reportedResult.configurationSettings.espMdfPath ); + reportedResult.configurationSpacesValidation.espHomeKitPath = checkSpacesInPath( + reportedResult.configurationSettings.espHomeKitPath + ); + reportedResult.configurationSpacesValidation.pythonBinPath = checkSpacesInPath( reportedResult.configurationSettings.pythonBinPath ); diff --git a/src/support/configurationAccess.ts b/src/support/configurationAccess.ts index def0bb465..5d7357e37 100644 --- a/src/support/configurationAccess.ts +++ b/src/support/configurationAccess.ts @@ -46,6 +46,10 @@ export async function getConfigurationAccess( reportedResult.configurationSettings.espMatterPath, constants.R_OK ); + reportedResult.configurationAccess.espHomeKitPath = canAccessFile( + reportedResult.configurationSettings.espHomeKitPath, + constants.R_OK + ); reportedResult.configurationAccess.pythonBinPath = canAccessFile( reportedResult.configurationSettings.pythonBinPath, constants.X_OK diff --git a/src/support/configurationSettings.ts b/src/support/configurationSettings.ts index 2c741d0af..153d1b57c 100644 --- a/src/support/configurationSettings.ts +++ b/src/support/configurationSettings.ts @@ -30,6 +30,7 @@ export function getConfigurationSettings( espIdfPath: conf.get("idf.espIdfPath" + winFlag), espMdfPath: conf.get("idf.espMdfPath" + winFlag), espMatterPath: conf.get("idf.espMatterPath"), + espHomeKitPath: conf.get("idf.espHomeKitSdkPath" + winFlag), customTerminalExecutable: conf.get("idf.customTerminalExecutable"), customTerminalExecutableArgs: conf.get("idf.customTerminalExecutableArgs"), customExtraPaths: conf.get("idf.customExtraPaths"), diff --git a/src/support/initReportObj.ts b/src/support/initReportObj.ts index 82fee7787..2fe99d83a 100644 --- a/src/support/initReportObj.ts +++ b/src/support/initReportObj.ts @@ -25,6 +25,7 @@ export function initializeReportObject() { espAdfPath: undefined, espMdfPath: undefined, espMatterPath: undefined, + espHomeKitPath: undefined, customExtraPaths: undefined, customExtraVars: undefined, customTerminalExecutable: undefined, @@ -43,6 +44,7 @@ export function initializeReportObject() { espAdfPath: undefined, espMdfPath: undefined, espMatterPath: undefined, + espHomeKitPath: undefined, espIdfToolsPaths: undefined, pythonBinPath: undefined, cmakeInEnv: undefined, @@ -55,6 +57,7 @@ export function initializeReportObject() { espIdfPath: undefined, espMatterPath: undefined, espMdfPath: undefined, + espHomeKitPath: undefined, gitPath: undefined, pythonBinPath: undefined, toolsPath: undefined, diff --git a/src/support/types.ts b/src/support/types.ts index 96710b228..3ba954234 100644 --- a/src/support/types.ts +++ b/src/support/types.ts @@ -23,6 +23,7 @@ export class ConfigurationAccess { espAdfPath: boolean; espMdfPath: boolean; espMatterPath: boolean; + espHomeKitPath: boolean; espIdfToolsPaths: { [key: string]: boolean }; pythonBinPath: boolean; cmakeInEnv: boolean; @@ -35,6 +36,7 @@ export class Configuration { espAdfPath: string; espMdfPath: string; espMatterPath: string; + espHomeKitPath: string; customExtraPaths: string; customExtraVars: { [key: string]: string }; notificationMode: string; @@ -54,6 +56,7 @@ export class ConfigurationSpacesValidation { espAdfPath: boolean; espMdfPath: boolean; espMatterPath: boolean; + espHomeKitPath: boolean; customExtraPaths: { [key: string]: boolean }; pythonBinPath: boolean; toolsPath: boolean; diff --git a/src/support/writeReport.ts b/src/support/writeReport.ts index 311f7220c..bed65c8f1 100644 --- a/src/support/writeReport.ts +++ b/src/support/writeReport.ts @@ -44,6 +44,7 @@ export async function writeTextReport( output += `ESP-IDF Path (idf.espIdfPath) ${reportedResult.configurationSettings.espIdfPath}${EOL}`; output += `ESP-MDF Path (idf.espMdfPath) ${reportedResult.configurationSettings.espMdfPath}${EOL}`; output += `ESP-Matter Path (idf.espMatterPath) ${reportedResult.configurationSettings.espMatterPath}${EOL}`; + output += `ESP-HomeKit-SDK Path (idf.espHomeKitSdkPath) ${reportedResult.configurationSettings.espHomeKitPath}${EOL}`; output += `Custom extra paths (idf.customExtraPaths) ${reportedResult.configurationSettings.customExtraPaths}${EOL}`; if ( reportedResult.configurationSettings.customExtraVars && @@ -74,6 +75,7 @@ export async function writeTextReport( output += `Access to ESP-IDF Path (idf.espIdfPath) ${reportedResult.configurationAccess.espIdfPath}${EOL}`; output += `Access to ESP-MDF Path (idf.espMdfPath) ${reportedResult.configurationAccess.espMdfPath}${EOL}`; output += `Access to ESP-Matter Path (idf.espMatterPath) ${reportedResult.configurationAccess.espMatterPath}${EOL}`; + output += `Access to ESP-HomeKit Path (idf.espHomeKitSdkPath) ${reportedResult.configurationAccess.espHomeKitPath}${EOL}`; output += `Access to ESP-IDF Custom extra paths${EOL}`; for (let key in reportedResult.configurationAccess.espIdfToolsPaths) { output += `Access to ${key}: ${reportedResult.configurationAccess.espIdfToolsPaths[key]}${EOL}`; @@ -88,6 +90,7 @@ export async function writeTextReport( output += `Spaces in ESP-IDF Path (idf.espIdfPath) ${reportedResult.configurationSpacesValidation.espIdfPath}${EOL}`; output += `Spaces in ESP-MDF Path (idf.espMdfPath) ${reportedResult.configurationSpacesValidation.espMdfPath}${EOL}`; output += `Spaces in ESP-Matter Path (idf.espMatterPath) ${reportedResult.configurationSpacesValidation.espMatterPath}${EOL}`; + output += `Spaces in ESP-HomeKit-SDK Path (idf.espHomeKitSdkPath) ${reportedResult.configurationSpacesValidation.espHomeKitPath}${EOL}`; output += `Spaces in ESP-IDF Custom extra paths${EOL}`; for (let key in reportedResult.configurationSpacesValidation .customExtraPaths) { diff --git a/src/test/doctor.test.ts b/src/test/doctor.test.ts index 908800534..eecc458b0 100644 --- a/src/test/doctor.test.ts +++ b/src/test/doctor.test.ts @@ -290,6 +290,7 @@ suite("Doctor Command tests", () => { expectedOutput += `ESP-IDF Path (idf.espIdfPath) ${process.env.IDF_PATH}${os.EOL}`; expectedOutput += `ESP-MDF Path (idf.espMdfPath) ${reportObj.configurationSettings.espMdfPath}${os.EOL}`; expectedOutput += `ESP-Matter Path (idf.espMatterPath) ${reportObj.configurationSettings.espMatterPath}${os.EOL}`; + expectedOutput += `ESP-HomeKit-SDK Path (idf.espHomeKitSdkPath) ${reportObj.configurationSettings.espHomeKitPath}${os.EOL}`; expectedOutput += `Custom extra paths (idf.customExtraPaths) ${customExtraPaths}${os.EOL}`; if ( reportObj.configurationSettings.customExtraVars && diff --git a/src/utils.ts b/src/utils.ts index 75eb3b418..42c2ef686 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -912,6 +912,12 @@ export function appendIdfAndToolsToPath(curWorkspace: vscode.Uri) { const mdfPathDir = idfConf.readParameter("idf.espMdfPath", curWorkspace); modifiedEnv.MDF_PATH = mdfPathDir || modifiedEnv.MDF_PATH; + const homekitPathDir = idfConf.readParameter( + "idf.espHomeKitSdkPath", + curWorkspace + ); + modifiedEnv.HOMEKIT_PATH = homekitPathDir || modifiedEnv.HOMEKIT_PATH; + const rainmakerPathDir = idfConf.readParameter( "idf.espRainmakerPath", curWorkspace