@@ -134,10 +134,25 @@ func (l *SketchLibrariesDetector) ImportedLibraries() libraries.List {
134134 return l .importedLibraries
135135}
136136
137- // AppendImportedLibraries todo should rename this, probably after refactoring the
138- // container_find_includes command .
139- func (l * SketchLibrariesDetector ) AppendImportedLibraries ( library * libraries.Library ) {
137+ // addAndBuildLibrary adds the given library to the imported libraries list and queues its source files
138+ // for further processing .
139+ func (l * SketchLibrariesDetector ) addAndBuildLibrary ( sourceFileQueue * uniqueSourceFileQueue , librariesBuildPath * paths. Path , library * libraries.Library ) {
140140 l .importedLibraries = append (l .importedLibraries , library )
141+ if library .Precompiled && library .PrecompiledWithSources {
142+ // Fully precompiled libraries should have no dependencies to avoid ABI breakage
143+ if l .logger .VerbosityLevel () == logger .VerbosityVerbose {
144+ l .logger .Info (i18n .Tr ("Skipping dependencies detection for precompiled library %[1]s" , library .Name ))
145+ }
146+ } else {
147+ for _ , sourceDir := range library .SourceDirs () {
148+ l .queueSourceFilesFromFolder (
149+ sourceFileQueue ,
150+ sourceDir .Dir , sourceDir .Recurse ,
151+ library .SourceDir ,
152+ librariesBuildPath .Join (library .DirName ),
153+ library .UtilityDir )
154+ }
155+ }
141156}
142157
143158// PrintUsedAndNotUsedLibraries todo
@@ -396,20 +411,8 @@ func (l *SketchLibrariesDetector) findMissingIncludesInCompilationUnit(
396411 // Add this library to the list of libraries, the
397412 // include path and queue its source files for further
398413 // include scanning
399- l .AppendImportedLibraries ( library )
414+ l .addAndBuildLibrary ( sourceFileQueue , librariesBuildPath , library )
400415 l .addIncludeFolder (library .SourceDir )
401-
402- if library .Precompiled && library .PrecompiledWithSources {
403- // Fully precompiled libraries should have no dependencies to avoid ABI breakage
404- if l .logger .VerbosityLevel () == logger .VerbosityVerbose {
405- l .logger .Info (i18n .Tr ("Skipping dependencies detection for precompiled library %[1]s" , library .Name ))
406- }
407- } else {
408- for _ , sourceDir := range library .SourceDirs () {
409- l .queueSourceFilesFromFolder (sourceFileQueue , sourceDir .Dir , sourceDir .Recurse ,
410- library .SourceDir , librariesBuildPath .Join (library .DirName ), library .UtilityDir )
411- }
412- }
413416 }
414417}
415418
0 commit comments