Skip to content

Commit 0b0d1c9

Browse files
committed
Added platforms and libraries used in the build report
1 parent cb70a39 commit 0b0d1c9

File tree

1 file changed

+43
-2
lines changed

1 file changed

+43
-2
lines changed

cli/compile/compile.go

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ import (
3333
"github.com/arduino/arduino-cli/commands"
3434
"github.com/arduino/arduino-cli/configuration"
3535
"github.com/arduino/arduino-cli/i18n"
36+
"github.com/arduino/arduino-cli/table"
37+
"github.com/fatih/color"
3638
"github.com/sirupsen/logrus"
3739

3840
"github.com/arduino/arduino-cli/cli/errorcodes"
@@ -316,6 +318,45 @@ func (r *compileResult) Data() interface{} {
316318
}
317319

318320
func (r *compileResult) String() string {
319-
// The output is already printed via os.Stdout/os.Stdin
320-
return ""
321+
titleColor := color.New(color.FgHiGreen)
322+
nameColor := color.New(color.FgHiYellow)
323+
pathColor := color.New(color.FgHiBlack)
324+
build := r.BuilderResult
325+
326+
res := "\n"
327+
libraries := table.New()
328+
if len(build.GetUsedLibraries()) > 0 {
329+
libraries.SetHeader(
330+
table.NewCell(tr("Used library"), titleColor),
331+
table.NewCell(tr("Version"), titleColor),
332+
table.NewCell(tr("Path"), pathColor))
333+
for _, l := range build.GetUsedLibraries() {
334+
libraries.AddRow(
335+
table.NewCell(l.GetName(), nameColor),
336+
l.GetVersion(),
337+
table.NewCell(l.GetInstallDir(), pathColor))
338+
}
339+
}
340+
res += libraries.Render() + "\n"
341+
342+
platforms := table.New()
343+
platforms.SetHeader(
344+
table.NewCell(tr("Used platform"), titleColor),
345+
table.NewCell(tr("Version"), titleColor),
346+
table.NewCell(tr("Path"), pathColor))
347+
boardPlatform := build.GetBoardPlatform()
348+
platforms.AddRow(
349+
table.NewCell(boardPlatform.GetId(), nameColor),
350+
boardPlatform.GetVersion(),
351+
table.NewCell(boardPlatform.GetInstallDir(), pathColor))
352+
if buildPlatform := build.GetBuildPlatform(); buildPlatform != nil &&
353+
buildPlatform.Id != boardPlatform.Id &&
354+
buildPlatform.Version != boardPlatform.Version {
355+
platforms.AddRow(
356+
table.NewCell(buildPlatform.GetId(), nameColor),
357+
buildPlatform.GetVersion(),
358+
table.NewCell(buildPlatform.GetInstallDir(), pathColor))
359+
}
360+
res += platforms.Render()
361+
return res
321362
}

0 commit comments

Comments
 (0)