@@ -98,6 +98,7 @@ import (
9898 "os/exec"
9999 "time"
100100
101+ "github.com/arduino/arduino-cli/arduino/libraries"
101102 "github.com/arduino/arduino-cli/legacy/builder/builder_utils"
102103 "github.com/arduino/arduino-cli/legacy/builder/types"
103104 "github.com/arduino/arduino-cli/legacy/builder/utils"
@@ -136,6 +137,7 @@ func (s *ContainerFindIncludes) findIncludes(ctx *types.Context) error {
136137 return err
137138 }
138139
140+ ctx .ImportedLibraries .Add (finder .LibrariesFound ... )
139141 ctx .IncludeFolders .AddAllMissing (finder .IncludeDirsFound )
140142 if err := runCommand (ctx , & FailIfImportedLibraryIsWrong {}); err != nil {
141143 return errors .WithStack (err )
@@ -148,6 +150,7 @@ func (s *ContainerFindIncludes) findIncludes(ctx *types.Context) error {
148150// libraries used in a sketch and a way to cache this result for
149151// increasing detection speed on already processed sketches.
150152type CppIncludesFinder struct {
153+ LibrariesFound libraries.List
151154 IncludeDirsFound paths.PathList
152155 ctx * types.Context
153156 cache * includeCache
@@ -444,10 +447,9 @@ func (f *CppIncludesFinder) findIncludesUntilDone(sourceFile *SourceFile) error
444447 return errors .WithStack (preprocErr )
445448 }
446449
447- // Add this library to the list of libraries, the
448- // include path and queue its source files for further
449- // include scanning
450- f .ctx .ImportedLibraries = append (f .ctx .ImportedLibraries , library )
450+ // Add this library to the list of libraries found, add the include path
451+ // and queue its source files for further include scanning
452+ f .LibrariesFound .Add (library )
451453 f .cache .AddAndCheckEntry (sourcePath , include , library .SourceDir )
452454
453455 sourceDirs := library .SourceDirs ()
0 commit comments