Skip to content

Commit

Permalink
make PrintUsedLibraries a method recevier of arduino/builder
Browse files Browse the repository at this point in the history
  • Loading branch information
alessio-perugini committed Sep 12, 2023
1 parent c0eed43 commit 8da2287
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 56 deletions.
34 changes: 34 additions & 0 deletions arduino/builder/libraries.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package builder

import (
"strings"
"time"

"github.com/arduino/arduino-cli/arduino/builder/compilation"
"github.com/arduino/arduino-cli/arduino/builder/cpp"
Expand Down Expand Up @@ -343,3 +344,36 @@ func (b *Builder) WarnAboutArchIncompatibleLibraries(
}
}
}

// PrintUsedLibraries fixdoc
// TODO here we can completly remove this part as it's duplicated in what we can
// read in the gRPC response
func (b *Builder) PrintUsedLibraries(importedLibraries libraries.List) {
if !b.logger.Verbose() || len(importedLibraries) == 0 {
return
}

for _, library := range importedLibraries {
legacy := ""
if library.IsLegacy {
legacy = tr("(legacy)")
}
if library.Version.String() == "" {
b.logger.Info(
tr("Using library %[1]s in folder: %[2]s %[3]s",
library.Name,
library.InstallDir,
legacy))
} else {
b.logger.Info(
tr("Using library %[1]s at version %[2]s in folder: %[3]s %[4]s",
library.Name,
library.Version,
library.InstallDir,
legacy))
}
}

// TODO Why is this here?
time.Sleep(100 * time.Millisecond)
}
3 changes: 1 addition & 2 deletions legacy/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,7 @@ func (s *Builder) Run(ctx *types.Context) error {
}),

types.BareCommand(func(ctx *types.Context) error {
infoOut, _ := PrintUsedLibrariesIfVerbose(ctx.BuilderLogger.Verbose(), ctx.SketchLibrariesDetector.ImportedLibraries())
ctx.BuilderLogger.Info(string(infoOut))
ctx.Builder.PrintUsedLibraries(ctx.SketchLibrariesDetector.ImportedLibraries())
return nil
}),

Expand Down
54 changes: 0 additions & 54 deletions legacy/builder/print_used_libraries_if_verbose.go

This file was deleted.

0 comments on commit 8da2287

Please sign in to comment.