Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions internal/orchestrator/orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -1184,15 +1184,15 @@ 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",
msg.Profile.GetName(),
msg.Profile.GetPort(),
)
}
if _, err := w.Write([]byte(response + "\n")); err != nil {
if _, err := w.Write([]byte(response)); err != nil {
return err
}

Expand All @@ -1202,14 +1202,19 @@ func compileUploadSketch(
return err
}

callback := NewCallbackWriter(func(line string) {
_, _ = w.Write([]byte(".\n"))
})

// 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)
Expand All @@ -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 {
Expand Down
Loading