Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b16ae70

Browse files
authored
[skip-changelog] gRPC: Added progress callback in CompileServerToStreams adapter (#2623)
1 parent b72f5ca commit b16ae70

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

‎commands/service_compile.go‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import (
4141

4242
// CompilerServerToStreams creates a gRPC CompileServer that sends the responses to the provided streams.
4343
// The returned callback function can be used to retrieve the builder result after the compilation is done.
44-
func CompilerServerToStreams(ctx context.Context, stdOut, stderr io.Writer) (server rpc.ArduinoCoreService_CompileServer, resultCB func() *rpc.BuilderResult) {
44+
func CompilerServerToStreams(ctx context.Context, stdOut, stderr io.Writer, progressCB rpc.TaskProgressCB) (server rpc.ArduinoCoreService_CompileServer, resultCB func() *rpc.BuilderResult) {
4545
var builderResult *rpc.BuilderResult
4646
stream := streamResponseToCallback(ctx, func(resp *rpc.CompileResponse) error {
4747
if out := resp.GetOutStream(); len(out) > 0 {
@@ -57,6 +57,11 @@ func CompilerServerToStreams(ctx context.Context, stdOut, stderr io.Writer) (ser
5757
if result := resp.GetResult(); result != nil {
5858
builderResult = result
5959
}
60+
if progress := resp.GetProgress(); progress != nil {
61+
if progressCB != nil {
62+
progressCB(progress)
63+
}
64+
}
6065
return nil
6166
})
6267
return stream, func() *rpc.BuilderResult { return builderResult }

‎internal/cli/compile/compile.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ func runCompileCommand(cmd *cobra.Command, args []string, srv rpc.ArduinoCoreSer
245245
DoNotExpandBuildProperties: showProperties == arguments.ShowPropertiesUnexpanded,
246246
Jobs: jobs,
247247
}
248-
server, builderResCB := commands.CompilerServerToStreams(ctx, stdOut, stdErr)
248+
server, builderResCB := commands.CompilerServerToStreams(ctx, stdOut, stdErr, nil)
249249
compileError := srv.Compile(compileRequest, server)
250250
builderRes := builderResCB()
251251

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /