Skip to content
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

Fix upload command not working as expected when certain flags are used #1429

Merged
merged 2 commits into from
Sep 2, 2021

Conversation

silvanocerza
Copy link
Contributor

Please check if the PR fulfills these requirements

  • 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)
  • UPGRADING.md has been updated with a migration guide (for breaking changes)
  • What kind of change does this PR introduce?

Fixes two bugs with a CLI command.

  • What is the current behavior?

upload fails if the --input-dir or --input-file are used and Sketch path is not specified.
upload fails if --fqbn is not set even if specified in a sketch.json file.

  • What is the new behavior?

upload doesn't fail --input-dir or --input-file are set and no Sketch path is specified.
upload doesn't fail if --fqbn is not specified and sketch.json contains a valid FQBN.

Nope.

  • Other information:

To verify that this PR fixes the aforementioned issue the integration tests must be run locally with a board connected.
Arduino Uno and Arduino MKR WiFi 1010 are recommended.


See how to contribute

@silvanocerza silvanocerza requested a review from a team September 1, 2021 15:26
@silvanocerza silvanocerza self-assigned this Sep 1, 2021
var sketchPath *paths.Path
var sk *sketch.Sketch = nil
// If the user explicitly specified a directory that contains binaries to upload
// use those, we don't really need a valid Sketch to upload in this case
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we care about this use case (which used to be supported), where the sketch argument could be used to provide sketch.json metadata when using a binary?:

$ ./arduino-cli version
arduino-cli.exe alpha Version: 0.18.3 Commit: d710b642 Date: 2021-05-14T12:36:58Z

$ ./arduino-cli sketch new /tmp/FooSketch
Sketch created in: C:\Users\per\AppData\Local\Temp\FooSketch

$ ./arduino-cli board attach arduino:avr:uno /tmp/FooSketch
Selected fqbn: arduino:avr:uno

$ ./arduino-cli compile --output-dir /tmp/FooSketchBin /tmp/FooSketch
Sketch uses 444 bytes (1%) of program storage space. Maximum is 32256 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.

$ ./arduino-cli upload -v -p COM10 --input-dir /tmp/FooSketchBin /tmp/FooSketch
"C:\program-files\arduino\cli\arduino-cli_nightly\directories-data\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-CC:\program-files\arduino\cli\arduino-cli_nightly\directories-data\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v -V -patmega328p -carduino "-PCOM10" -b115200 -D "-Uflash:w:C:/Users/per/AppData/Local/Temp/FooSketchBin/FooSketch.ino.hex:i"

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

[...]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, didn't think about that case. 🤔
I'll try to fix it.

Copy link
Contributor Author

@silvanocerza silvanocerza Sep 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed with 51b1be6.

Copy link
Contributor

@per1234 per1234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes all three types of uploading issue for me.

@silvanocerza silvanocerza merged commit 007c0d3 into master Sep 2, 2021
@silvanocerza silvanocerza deleted the scerza/fix-upload-command branch September 2, 2021 10:01
silvanocerza added a commit that referenced this pull request Sep 2, 2021
#1429)

* Fix upload command not working as expected when certain flags are used

* Fix absurd upload corner case
@rsora rsora added type: imperfection Perceived defect in any part of project topic: CLI Related to the command line interface labels Sep 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: CLI Related to the command line interface type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants