@@ -33,6 +33,7 @@ import (
33
33
"github.com/arduino/arduino-cli/i18n"
34
34
"github.com/arduino/arduino-cli/internal/cli/arguments"
35
35
"github.com/arduino/arduino-cli/internal/cli/feedback"
36
+ "github.com/arduino/arduino-cli/internal/cli/feedback/result"
36
37
"github.com/arduino/arduino-cli/internal/cli/instance"
37
38
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
38
39
"github.com/arduino/arduino-cli/table"
@@ -340,10 +341,14 @@ func runCompileCommand(cmd *cobra.Command, args []string) {
340
341
341
342
stdIO := stdIORes ()
342
343
res := & compileResult {
343
- CompilerOut : stdIO .Stdout ,
344
- CompilerErr : stdIO .Stderr ,
345
- BuilderResult : compileRes ,
346
- UploadResult : uploadRes ,
344
+ CompilerOut : stdIO .Stdout ,
345
+ CompilerErr : stdIO .Stderr ,
346
+ BuilderResult : result .NewCompileResponse (compileRes ),
347
+ UploadResult : struct {
348
+ UpdatedUploadPort * result.Port `json:"updated_upload_port,omitempty"`
349
+ }{
350
+ UpdatedUploadPort : result .NewPort (uploadRes .GetUpdatedUploadPort ()),
351
+ },
347
352
ProfileOut : profileOut ,
348
353
Success : compileError == nil ,
349
354
showPropertiesMode : showProperties ,
@@ -385,13 +390,15 @@ func runCompileCommand(cmd *cobra.Command, args []string) {
385
390
}
386
391
387
392
type compileResult struct {
388
- CompilerOut string `json:"compiler_out"`
389
- CompilerErr string `json:"compiler_err"`
390
- BuilderResult * rpc.CompileResponse `json:"builder_result"`
391
- UploadResult * rpc.UploadResult `json:"upload_result"`
392
- Success bool `json:"success"`
393
- ProfileOut string `json:"profile_out,omitempty"`
394
- Error string `json:"error,omitempty"`
393
+ CompilerOut string `json:"compiler_out"`
394
+ CompilerErr string `json:"compiler_err"`
395
+ BuilderResult * result.CompileResponse `json:"builder_result"`
396
+ UploadResult struct {
397
+ UpdatedUploadPort * result.Port `json:"updated_upload_port,omitempty"`
398
+ } `json:"upload_result"`
399
+ Success bool `json:"success"`
400
+ ProfileOut string `json:"profile_out,omitempty"`
401
+ Error string `json:"error,omitempty"`
395
402
396
403
showPropertiesMode arguments.ShowPropertiesMode
397
404
hideStats bool
@@ -403,7 +410,7 @@ func (r *compileResult) Data() interface{} {
403
410
404
411
func (r * compileResult ) String () string {
405
412
if r .showPropertiesMode != arguments .ShowPropertiesDisabled {
406
- return strings .Join (r .BuilderResult .GetBuildProperties () , fmt .Sprintln ())
413
+ return strings .Join (r .BuilderResult .BuildProperties , fmt .Sprintln ())
407
414
}
408
415
409
416
if r .hideStats {
@@ -419,38 +426,38 @@ func (r *compileResult) String() string {
419
426
if r .CompilerOut != "" || r .CompilerErr != "" {
420
427
res += fmt .Sprintln ()
421
428
}
422
- if len (build .GetUsedLibraries () ) > 0 {
429
+ if len (build .UsedLibraries ) > 0 {
423
430
libraries := table .New ()
424
431
libraries .SetHeader (
425
432
table .NewCell (tr ("Used library" ), titleColor ),
426
433
table .NewCell (tr ("Version" ), titleColor ),
427
434
table .NewCell (tr ("Path" ), pathColor ))
428
- for _ , l := range build .GetUsedLibraries () {
435
+ for _ , l := range build .UsedLibraries {
429
436
libraries .AddRow (
430
- table .NewCell (l .GetName () , nameColor ),
431
- l .GetVersion () ,
432
- table .NewCell (l .GetInstallDir () , pathColor ))
437
+ table .NewCell (l .Name , nameColor ),
438
+ l .Version ,
439
+ table .NewCell (l .InstallDir , pathColor ))
433
440
}
434
441
res += fmt .Sprintln (libraries .Render ())
435
442
}
436
443
437
- if boardPlatform := build .GetBoardPlatform () ; boardPlatform != nil {
444
+ if boardPlatform := build .BoardPlatform ; boardPlatform != nil {
438
445
platforms := table .New ()
439
446
platforms .SetHeader (
440
447
table .NewCell (tr ("Used platform" ), titleColor ),
441
448
table .NewCell (tr ("Version" ), titleColor ),
442
449
table .NewCell (tr ("Path" ), pathColor ))
443
450
platforms .AddRow (
444
- table .NewCell (boardPlatform .GetId () , nameColor ),
445
- boardPlatform .GetVersion () ,
446
- table .NewCell (boardPlatform .GetInstallDir () , pathColor ))
447
- if buildPlatform := build .GetBuildPlatform () ; buildPlatform != nil &&
451
+ table .NewCell (boardPlatform .Id , nameColor ),
452
+ boardPlatform .Version ,
453
+ table .NewCell (boardPlatform .InstallDir , pathColor ))
454
+ if buildPlatform := build .BuildPlatform ; buildPlatform != nil &&
448
455
buildPlatform .Id != boardPlatform .Id &&
449
456
buildPlatform .Version != boardPlatform .Version {
450
457
platforms .AddRow (
451
- table .NewCell (buildPlatform .GetId () , nameColor ),
452
- buildPlatform .GetVersion () ,
453
- table .NewCell (buildPlatform .GetInstallDir () , pathColor ))
458
+ table .NewCell (buildPlatform .Id , nameColor ),
459
+ buildPlatform .Version ,
460
+ table .NewCell (buildPlatform .InstallDir , pathColor ))
454
461
}
455
462
res += fmt .Sprintln (platforms .Render ())
456
463
}
0 commit comments