Sketch compiling via commandline does not check for valid primary .ino filename
- Dominant language
- Java
- Stars
- 14.6k
- Forks
- 7k
- PR merge metrics
- No merged PRs in 30d
Description
When the Arduino IDE is invoked via the command line for a Verify or Upload task, such as when an external tool like [microsoft/vscode-arduino](/microsoft/vscode-arduino) invokes a build, but the name of the sketch file provided on the command line does not match its containing folder name, the first file from `FileUtils.listFiles` is used as the "primary" file, resulting in undefined behavior (the order returned by `listFiles` seems non-deterministic) and apparent obscure bugs such as the one I filed at microsoft/vscode-arduino#1100.
The requirement to have the `.ino` file match the folder name seems arbitrary and restrictive for command-line compilations when the IDE itself is not being used for development. I developed a simple fix for this on my own branch and plan on filing a PR.
Contributor guide
Research direction
Trace command-line Verify and Upload handling to the primary sketch selection and inspect how FileUtils.listFiles is used. Reproduce a sketch whose .ino filename differs from its containing folder, then verify that the selected primary file is valid and deterministic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100