Conversation
There was a problem hiding this comment.
Pull request overview
This PR attempts to add support for Visual Studio 2026 by checking for the existence of Visual Studio version "18" directory and falling back to Visual Studio 2022 if not found. The changes update Windows-specific build tool initialization in two locations within the mcu_plugin.js file.
Changes:
- Added conditional checks to detect Visual Studio 2026 (version 18) installation
- Maintained fallback to Visual Studio 2022 when VS2026 is not present
- Updated both the MODDABLE tools version check and ESP32 build command initialization
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
mcu_plugin.js
Outdated
| if (fs.existsSync(`${process.env["ProgramFiles"]}\\Microsoft Visual Studio\\18`)) { | ||
| let testcmd = [ | ||
| `CALL "${process.env["ProgramFiles"]}\\Microsoft Visual Studio\\18\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat" > nul`, | ||
| `cd /D ${MODDABLE}\\build\\bin\\win\\debug`, | ||
| 'dumpbin /headers xsbug.exe | findstr "machine"' | ||
| ].join(" && "); | ||
| } else { | ||
| let testcmd = [ | ||
| `CALL "${process.env["ProgramFiles"]}\\Microsoft Visual Studio\\2022\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat" > nul`, | ||
| `cd /D ${MODDABLE}\\build\\bin\\win\\debug`, | ||
| 'dumpbin /headers xsbug.exe | findstr "machine"' | ||
| ].join(" && "); | ||
| } |
There was a problem hiding this comment.
The testcmd variable is declared with let inside both the if and else blocks, making it scoped only to those blocks. However, it's used outside at line 297 in execSync(testcmd, ...). This will cause a ReferenceError at runtime. The variable declaration should be moved before the if statement, and only the assignment should be inside the blocks.
mcu_plugin.js
Outdated
| if (fs.existsSync(`${process.env["ProgramFiles"]}\\Microsoft Visual Studio\\18`)) { | ||
| let testcmd = [ | ||
| `CALL "${process.env["ProgramFiles"]}\\Microsoft Visual Studio\\18\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat" > nul`, | ||
| `cd /D ${MODDABLE}\\build\\bin\\win\\debug`, | ||
| 'dumpbin /headers xsbug.exe | findstr "machine"' | ||
| ].join(" && "); | ||
| } else { | ||
| let testcmd = [ |
There was a problem hiding this comment.
Unused variable testcmd.
| if (fs.existsSync(`${process.env["ProgramFiles"]}\\Microsoft Visual Studio\\18`)) { | |
| let testcmd = [ | |
| `CALL "${process.env["ProgramFiles"]}\\Microsoft Visual Studio\\18\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat" > nul`, | |
| `cd /D ${MODDABLE}\\build\\bin\\win\\debug`, | |
| 'dumpbin /headers xsbug.exe | findstr "machine"' | |
| ].join(" && "); | |
| } else { | |
| let testcmd = [ | |
| let testcmd; | |
| if (fs.existsSync(`${process.env["ProgramFiles"]}\\Microsoft Visual Studio\\18`)) { | |
| testcmd = [ | |
| `CALL "${process.env["ProgramFiles"]}\\Microsoft Visual Studio\\18\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat" > nul`, | |
| `cd /D ${MODDABLE}\\build\\bin\\win\\debug`, | |
| 'dumpbin /headers xsbug.exe | findstr "machine"' | |
| ].join(" && "); | |
| } else { | |
| testcmd = [ |
mcu_plugin.js
Outdated
| if (fs.existsSync(`${process.env["ProgramFiles"]}\\Microsoft Visual Studio\\18`)) { | ||
| let testcmd = [ | ||
| `CALL "${process.env["ProgramFiles"]}\\Microsoft Visual Studio\\18\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat" > nul`, | ||
| `cd /D ${MODDABLE}\\build\\bin\\win\\debug`, | ||
| 'dumpbin /headers xsbug.exe | findstr "machine"' | ||
| ].join(" && "); | ||
| } else { | ||
| let testcmd = [ |
There was a problem hiding this comment.
Unused variable testcmd.
| if (fs.existsSync(`${process.env["ProgramFiles"]}\\Microsoft Visual Studio\\18`)) { | |
| let testcmd = [ | |
| `CALL "${process.env["ProgramFiles"]}\\Microsoft Visual Studio\\18\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat" > nul`, | |
| `cd /D ${MODDABLE}\\build\\bin\\win\\debug`, | |
| 'dumpbin /headers xsbug.exe | findstr "machine"' | |
| ].join(" && "); | |
| } else { | |
| let testcmd = [ | |
| let testcmd; | |
| if (fs.existsSync(`${process.env["ProgramFiles"]}\\Microsoft Visual Studio\\18`)) { | |
| testcmd = [ | |
| `CALL "${process.env["ProgramFiles"]}\\Microsoft Visual Studio\\18\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat" > nul`, | |
| `cd /D ${MODDABLE}\\build\\bin\\win\\debug`, | |
| 'dumpbin /headers xsbug.exe | findstr "machine"' | |
| ].join(" && "); | |
| } else { | |
| testcmd = [ |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
NW-Lab
left a comment
There was a problem hiding this comment.
Made it easier to read thanks to Copilot's suggestion.
Hello
The Windows version of Moddable SDK v7 is now Visual Studio 2026, so I added it.
Thank you.