Skip to content

Commit 67bffb7

Browse files
committed
wip: add compilation progress
1 parent fa54e74 commit 67bffb7

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

internal/orchestrator/orchestrator.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,15 +1184,15 @@ func compileUploadSketch(
11841184
response = helpers.ArduinoCLIDownloadProgressToString(progress)
11851185
}
11861186
case *rpc.InitResponse_Error:
1187-
response = "Error: " + msg.Error.String()
1187+
response = "Error: " + msg.Error.String() + "\n"
11881188
case *rpc.InitResponse_Profile:
11891189
response = fmt.Sprintf(
11901190
"Sketch profile configured: Name=%q, Port=%q",
11911191
msg.Profile.GetName(),
11921192
msg.Profile.GetPort(),
11931193
)
11941194
}
1195-
if _, err := w.Write([]byte(response + "\n")); err != nil {
1195+
if _, err := w.Write([]byte(response)); err != nil {
11961196
return err
11971197
}
11981198

@@ -1202,14 +1202,19 @@ func compileUploadSketch(
12021202
return err
12031203
}
12041204

1205+
callback := NewCallbackWriter(func(line string) {
1206+
_, _ = w.Write([]byte("."))
1207+
})
1208+
12051209
// build the sketch
1206-
server, getCompileResult := commands.CompilerServerToStreams(ctx, w, w, nil)
1210+
server, getCompileResult := commands.CompilerServerToStreams(ctx, callback, w, nil)
12071211
compileReq := rpc.CompileRequest{
12081212
Instance: inst,
12091213
Fqbn: "arduino:zephyr:unoq",
12101214
SketchPath: sketchPath.String(),
12111215
BuildPath: buildPath,
12121216
Jobs: 2,
1217+
Verbose: true,
12131218
}
12141219

12151220
err = srv.Compile(&compileReq, server)
@@ -1224,13 +1229,20 @@ func compileUploadSketch(
12241229
boardPlatform := result.GetBoardPlatform()
12251230
if boardPlatform != nil {
12261231
slog.Info("Board platform: " + boardPlatform.GetId() + " (" + boardPlatform.GetVersion() + ") in " + boardPlatform.GetInstallDir())
1232+
1233+
w.Write([]byte("Board platform: " + boardPlatform.GetId() + " (" + boardPlatform.GetVersion() + ") in " + boardPlatform.GetInstallDir() + "\n"))
12271234
}
12281235
buildPlatform := result.GetBuildPlatform()
12291236
if buildPlatform != nil && buildPlatform.GetInstallDir() != boardPlatform.GetInstallDir() {
12301237
slog.Info("Build platform: " + buildPlatform.GetId() + " (" + buildPlatform.GetVersion() + ") in " + buildPlatform.GetInstallDir())
1238+
1239+
w.Write([]byte("Build platform: " + buildPlatform.GetId() + " (" + buildPlatform.GetVersion() + ") in " + buildPlatform.GetInstallDir() + "\n"))
1240+
12311241
}
12321242
for _, lib := range result.GetUsedLibraries() {
12331243
slog.Info("Used library " + lib.GetName() + " (" + lib.GetVersion() + ") in " + lib.GetInstallDir())
1244+
1245+
w.Write([]byte("Used library " + lib.GetName() + " (" + lib.GetVersion() + ") in " + lib.GetInstallDir() + "\n"))
12341246
}
12351247

12361248
if err := uploadSketchInRam(ctx, w, srv, inst, sketchPath.String(), buildPath); err != nil {

0 commit comments

Comments
 (0)