Skip to content

Commit cf4505e

Browse files
committed
Factored Sketch message in gRPC API for 'LoadSketch' call
1 parent 5fdd18b commit cf4505e

File tree

8 files changed

+843
-770
lines changed

8 files changed

+843
-770
lines changed

commands/daemon/daemon.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func (s *ArduinoCoreServerImpl) NewSketch(ctx context.Context, req *rpc.NewSketc
170170
// LoadSketch FIXMEDOC
171171
func (s *ArduinoCoreServerImpl) LoadSketch(ctx context.Context, req *rpc.LoadSketchRequest) (*rpc.LoadSketchResponse, error) {
172172
resp, err := sketch.LoadSketch(ctx, req)
173-
return resp, convertErrorToRPCStatus(err)
173+
return &rpc.LoadSketchResponse{Sketch: resp}, convertErrorToRPCStatus(err)
174174
}
175175

176176
// SetSketchDefaults FIXMEDOC

commands/sketch/load.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
)
2626

2727
// LoadSketch collects and returns all information about a sketch
28-
func LoadSketch(ctx context.Context, req *rpc.LoadSketchRequest) (*rpc.LoadSketchResponse, error) {
28+
func LoadSketch(ctx context.Context, req *rpc.LoadSketchRequest) (*rpc.Sketch, error) {
2929
sk, err := sketch.New(paths.New(req.GetSketchPath()))
3030
if err != nil {
3131
return nil, &cmderrors.CantOpenSketchError{Cause: err}

internal/arduino/sketch/sketch.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,9 @@ func (s *Sketch) Hash() string {
311311
}
312312

313313
// ToRpc converts this Sketch into a rpc.LoadSketchResponse
314-
func (s *Sketch) ToRpc() *rpc.LoadSketchResponse {
314+
func (s *Sketch) ToRpc() *rpc.Sketch {
315315
defaultPort, defaultProtocol := s.GetDefaultPortAddressAndProtocol()
316-
res := &rpc.LoadSketchResponse{
316+
res := &rpc.Sketch{
317317
MainFile: s.MainFile.String(),
318318
LocationPath: s.FullPath.String(),
319319
OtherSketchFiles: s.OtherSketchFiles.AsStrings(),

rpc/cc/arduino/cli/commands/v1/commands.pb.go

+540-721
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rpc/cc/arduino/cli/commands/v1/commands.proto

+2-28
Original file line numberDiff line numberDiff line change
@@ -326,35 +326,9 @@ message LoadSketchRequest {
326326
reserved 1;
327327
}
328328

329-
message SketchProfile {
330-
// Name of the profile
331-
string name = 1;
332-
// FQBN used by the profile
333-
string fqbn = 2;
334-
}
335-
336329
message LoadSketchResponse {
337-
// Absolute path to a main sketch files
338-
string main_file = 1;
339-
// Absolute path to folder that contains main_file
340-
string location_path = 2;
341-
// List of absolute paths to other sketch files
342-
repeated string other_sketch_files = 3;
343-
// List of absolute paths to additional sketch files
344-
repeated string additional_files = 4;
345-
// List of absolute paths to supported files in the sketch root folder, main
346-
// file excluded
347-
repeated string root_folder_files = 5;
348-
// Default FQBN set in project file (sketch.yaml)
349-
string default_fqbn = 6;
350-
// Default Port set in project file (sketch.yaml)
351-
string default_port = 7;
352-
// Default Protocol set in project file (sketch.yaml)
353-
string default_protocol = 8;
354-
// List of profiles present in the project file (sketch.yaml)
355-
repeated SketchProfile profiles = 9;
356-
// Default profile set in the project file (sketch.yaml)
357-
SketchProfile default_profile = 10;
330+
// The loaded sketch
331+
Sketch sketch = 1;
358332
}
359333

360334
message ArchiveSketchRequest {

rpc/cc/arduino/cli/commands/v1/common.pb.go

+264-16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)