@@ -7,6 +7,7 @@ Zephyr IDE is a VS Code extension that provides comprehensive tools for Zephyr R
7
7
## Working Effectively
8
8
9
9
### Bootstrap and Dependencies
10
+
10
11
** CRITICAL: All build and test commands take significant time. NEVER CANCEL operations.**
11
12
12
13
``` bash
@@ -24,13 +25,14 @@ which ninja && ninja --version
24
25
```
25
26
26
27
### Build Commands
28
+
27
29
** Set timeouts to 10+ minutes for all build commands. NEVER CANCEL.**
28
30
29
31
``` bash
30
32
# Compile TypeScript (3 seconds)
31
33
npm run test-compile
32
34
33
- # Compile for development (3 seconds)
35
+ # Compile for development (3 seconds)
34
36
npm run compile
35
37
36
38
# Bundle extension with esbuild (1 second)
@@ -47,6 +49,7 @@ npm run pretest
47
49
```
48
50
49
51
### Testing Commands
52
+
50
53
** CRITICAL: Integration tests take 10-15 minutes each. Set timeouts to 20+ minutes. NEVER CANCEL.**
51
54
52
55
``` bash
@@ -57,16 +60,17 @@ npm test
57
60
# Run specific integration test suites (requires Zephyr SDK)
58
61
# TIMEOUT: 15+ minutes each - NEVER CANCEL
59
62
xvfb-run -a node scripts/run-integration-tests.js standard
60
- xvfb-run -a node scripts/run-integration-tests.js git
63
+ xvfb-run -a node scripts/run-integration-tests.js west- git
61
64
xvfb-run -a node scripts/run-integration-tests.js zephyr-ide-git
62
- xvfb-run -a node scripts/run-integration-tests.js open-current-dir
63
- xvfb-run -a node scripts/run-integration-tests.js out-of-tree
65
+ xvfb-run -a node scripts/run-integration-tests.js local-west
66
+ xvfb-run -a node scripts/run-integration-tests.js external-zephyr
64
67
65
68
# Skip actual Zephyr builds in tests (faster testing)
66
69
SKIP_BUILD_TESTS=true npm test
67
70
```
68
71
69
72
### VS Code Extension Development
73
+
70
74
``` bash
71
75
# Open extension for development
72
76
# 1. Open VS Code in the repository directory
@@ -80,23 +84,27 @@ SKIP_BUILD_TESTS=true npm test
80
84
** ALWAYS test these scenarios after making changes to ensure functionality:**
81
85
82
86
### Manual Extension Validation
87
+
83
88
1 . ** Extension Loading** : Press F5 to launch extension host, verify Zephyr IDE appears in activity bar
84
89
2 . ** Workspace Setup** : Test workspace initialization commands work
85
90
3 . ** Project Creation** : Verify project creation from templates functions
86
91
4 . ** Build Configuration** : Test build configuration setup
87
92
5 . ** Command Palette** : Verify all "Zephyr IDE:" commands are available
88
93
89
94
### Integration Test Coverage
95
+
90
96
The integration tests validate complete workflows:
97
+
91
98
- ** Standard Workspace** : Dependencies → west setup → SDK install → project creation → build (15 min)
92
- - ** Git Workspace** : Git clone → SDK → project → custom board build (15 min)
99
+ - ** Git Workspace** : Git clone → SDK → project → custom board build (15 min)
93
100
- ** Zephyr IDE Git** : Zephyr IDE specific git workflow (15 min)
94
101
- ** Open Directory** : Current directory workspace setup (15 min)
95
- - ** Out of Tree ** : Out-of-tree project builds (15 min)
102
+ - ** External Zephyr ** : External zephyr workspace builds (15 min)
96
103
97
104
## Repository Structure
98
105
99
106
### Core Source Files
107
+
100
108
```
101
109
src/
102
110
├── extension.ts - Main extension entry point, registers commands and webview panels
@@ -131,11 +139,11 @@ src/
131
139
│ ├── flash.ts - Device flashing and debugging
132
140
│ └── twister.ts - Test execution and reporting
133
141
├── test/ - Integration test suites (15+ min each)
134
- │ ├── standard- workspace.test.ts - Full workspace setup → build
135
- │ ├── west-git-workspace .test.ts - Git-based workspace creation
136
- │ ├── zephyr-ide-git-workspace .test.ts - Zephyr IDE specific git workflow
137
- │ ├── open-current-directory .test.ts - Current directory workspace
138
- │ ├── workspace-out-of-tree .test.ts - Out-of-tree project builds
142
+ │ ├── workspace-standard .test.ts - Full workspace setup → build
143
+ │ ├── workspace- west-git.test.ts - Git-based workspace creation
144
+ │ ├── workspace- zephyr-ide-git.test.ts - Zephyr IDE specific git workflow
145
+ │ ├── workspace-local-west .test.ts - Current directory workspace
146
+ │ ├── workspace-external-zephyr .test.ts - External zephyr workspace builds
139
147
│ ├── test-runner.ts - Test execution framework
140
148
│ └── ui-mock-interface.ts - Mock UI for headless testing
141
149
└── utilities/ - Shared helper functions
145
153
```
146
154
147
155
### Build and Distribution
156
+
148
157
```
149
158
dist/ - Production bundled extension (esbuild output)
150
159
out/ - Development compiled TypeScript (tsc output)
@@ -153,6 +162,7 @@ west_templates/ - West.yml templates for different workspace types
153
162
```
154
163
155
164
### Configuration Files
165
+
156
166
```
157
167
package.json - Extension manifest, commands, activation events, npm scripts
158
168
tsconfig.json - TypeScript compilation settings, path mappings
@@ -163,6 +173,7 @@ tsconfig.json - TypeScript compilation settings, path mappings
163
173
```
164
174
165
175
### Key Architecture Patterns
176
+
166
177
- ** Command Registration** : All VS Code commands defined in ` package.json ` and registered in ` extension.ts `
167
178
- ** Webview Communication** : Panels use message passing between TypeScript and HTML/JS
168
179
- ** State Management** : Extension state persisted via VS Code APIs in ` state-management.ts `
@@ -172,6 +183,7 @@ tsconfig.json - TypeScript compilation settings, path mappings
172
183
## Common Development Tasks
173
184
174
185
### Code Changes Workflow
186
+
175
187
``` bash
176
188
# 1. Make code changes to src/
177
189
# 2. Compile and lint
@@ -187,7 +199,9 @@ xvfb-run -a node scripts/run-integration-tests.js standard # Full test
187
199
```
188
200
189
201
### Before Committing
202
+
190
203
** ALWAYS run these commands before committing changes:**
204
+
191
205
``` bash
192
206
# Required for CI to pass
193
207
npm run lint
@@ -199,6 +213,7 @@ npm run pretest
199
213
```
200
214
201
215
### Extension Packaging
216
+
202
217
``` bash
203
218
# Build for production
204
219
npm run vscode:prepublish
@@ -210,28 +225,33 @@ vsce package
210
225
## Troubleshooting
211
226
212
227
### Build Issues
228
+
213
229
- ** TypeScript errors** : Run ` npm run compile ` to see detailed errors
214
230
- ** Bundling issues** : Check ` npm run esbuild ` output
215
231
- ** Lint failures** : Run ` npm run lint ` and fix ESLint warnings
216
232
217
- ### Test Issues
233
+ ### Test Issues
234
+
218
235
- ** VS Code download failures** : Network connectivity issue, retry tests
219
236
- ** Integration test timeouts** : NEVER CANCEL - tests take 15+ minutes
220
237
- ** Zephyr build failures** : Install Zephyr SDK and build dependencies
221
238
- ** Mock UI failures** : Check UI mock interface in test files
222
239
223
240
### Development Issues
241
+
224
242
- ** Extension not loading** : Check console for errors in extension host
225
243
- ** Commands not working** : Verify command registration in package.json
226
244
- ** Webview issues** : Check panel implementations in src/panels/
227
245
228
246
## CI/CD Integration
229
247
230
248
The ` .github/workflows/integration-tests.yml ` runs on:
249
+
231
250
- Push to main, pre-release, develop branches
232
251
- Pull requests to those branches
233
252
234
253
** CI Requirements:**
254
+
235
255
- Ubuntu with Zephyr build tools
236
256
- 20+ minute timeouts for integration tests
237
257
- xvfb for headless VS Code testing
@@ -247,28 +267,32 @@ The `.github/workflows/integration-tests.yml` runs on:
247
267
## Dependencies
248
268
249
269
### Required for Development
270
+
250
271
- Node.js 18+ (for npm and extension bundling)
251
272
- VS Code (for extension development and testing)
252
273
- Git (for version control)
253
274
254
275
### Required for Full Testing
276
+
255
277
- Python 3.8+ with pip
256
278
- west (` pip3 install west ` )
257
279
- cmake, ninja-build
258
280
- Zephyr SDK (for integration tests)
259
281
- xvfb (for headless testing on Linux)
260
282
261
283
### System Packages (Ubuntu)
284
+
262
285
``` bash
263
286
sudo apt-get install python3-pip python3-venv cmake ninja-build gperf \
264
287
ccache dfu-util device-tree-compiler wget file make gcc gcc-multilib \
265
288
g++-multilib libsdl2-dev libmagic1
266
289
```
267
290
268
291
** TIMING EXPECTATIONS:**
292
+
269
293
- npm install: ~ 40 seconds
270
- - TypeScript compilation: ~ 3 seconds
294
+ - TypeScript compilation: ~ 3 seconds
271
295
- ESLint: ~ 2 seconds
272
296
- esbuild bundling: ~ 1 second
273
297
- Integration tests: 15+ minutes each - NEVER CANCEL
274
- - Full CI pipeline: 60+ minutes - NEVER CANCEL
298
+ - Full CI pipeline: 60+ minutes - NEVER CANCEL
0 commit comments