@@ -106,6 +106,7 @@ import (
106
106
"github.com/arduino/arduino-cli/legacy/builder/utils"
107
107
"github.com/arduino/go-paths-helper"
108
108
"github.com/pkg/errors"
109
+ "github.com/sirupsen/logrus"
109
110
)
110
111
111
112
type ContainerFindIncludes struct {}
@@ -132,12 +133,14 @@ type CppIncludesFinder struct {
132
133
cache * includeCache
133
134
sketch * types.Sketch
134
135
queue * UniqueSourceFileQueue
136
+ log * logrus.Entry
135
137
}
136
138
137
139
func (f * CppIncludesFinder ) DetectLibraries () error {
138
140
f .cache = loadCacheFrom (f .ctx .BuildPath .Join ("includes.cache" ))
139
141
f .sketch = f .ctx .Sketch
140
142
f .queue = & UniqueSourceFileQueue {}
143
+ f .log = logrus .WithField ("task" , "DetectingLibraries" )
141
144
142
145
f .appendIncludeFolder (nil , "" , f .ctx .BuildProperties .GetPath ("build.core.path" ))
143
146
if f .ctx .BuildProperties .Get ("build.variant.path" ) != "" {
@@ -148,6 +151,7 @@ func (f *CppIncludesFinder) DetectLibraries() error {
148
151
if err != nil {
149
152
return errors .WithStack (err )
150
153
}
154
+ f .log .Debugf ("Queueing merged sketch: %s" , mergedfile )
151
155
f .queue .Push (mergedfile )
152
156
153
157
f .queueSourceFilesFromFolder (nil , f .ctx .SketchBuildPath , false /* recurse */ )
@@ -177,6 +181,7 @@ func (f *CppIncludesFinder) DetectLibraries() error {
177
181
// and should be the empty string for the default include folders, like
178
182
// the core or variant.
179
183
func (f * CppIncludesFinder ) appendIncludeFolder (sourceFilePath * paths.Path , include string , folder * paths.Path ) {
184
+ f .log .Debugf ("Using include folder: %s" , folder )
180
185
f .ctx .IncludeFolders = append (f .ctx .IncludeFolders , folder )
181
186
f .cache .ExpectEntry (sourceFilePath , include , folder )
182
187
}
@@ -403,7 +408,7 @@ func (f *CppIncludesFinder) findIncludesUntilDone(sourceFile SourceFile) error {
403
408
404
409
func (f * CppIncludesFinder ) queueSourceFilesFromFolder (lib * libraries.Library , folder * paths.Path , recurse bool ) error {
405
410
extensions := func (ext string ) bool { return ADDITIONAL_FILE_VALID_EXTENSIONS_NO_HEADERS [ext ] }
406
-
411
+ f . log . Debugf ( " Queueing source files from %s (recurse %v)" , folder , recurse )
407
412
filePaths := []string {}
408
413
err := utils .FindFilesInFolder (& filePaths , folder .String (), extensions , recurse )
409
414
if err != nil {
@@ -415,6 +420,7 @@ func (f *CppIncludesFinder) queueSourceFilesFromFolder(lib *libraries.Library, f
415
420
if err != nil {
416
421
return errors .WithStack (err )
417
422
}
423
+ f .log .Debugf (" Queuing %s" , sourceFile )
418
424
f .queue .Push (sourceFile )
419
425
}
420
426
@@ -427,6 +433,13 @@ type SourceFile struct {
427
433
428
434
// Path to the source file within the sketch/library root folder
429
435
RelativePath * paths.Path
436
+
437
+ ctx * types.Context
438
+ }
439
+
440
+ func (f SourceFile ) String () string {
441
+ return fmt .Sprintf ("Root: %s - Path: %s - BuildPath: %s" ,
442
+ sourceRoot (f .ctx , f .Library ), f .RelativePath , buildRoot (f .ctx , f .Library ))
430
443
}
431
444
432
445
// Create a SourceFile containing the given source file path within the
@@ -440,7 +453,7 @@ func MakeSourceFile(ctx *types.Context, lib *libraries.Library, path *paths.Path
440
453
return SourceFile {}, err
441
454
}
442
455
}
443
- return SourceFile {Library : lib , RelativePath : path }, nil
456
+ return SourceFile {Library : lib , RelativePath : path , ctx : ctx }, nil
444
457
}
445
458
446
459
// Return the build root for the given origin, where build products will
0 commit comments