Skip to content

Commit 9b290d4

Browse files
committed
Added gRPC placeholders to report compile progress
1 parent 3a6dbbb commit 9b290d4

File tree

5 files changed

+43
-24
lines changed

5 files changed

+43
-24
lines changed

cli/compile/compile.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,9 @@ func runCompileCommand(cmd *cobra.Command, args []string) {
199199
var compileRes *rpc.CompileResponse
200200
var compileError error
201201
if output.OutputFormat == "json" {
202-
compileRes, compileError = compile.Compile(context.Background(), compileRequest, compileStdOut, compileStdErr, verboseCompile)
202+
compileRes, compileError = compile.Compile(context.Background(), compileRequest, compileStdOut, compileStdErr, nil, verboseCompile)
203203
} else {
204-
compileRes, compileError = compile.Compile(context.Background(), compileRequest, os.Stdout, os.Stderr, verboseCompile)
204+
compileRes, compileError = compile.Compile(context.Background(), compileRequest, os.Stdout, os.Stderr, nil, verboseCompile)
205205
}
206206

207207
if compileError == nil && uploadAfterCompile {

commands/compile/compile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import (
4646
var tr = i18n.Tr
4747

4848
// Compile FIXMEDOC
49-
func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream io.Writer, debug bool) (r *rpc.CompileResponse, e error) {
49+
func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream io.Writer, progressCB commands.TaskProgressCB, debug bool) (r *rpc.CompileResponse, e error) {
5050

5151
// There is a binding between the export binaries setting and the CLI flag to explicitly set it,
5252
// since we want this binding to work also for the gRPC interface we must read it here in this

commands/daemon/daemon.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ func (s *ArduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu
262262
stream.Context(), req,
263263
utils.FeedStreamTo(func(data []byte) { stream.Send(&rpc.CompileResponse{OutStream: data}) }),
264264
utils.FeedStreamTo(func(data []byte) { stream.Send(&rpc.CompileResponse{ErrStream: data}) }),
265+
func(p *rpc.TaskProgress) { stream.Send(&rpc.CompileResponse{Progress: p}) },
265266
false) // Set debug to false
266267
if err != nil {
267268
return convertErrorToRPCStatus(err)

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

Lines changed: 35 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ message CompileRequest {
8383
}
8484

8585
message CompileResponse {
86-
// The output of the compilation process.
86+
// The output of the compilation process (stream)
8787
bytes out_stream = 1;
88-
// The error output of the compilation process.
88+
// The error output of the compilation process (stream)
8989
bytes err_stream = 2;
9090
// The compiler build path
9191
string build_path = 3;
@@ -97,6 +97,8 @@ message CompileResponse {
9797
PlatformReference board_platform = 6;
9898
// The platform used for the build (if referenced from the board platform)
9999
PlatformReference build_platform = 7;
100+
// Completions reports of the compilation process (stream)
101+
TaskProgress progress = 8;
100102
}
101103

102104
message ExecutableSectionSize {

0 commit comments

Comments
 (0)