@@ -132,10 +132,25 @@ func (l *SketchLibrariesDetector) ImportedLibraries() libraries.List {
132132 return l .importedLibraries
133133}
134134
135- // AppendImportedLibraries todo should rename this, probably after refactoring the
136- // container_find_includes command .
137- func (l * SketchLibrariesDetector ) AppendImportedLibraries ( library * libraries.Library ) {
135+ // addAndBuildLibrary adds the given library to the imported libraries list and queues its source files
136+ // for further processing .
137+ func (l * SketchLibrariesDetector ) addAndBuildLibrary ( sourceFileQueue * uniqueSourceFileQueue , librariesBuildPath * paths. Path , library * libraries.Library ) {
138138 l .importedLibraries = append (l .importedLibraries , library )
139+ if library .Precompiled && library .PrecompiledWithSources {
140+ // Fully precompiled libraries should have no dependencies to avoid ABI breakage
141+ if l .logger .VerbosityLevel () == logger .VerbosityVerbose {
142+ l .logger .Info (i18n .Tr ("Skipping dependencies detection for precompiled library %[1]s" , library .Name ))
143+ }
144+ } else {
145+ for _ , sourceDir := range library .SourceDirs () {
146+ l .queueSourceFilesFromFolder (
147+ sourceFileQueue ,
148+ sourceDir .Dir , sourceDir .Recurse ,
149+ library .SourceDir ,
150+ librariesBuildPath .Join (library .DirName ),
151+ library .UtilityDir )
152+ }
153+ }
139154}
140155
141156// PrintUsedAndNotUsedLibraries todo
@@ -405,20 +420,9 @@ func (l *SketchLibrariesDetector) findIncludesUntilDone(
405420 // Add this library to the list of libraries, the
406421 // include path and queue its source files for further
407422 // include scanning
408- l .AppendImportedLibraries ( library )
423+ l .addAndBuildLibrary ( sourceFileQueue , librariesBuildPath , library )
409424 l .appendIncludeFolder (cache , sourcePath , missingIncludeH , library .SourceDir )
410425
411- if library .Precompiled && library .PrecompiledWithSources {
412- // Fully precompiled libraries should have no dependencies to avoid ABI breakage
413- if l .logger .VerbosityLevel () == logger .VerbosityVerbose {
414- l .logger .Info (i18n .Tr ("Skipping dependencies detection for precompiled library %[1]s" , library .Name ))
415- }
416- } else {
417- for _ , sourceDir := range library .SourceDirs () {
418- l .queueSourceFilesFromFolder (sourceFileQueue , sourceDir .Dir , sourceDir .Recurse ,
419- library .SourceDir , librariesBuildPath .Join (library .DirName ), library .UtilityDir )
420- }
421- }
422426 first = false
423427 }
424428}
0 commit comments