@@ -24,6 +24,7 @@ import (
2424 "github.com/arduino/arduino-cli/arduino/builder/logger"
2525 "github.com/arduino/arduino-cli/arduino/builder/progress"
2626 "github.com/arduino/arduino-cli/arduino/cores"
27+ "github.com/arduino/arduino-cli/arduino/libraries"
2728 "github.com/arduino/arduino-cli/arduino/libraries/librariesmanager"
2829 "github.com/arduino/arduino-cli/arduino/sketch"
2930 "github.com/arduino/go-paths-helper"
@@ -81,7 +82,7 @@ type Builder struct {
8182
8283 buildOptions * buildOptions
8384
84- * detector.SketchLibrariesDetector
85+ libsDetector * detector.SketchLibrariesDetector
8586}
8687
8788// BuildArtifacts contains the result of various build
@@ -202,7 +203,7 @@ func NewBuilder(
202203 buildArtifacts : & BuildArtifacts {},
203204 targetPlatform : targetPlatform ,
204205 actualPlatform : actualPlatform ,
205- SketchLibrariesDetector : detector .NewSketchLibrariesDetector (
206+ libsDetector : detector .NewSketchLibrariesDetector (
206207 libsManager , libsResolver ,
207208 useCachedLibrariesResolution ,
208209 onlyUpdateCompilationDatabase ,
@@ -237,6 +238,11 @@ func (b *Builder) ExecutableSectionsSize() ExecutablesFileSections {
237238 return b .executableSectionsSize
238239}
239240
241+ // ImportedLibraries fixdoc
242+ func (b * Builder ) ImportedLibraries () libraries.List {
243+ return b .libsDetector .ImportedLibraries ()
244+ }
245+
240246// Preprocess fixdoc
241247func (b * Builder ) Preprocess () error {
242248 b .Progress .AddSubSteps (6 )
@@ -271,7 +277,7 @@ func (b *Builder) preprocess() error {
271277 b .Progress .PushProgress ()
272278
273279 b .logIfVerbose (false , tr ("Detecting libraries used..." ))
274- err := b .SketchLibrariesDetector .FindIncludes (
280+ err := b .libsDetector .FindIncludes (
275281 b .buildPath ,
276282 b .buildProperties .GetPath ("build.core.path" ),
277283 b .buildProperties .GetPath ("build.variant.path" ),
@@ -287,12 +293,12 @@ func (b *Builder) preprocess() error {
287293 b .Progress .CompleteStep ()
288294 b .Progress .PushProgress ()
289295
290- b .warnAboutArchIncompatibleLibraries (b .SketchLibrariesDetector .ImportedLibraries ())
296+ b .warnAboutArchIncompatibleLibraries (b .libsDetector .ImportedLibraries ())
291297 b .Progress .CompleteStep ()
292298 b .Progress .PushProgress ()
293299
294300 b .logIfVerbose (false , tr ("Generating function prototypes..." ))
295- if err := b .preprocessSketch (b .SketchLibrariesDetector .IncludeFolders ()); err != nil {
301+ if err := b .preprocessSketch (b .libsDetector .IncludeFolders ()); err != nil {
296302 return err
297303 }
298304 b .Progress .CompleteStep ()
@@ -330,18 +336,18 @@ func (b *Builder) Build() error {
330336
331337 buildErr := b .build ()
332338
333- b .SketchLibrariesDetector .PrintUsedAndNotUsedLibraries (buildErr != nil )
339+ b .libsDetector .PrintUsedAndNotUsedLibraries (buildErr != nil )
334340 b .Progress .CompleteStep ()
335341 b .Progress .PushProgress ()
336342
337- b .printUsedLibraries (b .SketchLibrariesDetector .ImportedLibraries ())
343+ b .printUsedLibraries (b .libsDetector .ImportedLibraries ())
338344 b .Progress .CompleteStep ()
339345 b .Progress .PushProgress ()
340346
341347 if buildErr != nil {
342348 return buildErr
343349 }
344- if err := b .exportProjectCMake (b .SketchLibrariesDetector .ImportedLibraries (), b .SketchLibrariesDetector .IncludeFolders ()); err != nil {
350+ if err := b .exportProjectCMake (b .libsDetector .ImportedLibraries (), b .libsDetector .IncludeFolders ()); err != nil {
345351 return err
346352 }
347353 b .Progress .CompleteStep ()
@@ -365,7 +371,7 @@ func (b *Builder) build() error {
365371 b .Progress .CompleteStep ()
366372 b .Progress .PushProgress ()
367373
368- if err := b .BuildSketch (b .SketchLibrariesDetector .IncludeFolders ()); err != nil {
374+ if err := b .BuildSketch (b .libsDetector .IncludeFolders ()); err != nil {
369375 return err
370376 }
371377 b .Progress .CompleteStep ()
@@ -384,13 +390,13 @@ func (b *Builder) build() error {
384390 b .Progress .CompleteStep ()
385391 b .Progress .PushProgress ()
386392
387- if err := b .removeUnusedCompiledLibraries (b .SketchLibrariesDetector .ImportedLibraries ()); err != nil {
393+ if err := b .removeUnusedCompiledLibraries (b .libsDetector .ImportedLibraries ()); err != nil {
388394 return err
389395 }
390396 b .Progress .CompleteStep ()
391397 b .Progress .PushProgress ()
392398
393- if err := b .buildLibraries (b .SketchLibrariesDetector .IncludeFolders (), b .SketchLibrariesDetector .ImportedLibraries ()); err != nil {
399+ if err := b .buildLibraries (b .libsDetector .IncludeFolders (), b .libsDetector .ImportedLibraries ()); err != nil {
394400 return err
395401 }
396402 b .Progress .CompleteStep ()
0 commit comments