Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 23d781f

Browse files
committed
Moving ctx.ImportedLibraries usage out of CppIncludeFinder
1 parent 8e1d280 commit 23d781f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

‎legacy/builder/container_find_includes.go‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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.
150152
type 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

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /