Skip to content

Commit

Permalink
DA python pkgs check (#3)
Browse files Browse the repository at this point in the history
* read Cmakelists file for project name (VSC-248) (espressif#43)

read build project_description json file for project name

* Feature/localization kv val (VSC-226) (VSC-246) (espressif#41)

* add gulp i18n validation and src missing key log

* rm unused i18n field, add unknown field (espressif#48)

* v0.1.4

* Added a custom Debug Adapter

* fix old configs remove build before debug

* removed outdated extension.test.ts

* fix debug adapter unit test

* removed repeated options

* removed redundant requirements.txt

* made `Upload testing.results.log` always executable

* add adapter python reqs checking

Co-authored-by: Soumesh Banerjee <soumeshbanerjee@live.com>
Co-authored-by: Andrey Gramakov <mail@agramakov.me>
  • Loading branch information
3 people committed Mar 3, 2020
1 parent f546451 commit 24b5566
Show file tree
Hide file tree
Showing 19 changed files with 525 additions and 213 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@ jobs:
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
python-version: 3.5

- name: Install Node Dependencies
run: yarn

- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r esp_debug_adapter/requirements.txt
- name: Typescript Linting
Expand All @@ -46,7 +45,7 @@ jobs:
with:
name: esp-idf-extension.vsix
path: esp-idf-extension.vsix

- name: xvfb
run: /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
- name: Extension Test
Expand All @@ -55,6 +54,7 @@ jobs:
CODE_VERSION: '1.41.1'
DISPLAY: ':99.0'
- name: Upload testing.results.log
if: always()
uses: actions/upload-artifact@v1
with:
name: testing.results.log
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,18 +214,18 @@ Projects folders and workspace level settings are defined in the `.code-workspac

```json
{
"folders": [
{
"path": "./project1"
},
{
"path": "./project2"
}
],
"settings": {
"idf.port": "/dev/ttyUSB1",
"idf.espIdfPath": "${env:HOME}/esp/esp-idf"
}
"folders": [
{
"path": "./project1"
},
{
"path": "./project2"
}
],
"settings": {
"idf.port": "/dev/ttyUSB1",
"idf.espIdfPath": "${env:HOME}/esp/esp-idf"
}
}
```

Expand Down
17 changes: 13 additions & 4 deletions docs/C_CPP_CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

## Why configure this file?

The [C/C++ Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) is used to provide C and C++ syntax highlights, code navigation and Go to declaration/definition within C and C++ files.
The [C/C++ Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) is used to provide C and C++ syntax highlight, code navigation and Go to declaration/definition within C and C++ files.

The file is located in {PROJECT_DIR}/.vscode/c_cpp_properties.json and can be generated by using **Create ESP-IDF Project** command.

## Default configuration

With this configuration, the Intellisense engine of the C/C++ extension will include all header files found by performing a recursive search of the `${config:idf.espIdfPath}/components` folder. Both **Default** and **Tag Parser** engines are supported. An example configuration that should work with most projects is shown below.
With this configuration, the Intellisense engine of the C/C++ extension will include all header files found by performing a recursive search of the `${config:idf.espIdfPath}/components` folder. For this configuration to work, you need to set you C/C++ Extension Intellisense engine to **Tag Parser**.

An example configuration that should work with most projects is shown below.

```
{
Expand All @@ -17,10 +19,16 @@ With this configuration, the Intellisense engine of the C/C++ extension will inc
"name": "Linux",
"cStandard": "c11",
"cppStandard": "c++17",
"includePath": ["${config:idf.espIdfPath}/components/**"],
"includePath": [
"${config:idf.espIdfPath}/components/**",
"${config:idf.espIdfPathWin}/components/**",
"${workspaceFolder}/**"
],
"browse": {
"path": [
"${config:idf.espIdfPath}/components"
"${config:idf.espIdfPath}/components",
"${config:idf.espIdfPathWin}/components",
"${workspaceFolder}"
],
"limitSymbolsToIncludedHeaders": false
}
Expand All @@ -35,6 +43,7 @@ With this configuration, the Intellisense engine of the C/C++ extension will inc
For this configuration, you must build your project beforehand in order to generate `${workspaceFolder}/build/compile_commands.json` (where ${workspaceFolder} is your project directory). This file will then be used to resolve your C/C++ headers.

```
{
"configurations": [
{
Expand Down
1 change: 1 addition & 0 deletions esp_debug_adapter/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
backports.functools-lru-cache>=1.5
click
future>=0.17
graphviz
psutil>=5.5.1
pygdbmi>=0.9.0.0
pylint>=1.9.4
Expand Down
44 changes: 43 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const vsce = require('vsce');
const nls = require('vscode-nls-dev');
const { readdirSync, statSync } = require('fs');
const { join } = require('path');
const glob = require("glob");

// If all VS Code languages are supported you can use nls.coreLanguages
const languages = []; // [{ folderName: 'zh-CN', id: 'zh-CN' }, { folderName: 'es', id: 'es' }];
Expand Down Expand Up @@ -51,9 +52,50 @@ function vscePackage(done) {
done();
}

const build = gulp.series(clean, addI18n);
function getPathParts(pathToUse) {
const parts = pathToUse.replace(join(__dirname, "i18n"), "").split(/(?:\\|\/)/g);
parts.splice(0, 2);
parts[parts.length - 1] = parts[parts.length - 1].replace(/(\.).*/g, "");
return parts;
}

const reduceSchemaObj = (schemaObj, parts) => {
return parts.reduce((obj, key) =>
(obj && obj[key] !== undefined) ? obj[key] : undefined, schemaObj);
}

function validateLocalizationFiles(done) {
const schema = require("./schema.i18n.json");
languages.forEach((l) => {
const langDirPath = join(__dirname, "i18n", l.folderName, "**", "*.i18n.json");
glob(langDirPath, (err, locFiles) => {
if (err) {
throw err;
}
locFiles.forEach((locFile) => {
const localeJson = require(locFile);
const parts = getPathParts(locFile);
const schemaKeys = reduceSchemaObj(schema, parts);
schemaKeys.forEach((schemaKey) => {
if (!localeJson.hasOwnProperty(schemaKey)) {
throw new Error(`${schemaKey} not defined in ${locFile}`);
}
});
Object.keys(localeJson).forEach((fileKey) => {
if (schemaKeys.indexOf(fileKey) < 0) {
console.log(`Unknown property ${fileKey} defined in ${locFile}`);
}
});
});
});
});
done();
}

const build = gulp.series(clean, addI18n, validateLocalizationFiles);
exports.clean = clean;
exports.build = build;
exports.validateLocalization = validateLocalizationFiles;
exports.publish = gulp.series(build, vscePublish);
exports.vscePkg = gulp.series(build, vscePackage);
exports.default = build;
6 changes: 5 additions & 1 deletion i18n/en/out/espIdf/menuconfig/MenuconfigPanel.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@
"menuconfig.saveValues": "Saved changes in GUI menuconfig",
"menuconfig.discardValues": "Discarded changes in GUI menuconfig",
"menuconfig.wrongIdfPath": "Wrong IDF_PATH in workspace settings. Would you like to set it?",
"menuconfig.enterIdfPath": "Enter IDF_PATH Path"
"menuconfig.enterIdfPath": "Enter IDF_PATH Path",
"menuconfig.changesNotSaved": "Changes in GUI Menuconfig have not been saved. Would you like to save them?",
"menuconfig.save": "Save",
"menuconfig.discard": "Don't save",
"menuconfig.returnGuiconfig": "Return to GUI Menuconfig"
}
4 changes: 0 additions & 4 deletions i18n/es/out/extension.i18n.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
"extension.defaultFoldersGeneratedMessage": "Se han creado las carpetas plantilla.",
"extension.openFolderFirst": "Abre una carpeta primero.",
"extension.notSerialPortFoundMessage": "No se ha encontrado un puerto serial",
"extension.selectSerialPortMessage":"Selecciona el puerto serial de tu dispositivo ESP-IDF",
"extension.noPortSelectedMessage": "No se ha elegido ningún puerto",
"extension.portHasBeenSelectedMessage": "Se ha actualizado el puerto a ",
"espIdf.pickAWorkspaceFolder.text": "Seleccione el folder actual",
"extension.noFolderMessage": "Ningún espacio de trabajo seleccionado",
"selectFrameworkMessage": "Seleccione una plataforma para definir ruta",
Expand Down
4 changes: 0 additions & 4 deletions i18n/zh-CN/out/extension.i18n.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
"extension.defaultFoldersGeneratedMessage": "已生成默认文件夹",
"extension.openFolderFirst": "请先打开文件夹",
"extension.notSerialPortFoundMessage": "找不到可用串口",
"extension.selectSerialPortMessage":"请选择可用的串口",
"extension.noPortSelectedMessage": "串口未选中",
"extension.portHasBeenSelectedMessage": "串口已选中 ",
"espIdf.pickAWorkspaceFolder.text": "请选择当前工作文件夹",
"extension.noFolderMessage": "未选择工作区",
"selectFrameworkMessage": "选择框架并设定路径",
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"preview": true,
"displayName": "Espressif IDF",
"description": "Espressif IoT Development Framework",
"version": "0.1.3",
"version": "0.1.4",
"license": "Apache-2.0",
"publisher": "espressif",
"icon": "espressif_icon.png",
Expand Down Expand Up @@ -496,6 +496,7 @@
"package": "vsce package --yarn -o esp-idf-extension.vsix",
"release": "vsce publish --yarn -p ${VS_MARKETPLACE_TOKEN}",
"gulp_clean": "gulp clean",
"validateLocalization": "gulp validateLocalization",
"webpack": "webpack --mode production"
},
"devDependencies": {
Expand Down
123 changes: 123 additions & 0 deletions schema.i18n.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
"out": {
"espIdf": {
"menuconfig": {
"MenuconfigPanel": [
"menuconfig.panelName",
"menuconfig.loadDefaultValues",
"menuconfig.discardValues",
"menuconfig.saveValues",
"menuconfig.wrongIdfPath",
"menuconfig.enterIdfPath",
"menuconfig.changesNotSaved",
"menuconfig.save",
"menuconfig.discard",
"menuconfig.returnGuiconfig"
]
},
"serial": {
"SerialPort": [
"serial.notSerialPortFoundMessage",
"serial.noPortSelectedMessage",
"serial.portHasBeenSelectedMessage",
"serial.selectSerialPortMessage"
]
},
"size": {
"idfSize": [
"idfSize.canceledError",
"idfSize.filesMsg",
"idfSize.buildFirstError",
"idfSize.overviewMsg",
"idfSize.archivesMsg",
"idfSize.commandError"
]
}
},
"extension": [
"extension.defaultFoldersGeneratedMessage",
"extension.openFolderFirst",
"espIdf.pickAWorkspaceFolder.text",
"extension.noFolderMessage",
"selectFrameworkMessage",
"extension.noOptionMessage",
"extension.noPathUpdatedMessage",
"extension.selectConfigMessage",
"extension.noParamUpdatedMessage",
"extension.defaultSdkconfigGeneratedMessage",
"extension.openFolderSdkconfigMessage",
"extension.waitProcessIsFinishedMessage",
"extension.elfNotFoundMessage",
"extension.gdbNotFoundMessage",
"extension.enterIdfPathMessage",
"extension.enterIdfToolsPathMessage",
"extension.enterDevicePortMessage",
"extension.enterDeviceTargetMessage",
"extension.enterDeviceBaudRateMessage",
"extension.enterOpenOcdConfigMessage",
"extension.enterCustomPathsMessage",
"extension.cmdNotWebIDE"
],
"idfComponentsDataProvider": [
"idfComponentDataProvider.proj_desc_not_found"
],
"idfConfiguration": [
"idfConfiguration.hasBeenUpdated"
],
"utils": [
"utils.currentFolder",
"utils.openComponentTitle"
]
},
"views": {
"menuconfig": [
"save",
"discard",
"reset"
]
},
"package": [
"espIdf.createFiles.title",
"espIdf.createVsCodeFolder.title",
"espIdf.setPath.title",
"espIdf.setTarget.title",
"espIdf.configDevice.title",
"menuconfig.start.title",
"espIdf.setDefaultConfig.title",
"espIdf.selectPort.title",
"espIdf.buildDevice.title",
"espIdf.flashDevice.title",
"espIdf.monitorDevice.title",
"espIdf.onboarding.title",
"espIdf.examples.title",
"espIdf.buildFlashMonitor.title",
"espIdf.pickAWorkspaceFolder.title",
"espIdf.size.title",
"espIdf.apptrace.title",
"espIdf.openOCDCommand.title",
"debug.initConfig.name",
"debug.initConfig.description",
"param.adapterTargetName",
"param.openOcdConfigFilesList",
"param.baudRate",
"param.port",
"param.pythonBinPath",
"param.pythonSystemBinPath",
"param.espIdfPath",
"param.toolsPath",
"param.exportPaths",
"param.exportVars",
"param.useIDFKConfigStyle",
"param.showOnboardingOnInit",
"view.components.name",
"configuration.title",
"espIdf.apptrace.archive.refresh.title",
"espIdf.apptrace.archive.showReport.title",
"espIdf.apptrace.customize.title",
"trace.poll_period.description",
"trace.trace_size.description",
"trace.stop_tmo.description",
"trace.wait4halt.description",
"trace.skip_size.description"
]
}

0 comments on commit 24b5566

Please sign in to comment.