@@ -23,6 +23,7 @@ import (
23
23
24
24
"github.com/arduino/arduino-cli/internal/arduino/cores"
25
25
"github.com/arduino/arduino-cli/internal/arduino/libraries"
26
+ "github.com/arduino/arduino-cli/internal/arduino/sketch"
26
27
"github.com/arduino/arduino-cli/internal/arduino/utils"
27
28
"github.com/arduino/arduino-cli/internal/i18n"
28
29
"github.com/schollz/closestmatch"
@@ -35,7 +36,7 @@ type Cpp struct {
35
36
}
36
37
37
38
// 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 {
39
40
resolver := & Cpp {
40
41
headers : map [string ]libraries.List {},
41
42
}
@@ -45,10 +46,17 @@ func NewCppResolver(allLibs []*libraries.Library, targetPlatform, actualPlatform
45
46
if actualPlatform != targetPlatform {
46
47
resolver .ScanPlatformLibraries (allLibs , actualPlatform )
47
48
}
48
-
49
+ resolver . ScanSketchLibraries ( sk )
49
50
return resolver
50
51
}
51
52
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
+
52
60
// ScanIDEBuiltinLibraries reads ide-builtin librariers loaded in the LibrariesManager to find
53
61
// and cache all C++ headers for later retrieval.
54
62
func (resolver * Cpp ) ScanIDEBuiltinLibraries (allLibs []* libraries.Library ) {
0 commit comments