Skip to content

Fix sketch metadata loader #690

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 7, 2020

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented May 7, 2020

  • The PR has no duplicates (please search among the Pull Requests before creating one)
  • The PR follows our contributing guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

This PR makes sketches.NewSketchFromPath tolerant to different input paths:

  1. sketch := sketches.NewSketchFromPath(paths.New("path/to/sketch"))
  2. sketch := sketches.NewSketchFromPath(paths.New("path/to/sketch/sketch.ino"))

Previously the function would return different Sketch struct with different Name fields:

  1. sketch.Name == "sketch"
  2. sketch.Name == "sketch.ino"

now it will return the same Name consistently in both cases:

  1. sketch.Name == "sketch"
  2. sketch.Name == "sketch"

This PR solves the different treatment of sketch path argument between compile, upload and debug. In particular, using the combined compile + upload with a sketch path containing .ino previously produced a sucessful compile followed by an upload error (because upload will not find the output file due to the extra .ino. This behaviour is now fixed.

cmaglie added 3 commits May 7, 2020 17:29
case 1: /path/to/sketch
case 2: /path/to/sketch/sketch.ino

in the case 2 a compile+upload combo gives the following error:

Error during Upload: cannot open sketch: stat /tmp/pytest-of-megabug/pytest-35/ArduinoTest1/CompileAndUploadIntegrationTest/CompileAndUploadIntegrationTest.ino/CompileAndUploadIntegrationTest.ino.arduino.samd.mkr1000.bin: not a directory
@cmaglie cmaglie requested review from masci and rsora and removed request for masci May 7, 2020 15:45
@cmaglie cmaglie self-assigned this May 7, 2020
@cmaglie cmaglie added this to the 0.11.0 milestone May 7, 2020
Paths are converted to \ when extracting Parent().

=== RUN   TestSketchLoadingFromFolderOrMainFile
testdata/Sketch1 == testdata/Sketch1
testdata\Sketch1 == testdata/Sketch1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants