@@ -41,6 +41,7 @@ import (
41
41
"github.com/arduino/arduino-cli/internal/i18n"
42
42
"github.com/arduino/go-paths-helper"
43
43
"github.com/arduino/go-properties-orderedmap"
44
+ "github.com/sirupsen/logrus"
44
45
)
45
46
46
47
type libraryResolutionResult struct {
@@ -140,6 +141,7 @@ func (l *SketchLibrariesDetector) ImportedLibraries() libraries.List {
140
141
// addAndBuildLibrary adds the given library to the imported libraries list and queues its source files
141
142
// for further processing.
142
143
func (l * SketchLibrariesDetector ) addAndBuildLibrary (sourceFileQueue * uniqueSourceFileQueue , librariesBuildPath * paths.Path , library * libraries.Library ) {
144
+ logrus .Tracef ("[LD] LIBRARY: %s" , library .Name )
143
145
l .importedLibraries = append (l .importedLibraries , library )
144
146
if library .Precompiled && library .PrecompiledWithSources {
145
147
// Fully precompiled libraries should have no dependencies to avoid ABI breakage
@@ -202,6 +204,7 @@ func (l *SketchLibrariesDetector) IncludeFoldersChanged() bool {
202
204
203
205
// addIncludeFolder add the given folder to the include path.
204
206
func (l * SketchLibrariesDetector ) addIncludeFolder (folder * paths.Path ) {
207
+ logrus .Tracef ("[LD] INCLUDE-PATH: %s" , folder .String ())
205
208
l .includeFolders = append (l .includeFolders , folder )
206
209
l .cache .Expect (& detectorCacheEntry {AddedIncludePath : folder })
207
210
}
@@ -219,6 +222,11 @@ func (l *SketchLibrariesDetector) FindIncludes(
219
222
platformArch string ,
220
223
jobs int ,
221
224
) error {
225
+ logrus .Debug ("Finding required libraries for the sketch." )
226
+ defer func () {
227
+ logrus .Debugf ("Library detection completed. Found %d required libraries." , len (l .importedLibraries ))
228
+ }()
229
+
222
230
err := l .findIncludes (ctx , buildPath , buildCorePath , buildVariantPath , sketchBuildPath , sketch , librariesBuildPath , buildProperties , platformArch , jobs )
223
231
if err != nil && l .onlyUpdateCompilationDatabase {
224
232
l .logger .Info (
@@ -273,7 +281,7 @@ func (l *SketchLibrariesDetector) findIncludes(
273
281
l .preRunner = runner .New (ctx , jobs )
274
282
for _ , entry := range l .cache .EntriesAhead () {
275
283
if entry .CompileTask != nil {
276
- upToDate , _ := entry .Compile .ObjFileIsUpToDate ()
284
+ upToDate , _ := entry .Compile .ObjFileIsUpToDate (logrus . WithField ( "runner" , "prerun" ) )
277
285
if ! upToDate {
278
286
_ = entry .Compile .PrepareBuildPath ()
279
287
l .preRunner .Enqueue (entry .CompileTask )
@@ -387,7 +395,7 @@ func (l *SketchLibrariesDetector) findMissingIncludesInCompilationUnit(
387
395
// TODO: This reads the dependency file, but the actual building
388
396
// does it again. Should the result be somehow cached? Perhaps
389
397
// remove the object file if it is found to be stale?
390
- unchanged , err := sourceFile .ObjFileIsUpToDate ()
398
+ unchanged , err := sourceFile .ObjFileIsUpToDate (logrus . WithField ( "runner" , "main" ) )
391
399
if err != nil {
392
400
return err
393
401
}
@@ -403,11 +411,13 @@ func (l *SketchLibrariesDetector) findMissingIncludesInCompilationUnit(
403
411
var missingIncludeH string
404
412
if entry := l .cache .Peek (); unchanged && entry != nil && entry .MissingIncludeH != nil {
405
413
missingIncludeH = * entry .MissingIncludeH
414
+ logrus .Tracef ("[LD] COMPILE-CACHE: %s" , sourceFile .SourcePath )
406
415
if first && l .logger .VerbosityLevel () == logger .VerbosityVerbose {
407
416
l .logger .Info (i18n .Tr ("Using cached library dependencies for file: %[1]s" , sourcePath ))
408
417
}
409
418
first = false
410
419
} else {
420
+ logrus .Tracef ("[LD] COMPILE: %s" , sourceFile .SourcePath )
411
421
if l .preRunner != nil {
412
422
if r := l .preRunner .Results (preprocTask ); r != nil {
413
423
preprocResult = r
@@ -448,6 +458,7 @@ func (l *SketchLibrariesDetector) findMissingIncludesInCompilationUnit(
448
458
}
449
459
}
450
460
461
+ logrus .Tracef ("[LD] MISSING: %s" , missingIncludeH )
451
462
l .cache .Expect (& detectorCacheEntry {MissingIncludeH : & missingIncludeH })
452
463
453
464
if missingIncludeH == "" {
@@ -495,6 +506,8 @@ func (l *SketchLibrariesDetector) queueSourceFilesFromFolder(
495
506
buildDir * paths.Path ,
496
507
extraIncludePath ... * paths.Path ,
497
508
) error {
509
+ logrus .Tracef ("[LD] SCAN: %s (recurse=%v)" , folder , recurse )
510
+
498
511
sourceFileExtensions := []string {}
499
512
for k := range globals .SourceFilesValidExtensions {
500
513
sourceFileExtensions = append (sourceFileExtensions , k )
0 commit comments