From 67bffb796b7aca71cd5d74f1a9addd1f533cbfe2 Mon Sep 17 00:00:00 2001 From: lucarin91 Date: Wed, 10 Dec 2025 17:33:55 +0100 Subject: [PATCH 1/2] wip: add compilation progress --- internal/orchestrator/orchestrator.go | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/internal/orchestrator/orchestrator.go b/internal/orchestrator/orchestrator.go index 8eb26001..82de29d4 100644 --- a/internal/orchestrator/orchestrator.go +++ b/internal/orchestrator/orchestrator.go @@ -1184,7 +1184,7 @@ func compileUploadSketch( response = helpers.ArduinoCLIDownloadProgressToString(progress) } case *rpc.InitResponse_Error: - response = "Error: " + msg.Error.String() + response = "Error: " + msg.Error.String() + "\n" case *rpc.InitResponse_Profile: response = fmt.Sprintf( "Sketch profile configured: Name=%q, Port=%q", @@ -1192,7 +1192,7 @@ func compileUploadSketch( msg.Profile.GetPort(), ) } - if _, err := w.Write([]byte(response + "\n")); err != nil { + if _, err := w.Write([]byte(response)); err != nil { return err } @@ -1202,14 +1202,19 @@ func compileUploadSketch( return err } + callback := NewCallbackWriter(func(line string) { + _, _ = w.Write([]byte(".")) + }) + // build the sketch - server, getCompileResult := commands.CompilerServerToStreams(ctx, w, w, nil) + server, getCompileResult := commands.CompilerServerToStreams(ctx, callback, w, nil) compileReq := rpc.CompileRequest{ Instance: inst, Fqbn: "arduino:zephyr:unoq", SketchPath: sketchPath.String(), BuildPath: buildPath, Jobs: 2, + Verbose: true, } err = srv.Compile(&compileReq, server) @@ -1224,13 +1229,20 @@ func compileUploadSketch( boardPlatform := result.GetBoardPlatform() if boardPlatform != nil { slog.Info("Board platform: " + boardPlatform.GetId() + " (" + boardPlatform.GetVersion() + ") in " + boardPlatform.GetInstallDir()) + + w.Write([]byte("Board platform: " + boardPlatform.GetId() + " (" + boardPlatform.GetVersion() + ") in " + boardPlatform.GetInstallDir() + "\n")) } buildPlatform := result.GetBuildPlatform() if buildPlatform != nil && buildPlatform.GetInstallDir() != boardPlatform.GetInstallDir() { slog.Info("Build platform: " + buildPlatform.GetId() + " (" + buildPlatform.GetVersion() + ") in " + buildPlatform.GetInstallDir()) + + w.Write([]byte("Build platform: " + buildPlatform.GetId() + " (" + buildPlatform.GetVersion() + ") in " + buildPlatform.GetInstallDir() + "\n")) + } for _, lib := range result.GetUsedLibraries() { slog.Info("Used library " + lib.GetName() + " (" + lib.GetVersion() + ") in " + lib.GetInstallDir()) + + w.Write([]byte("Used library " + lib.GetName() + " (" + lib.GetVersion() + ") in " + lib.GetInstallDir() + "\n")) } if err := uploadSketchInRam(ctx, w, srv, inst, sketchPath.String(), buildPath); err != nil { From 457c28c7c8454f30f383bb098b72fe9bbe36f698 Mon Sep 17 00:00:00 2001 From: lucarin91 Date: Wed, 10 Dec 2025 17:38:29 +0100 Subject: [PATCH 2/2] newline --- internal/orchestrator/orchestrator.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/orchestrator/orchestrator.go b/internal/orchestrator/orchestrator.go index 82de29d4..b6e61b59 100644 --- a/internal/orchestrator/orchestrator.go +++ b/internal/orchestrator/orchestrator.go @@ -1203,7 +1203,7 @@ func compileUploadSketch( } callback := NewCallbackWriter(func(line string) { - _, _ = w.Write([]byte(".")) + _, _ = w.Write([]byte(".\n")) }) // build the sketch