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

Added gRPC interface to collect every sketch file #926

Merged
merged 2 commits into from
Aug 31, 2020

Conversation

silvanocerza
Copy link
Contributor

@silvanocerza silvanocerza commented Aug 26, 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?
    Exposes a gRPC interface to collect all files composing a sketch.
  • What is the current behavior?
    gRPC interface is not exposed.
  • What is the new behavior?
    gRPC consumers have a way to collect all files composing a sketch.
  • Does this PR introduce a breaking change?
    Nope.

See how to contribute

@silvanocerza
Copy link
Contributor Author

Codecov link is failing again, the rest of the tests are fine. 🤷

Copy link
Contributor

@kittaakos kittaakos left a comment

Choose a reason for hiding this comment

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

I am going to try how it behaves in the IDE. Thank you for creating the PR 👍

Comment on lines 224 to 227
// Progress of the downloads of the platforms and libraries files.
DownloadProgress progress = 2;
// Description of the current stage of the upgrade.
TaskProgress task_progress = 3;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No idea, I didn't manually change it, it's probably some auto formatting that I missed.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not about the indentation; this is a change from 1 to 2, and from 2 to 3. Just asking though...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I noticed it. Still not sure how it did happen. 🤷

func SketchLoad(ctx context.Context, req *rpc.SketchLoadReq) (*rpc.SketchLoadResp, error) {
sketch, err := builder.SketchLoad(req.SketchPath, "")
if err != nil {
return nil, fmt.Errorf("Error loading sketch: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make req.SketchPath as part of the error message?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we could but think that some informationg is already in err.

@@ -58,6 +58,9 @@ service ArduinoCore {
// Get the version of Arduino CLI in use.
rpc Version(VersionReq) returns (VersionResp) {}

// Returns all files composing a Sketch
rpc SketchLoad(SketchLoadReq) returns (SketchLoadResp) {}
Copy link
Contributor

Choose a reason for hiding this comment

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

[minor]: Why not LoadSketch? (verb + object)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've used the same name that's used in the builder package: https://github.com/arduino/arduino-cli/blob/master/arduino/builder/sketch.go#L103

I can change it LoadSketch with no issues by the way, I like the suggestion.

Comment on lines 237 to 240
message SketchLoadReq {
// Absolute path to single sketch file or a sketch folder
string sketch_path = 1;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This should also include the instance.

message SketchLoadReq {
  Instance instance = 1;
  // Absolute path to single sketch file or a sketch folder
  string sketch_path = 2;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure!

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, I do not know if it's required, but strange to not having symmetric APIs. @cmaglie, can you please help with this? Thank you!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't include it because it's actually not used by that command but I guess it costs nothing adding it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Works well so far, great simplification for the IDE. Thanks!

@silvanocerza
Copy link
Contributor Author

Fixed those issues you pointed out @kittaakos.

@silvanocerza silvanocerza merged commit 21d2533 into master Aug 31, 2020
@silvanocerza silvanocerza deleted the scerza/collect-sketch-files branch August 31, 2020 13:08
silvanocerza added a commit that referenced this pull request Aug 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

As a gRPC consumer, I want the CLI to collects all the files composing a sketch
3 participants