@@ -42,7 +42,6 @@ type IncludesToIncludeFolders struct{}
42
42
43
43
func (s * IncludesToIncludeFolders ) Run (ctx * types.Context ) error {
44
44
include := ctx .IncludeJustFound
45
- includes := []string {include }
46
45
includeFolders := ctx .IncludeFolders
47
46
headerToLibraries := ctx .HeaderToLibraries
48
47
@@ -55,43 +54,32 @@ func (s *IncludesToIncludeFolders) Run(ctx *types.Context) error {
55
54
return nil ;
56
55
}
57
56
58
- newlyImportedLibraries := resolveLibraries (includes , headerToLibraries , importedLibraries , []* types.Platform {actualPlatform , platform }, libraryResolutionResults )
57
+ newlyImportedLibrary := resolveLibrary (include , headerToLibraries , importedLibraries , []* types.Platform {actualPlatform , platform }, libraryResolutionResults )
58
+ if newlyImportedLibrary == nil {
59
+ return nil ;
60
+ }
61
+
59
62
foldersWithSources := ctx .FoldersWithSourceFiles
60
63
61
- for _ , newlyImportedLibrary := range newlyImportedLibraries {
62
- if ! sliceContainsLibrary (importedLibraries , newlyImportedLibrary ) {
63
- importedLibraries = append (importedLibraries , newlyImportedLibrary )
64
- sourceFolders := types .LibraryToSourceFolder (newlyImportedLibrary )
65
- for _ , sourceFolder := range sourceFolders {
66
- foldersWithSources .Push (sourceFolder )
67
- }
68
- includeFolders = append (includeFolders , newlyImportedLibrary .SrcFolder )
69
- }
64
+ importedLibraries = append (importedLibraries , newlyImportedLibrary )
65
+ sourceFolders := types .LibraryToSourceFolder (newlyImportedLibrary )
66
+ for _ , sourceFolder := range sourceFolders {
67
+ foldersWithSources .Push (sourceFolder )
70
68
}
69
+ includeFolders = append (includeFolders , newlyImportedLibrary .SrcFolder )
71
70
72
71
ctx .ImportedLibraries = importedLibraries
73
72
ctx .IncludeFolders = includeFolders
74
73
75
74
return nil
76
75
}
77
76
78
- func resolveLibraries ( includes [] string , headerToLibraries map [string ][]* types.Library , importedLibraries []* types.Library , platforms []* types.Platform , libraryResolutionResults map [string ]types.LibraryResolutionResult ) [] * types.Library {
77
+ func resolveLibrary ( header string , headerToLibraries map [string ][]* types.Library , importedLibraries []* types.Library , platforms []* types.Platform , libraryResolutionResults map [string ]types.LibraryResolutionResult ) * types.Library {
79
78
markImportedLibrary := make (map [* types.Library ]bool )
80
79
for _ , library := range importedLibraries {
81
80
markImportedLibrary [library ] = true
82
81
}
83
- var newlyImportedLibraries []* types.Library
84
- for _ , header := range includes {
85
- library := resolveLibrary (header , headerToLibraries , markImportedLibrary , platforms , libraryResolutionResults )
86
- if library != nil {
87
- newlyImportedLibraries = append (newlyImportedLibraries , library )
88
- }
89
- }
90
-
91
- return newlyImportedLibraries
92
- }
93
82
94
- func resolveLibrary (header string , headerToLibraries map [string ][]* types.Library , markImportedLibrary map [* types.Library ]bool , platforms []* types.Platform , libraryResolutionResults map [string ]types.LibraryResolutionResult ) * types.Library {
95
83
libraries := append ([]* types.Library {}, headerToLibraries [header ]... )
96
84
97
85
if libraries == nil || len (libraries ) == 0 {
0 commit comments