diff --git a/commands/service_compile.go b/commands/service_compile.go index a8c5cbabb4e..69865f3522c 100644 --- a/commands/service_compile.go +++ b/commands/service_compile.go @@ -41,7 +41,7 @@ import ( // CompilerServerToStreams creates a gRPC CompileServer that sends the responses to the provided streams. // The returned callback function can be used to retrieve the builder result after the compilation is done. -func CompilerServerToStreams(ctx context.Context, stdOut, stderr io.Writer) (server rpc.ArduinoCoreService_CompileServer, resultCB func() *rpc.BuilderResult) { +func CompilerServerToStreams(ctx context.Context, stdOut, stderr io.Writer, progressCB rpc.TaskProgressCB) (server rpc.ArduinoCoreService_CompileServer, resultCB func() *rpc.BuilderResult) { var builderResult *rpc.BuilderResult stream := streamResponseToCallback(ctx, func(resp *rpc.CompileResponse) error { if out := resp.GetOutStream(); len(out) > 0 { @@ -57,6 +57,11 @@ func CompilerServerToStreams(ctx context.Context, stdOut, stderr io.Writer) (ser if result := resp.GetResult(); result != nil { builderResult = result } + if progress := resp.GetProgress(); progress != nil { + if progressCB != nil { + progressCB(progress) + } + } return nil }) return stream, func() *rpc.BuilderResult { return builderResult } diff --git a/internal/cli/compile/compile.go b/internal/cli/compile/compile.go index 2a5348e981e..25cea1427bb 100644 --- a/internal/cli/compile/compile.go +++ b/internal/cli/compile/compile.go @@ -245,7 +245,7 @@ func runCompileCommand(cmd *cobra.Command, args []string, srv rpc.ArduinoCoreSer DoNotExpandBuildProperties: showProperties == arguments.ShowPropertiesUnexpanded, Jobs: jobs, } - server, builderResCB := commands.CompilerServerToStreams(ctx, stdOut, stdErr) + server, builderResCB := commands.CompilerServerToStreams(ctx, stdOut, stdErr, nil) compileError := srv.Compile(compileRequest, server) builderRes := builderResCB()