@@ -22,6 +22,7 @@ import (
2222
2323 "github.com/arduino/arduino-cli/internal/arduino/cores"
2424 "github.com/arduino/arduino-cli/internal/arduino/libraries"
25+ "github.com/arduino/arduino-cli/internal/arduino/sketch"
2526 "github.com/arduino/arduino-cli/internal/arduino/utils"
2627 "github.com/arduino/arduino-cli/internal/i18n"
2728 "github.com/schollz/closestmatch"
@@ -36,7 +37,7 @@ type Cpp struct {
3637var tr = i18n .Tr
3738
3839// NewCppResolver creates a new Cpp resolver
39- func NewCppResolver (allLibs []* libraries.Library , targetPlatform , actualPlatform * cores.PlatformRelease ) * Cpp {
40+ func NewCppResolver (allLibs []* libraries.Library , sk * sketch. Sketch , targetPlatform , actualPlatform * cores.PlatformRelease ) * Cpp {
4041 resolver := & Cpp {
4142 headers : map [string ]libraries.List {},
4243 }
@@ -46,10 +47,17 @@ func NewCppResolver(allLibs []*libraries.Library, targetPlatform, actualPlatform
4647 if actualPlatform != targetPlatform {
4748 resolver .ScanPlatformLibraries (allLibs , actualPlatform )
4849 }
49-
50+ resolver . ScanSketchLibraries ( sk )
5051 return resolver
5152}
5253
54+ // ScanSketchLibraries loads libraries bundled with the sketch
55+ func (resolver * Cpp ) ScanSketchLibraries (sk * sketch.Sketch ) {
56+ for _ , lib := range sk .VendoredLibraries () {
57+ _ = resolver .ScanLibrary (lib )
58+ }
59+ }
60+
5361// ScanIDEBuiltinLibraries reads ide-builtin librariers loaded in the LibrariesManager to find
5462// and cache all C++ headers for later retrieval.
5563func (resolver * Cpp ) ScanIDEBuiltinLibraries (allLibs []* libraries.Library ) {
0 commit comments