func (s *IncludesToIncludeFolders) Run(ctx *types.Context) error { includes := ctx.Includes headerToLibraries := ctx.HeaderToLibraries platform := ctx.TargetPlatform actualPlatform := ctx.ActualPlatform libraryResolutionResults := ctx.LibrariesResolutionResults importedLibraries := ctx.ImportedLibraries newlyImportedLibraries, err := resolveLibraries(includes, headerToLibraries, importedLibraries, []*types.Platform{actualPlatform, platform}, libraryResolutionResults) if err != nil { return i18n.WrapError(err) } foldersWithSources := ctx.FoldersWithSourceFiles for _, newlyImportedLibrary := range newlyImportedLibraries { if !sliceContainsLibrary(importedLibraries, newlyImportedLibrary) { importedLibraries = append(importedLibraries, newlyImportedLibrary) sourceFolders := types.LibraryToSourceFolder(newlyImportedLibrary) for _, sourceFolder := range sourceFolders { foldersWithSources.Push(sourceFolder) } } } ctx.ImportedLibraries = importedLibraries ctx.IncludeFolders = resolveIncludeFolders(newlyImportedLibraries, ctx.BuildProperties, ctx.Verbose) return nil }
// Append the given folder to the include path and match or append it to // the cache. sourceFilePath and include indicate the source of this // include (e.g. what #include line in what file it was resolved from) // and should be the empty string for the default include folders, like // the core or variant. func appendIncludeFolder(ctx *types.Context, cache *includeCache, sourceFilePath string, include string, folder string) { ctx.IncludeFolders = append(ctx.IncludeFolders, folder) cache.ExpectEntry(sourceFilePath, include, folder) }