Skip to content

Commit 40f9e89

Browse files
committed
Moving ctx.ImportedLibraries usage out of CppIncludeFinder
1 parent 684b228 commit 40f9e89

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Diff for: legacy/builder/container_find_includes.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ import (
9999
"os/exec"
100100
"time"
101101

102+
"github.com/arduino/arduino-cli/arduino/libraries"
102103
"github.com/arduino/arduino-cli/legacy/builder/builder_utils"
103104
"github.com/arduino/arduino-cli/legacy/builder/constants"
104105
"github.com/arduino/arduino-cli/legacy/builder/types"
@@ -126,6 +127,7 @@ func (s *ContainerFindIncludes) Run(ctx *types.Context) error {
126127
return err
127128
}
128129

130+
ctx.ImportedLibraries.Add(finder.LibrariesFound...)
129131
ctx.IncludeFolders.AddAllMissing(finder.IncludeDirsFound)
130132
if err := runCommand(ctx, &FailIfImportedLibraryIsWrong{}); err != nil {
131133
return errors.WithStack(err)
@@ -138,6 +140,7 @@ func (s *ContainerFindIncludes) Run(ctx *types.Context) error {
138140
// libraries used in a sketch and a way to cache this result for
139141
// increasing detection speed on already processed sketches.
140142
type CppIncludesFinder struct {
143+
LibrariesFound libraries.List
141144
IncludeDirsFound paths.PathList
142145
ctx *types.Context
143146
cache *includeCache
@@ -434,10 +437,9 @@ func (f *CppIncludesFinder) findIncludesUntilDone(sourceFile *SourceFile) error
434437
return errors.WithStack(preprocErr)
435438
}
436439

437-
// Add this library to the list of libraries, the
438-
// include path and queue its source files for further
439-
// include scanning
440-
f.ctx.ImportedLibraries = append(f.ctx.ImportedLibraries, library)
440+
// Add this library to the list of libraries found, add the include path
441+
// and queue its source files for further include scanning
442+
f.LibrariesFound.Add(library)
441443
f.cache.AddAndCheckEntry(sourcePath, include, library.SourceDir)
442444

443445
sourceDirs := library.SourceDirs()

0 commit comments

Comments
 (0)