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

Reintroduce the `--input-file` flag for the `upload` command #777

Merged
merged 16 commits into from Sep 7, 2020

Conversation

@rsora
Copy link
Contributor

@rsora rsora commented Jul 3, 2020

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)
  • What kind of change does this PR introduce?

This PR reintroduces the -i --input-file flag for the upload command, allowing to upload a single binary, according to the core recipe

  • What is the current behavior?

You cannot specify a single binary file for the upload

  • What is the new behavior?

This command allows the user to upload a specific pre-built binary

arduino-cli upload -b arduino:samd:mkrwifi1010 -p /dev/ttyACM1 --input-file foo.ino.bin
  • Does this PR introduce a breaking change?

Reintroduces the flag that was deprecated in the last release (0.11.0)

  • Other information:

Please note that the sketch binary extension (.bin in my example above) passed as the --input-file value will be ignored, because the file extension for the binary files is explicity set at the core recipe level for each board.

See for example here for the arduino:samd:mkrwifi1010 board upload recipe, that the .bin file is set explicitly:

tools.bossac.upload.pattern="{path}/{cmd}" {upload.verbose} --port={serial.port.file} -U {upload.native_usb} -i -e -w -v "{build.path}/{build.project_name}.bin" -R


See how to contribute

Copy link
Member

@cmaglie cmaglie left a comment

Added some inline requests.

The business logic is OK.

commands/upload/upload.go Outdated Show resolved Hide resolved
cli/upload/upload.go Outdated Show resolved Hide resolved
cli/upload/upload.go Outdated Show resolved Hide resolved
@rsora rsora force-pushed the rsora/upload-binfile branch from 9b3c87d to e10d0ff Jul 7, 2020
@cmaglie cmaglie force-pushed the rsora/upload-binfile branch 3 times, most recently from 25aab3a to c8b36e5 Sep 7, 2020
cmaglie added 7 commits Sep 7, 2020
This should make the upload command compatibile with all the reasonable
usages.

See #764
See #641
There is no point in overriding the sketch name if the user explicitly
give it via command line.
fixes EquivalentTo when used with abs paths
@cmaglie cmaglie force-pushed the rsora/upload-binfile branch from c8b36e5 to f2c4839 Sep 7, 2020
@cmaglie
Copy link
Member

@cmaglie cmaglie commented Sep 7, 2020

Ok, this one looked easy at a first glance but ended up being very complicated.
We basically have 4 flags to handle:

  • --input-dir specified or not
  • --input-file specified or not
  • path of the sketch specified or not
  • running the CLI from a sketch folder or not
--input-dir --input-file sketch run in sketch dir output
N N N N error: no sketch found
Y N N N OK
N Y N N OK
Y Y N N error: --input-file and --input-dir flags cannot be used together
N N Y N OK
Y N Y N OK, use --input-dir, sketch ignored
N Y Y N OK, use --input-file, sketch ignored
Y Y Y N error: --input-file and --input-dir flags cannot be used together
N N N Y OK
Y N N Y OK, use --input-dir, sketch ignored
N Y N Y OK, use --input-file, sketch ignored
Y Y N Y error: --input-file and --input-dir flags cannot be used together
N N Y Y OK, use the sketch specified via command line
Y N Y Y OK, use --input-dir, sketch ignored
N Y Y Y OK, use --input-file, sketch ignored
Y Y Y Y error: --input-file and --input-dir flags cannot be used together
@cmaglie
cmaglie approved these changes Sep 7, 2020
Copy link
Member

@cmaglie cmaglie left a comment

auto-approving my changes :-)

Copy link

@ubidefeo ubidefeo left a comment

tested both with programmer and bootloader
worked as expected

commands/upload/upload.go Outdated Show resolved Hide resolved
cli/upload/upload.go Show resolved Hide resolved
@cmaglie cmaglie merged commit f1877ef into master Sep 7, 2020
12 of 14 checks passed
12 of 14 checks passed
verify-links verify-links
Details
verify-links verify-links
Details
Lints Python code Lints Python code
Details
test-matrix (ubuntu-latest) test-matrix (ubuntu-latest)
Details
test-matrix (ubuntu-latest) test-matrix (ubuntu-latest)
Details
validate validate
Details
test-matrix (windows-latest) test-matrix (windows-latest)
Details
test-matrix (windows-latest) test-matrix (windows-latest)
Details
test-matrix (macOS-latest) test-matrix (macOS-latest)
Details
test-matrix (macOS-latest) test-matrix (macOS-latest)
Details
create-test-artifacts
Details
create-test-artifacts
Details
codecov/project Codecov Report
Details
license/cla Contributor License Agreement is signed.
Details
@cmaglie cmaglie deleted the rsora/upload-binfile branch Sep 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants