Skip to content

Commit feb0437

Browse files
committed
Moving ctx.ImportedLibraries usage out of CppIncludeFinder
1 parent cb91ad6 commit feb0437

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/i18n"
@@ -127,6 +128,7 @@ func (s *ContainerFindIncludes) Run(ctx *types.Context) error {
127128
return err
128129
}
129130

131+
ctx.ImportedLibraries.Add(finder.LibrariesFound...)
130132
ctx.IncludeFolders.AddAllMissing(finder.IncludeDirsFound)
131133
if err := runCommand(ctx, &FailIfImportedLibraryIsWrong{}); err != nil {
132134
return i18n.WrapError(err)
@@ -139,6 +141,7 @@ func (s *ContainerFindIncludes) Run(ctx *types.Context) error {
139141
// libraries used in a sketch and a way to cache this result for
140142
// increasing detection speed on already processed sketches.
141143
type CppIncludesFinder struct {
144+
LibrariesFound libraries.List
142145
IncludeDirsFound paths.PathList
143146
ctx *types.Context
144147
cache *includeCache
@@ -435,10 +438,9 @@ func (f *CppIncludesFinder) findIncludesUntilDone(sourceFile *SourceFile) error
435438
return i18n.WrapError(preprocErr)
436439
}
437440

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

444446
sourceDirs := library.SourceDirs()

0 commit comments

Comments
 (0)