@@ -23,6 +23,7 @@ import (
2323
2424 "github.com/arduino/arduino-cli/internal/arduino/cores"
2525 "github.com/arduino/arduino-cli/internal/arduino/libraries"
26+ "github.com/arduino/arduino-cli/internal/arduino/sketch"
2627 "github.com/arduino/arduino-cli/internal/arduino/utils"
2728 "github.com/arduino/arduino-cli/internal/i18n"
2829 "github.com/schollz/closestmatch"
@@ -35,7 +36,7 @@ type Cpp struct {
3536}
3637
3738// NewCppResolver creates a new Cpp resolver
38- func NewCppResolver (allLibs []* libraries.Library , targetPlatform , actualPlatform * cores.PlatformRelease ) * Cpp {
39+ func NewCppResolver (allLibs []* libraries.Library , sk * sketch. Sketch , targetPlatform , actualPlatform * cores.PlatformRelease ) * Cpp {
3940 resolver := & Cpp {
4041 headers : map [string ]libraries.List {},
4142 }
@@ -45,10 +46,17 @@ func NewCppResolver(allLibs []*libraries.Library, targetPlatform, actualPlatform
4546 if actualPlatform != targetPlatform {
4647 resolver .ScanPlatformLibraries (allLibs , actualPlatform )
4748 }
48-
49+ resolver . ScanSketchLibraries ( sk )
4950 return resolver
5051}
5152
53+ // ScanSketchLibraries loads libraries bundled with the sketch
54+ func (resolver * Cpp ) ScanSketchLibraries (sk * sketch.Sketch ) {
55+ for _ , lib := range sk .VendoredLibraries () {
56+ _ = resolver .ScanLibrary (lib )
57+ }
58+ }
59+
5260// ScanIDEBuiltinLibraries reads ide-builtin librariers loaded in the LibrariesManager to find
5361// and cache all C++ headers for later retrieval.
5462func (resolver * Cpp ) ScanIDEBuiltinLibraries (allLibs []* libraries.Library ) {
0 commit comments