void GetAllBuildableEntries(List <SolutionItem> list, ConfigurationSelector configuration, bool includeExternalReferences) { if (ParentSolution == null) { return; } SolutionConfiguration conf = ParentSolution.GetConfiguration(configuration); if (conf == null) { return; } foreach (SolutionFolderItem item in Items) { if (item is SolutionFolder) { ((SolutionFolder)item).GetAllBuildableEntries(list, configuration, includeExternalReferences); } else if ((item is SolutionItem) && conf.BuildEnabledForItem((SolutionItem)item) && ((SolutionItem)item).SupportsBuild()) { GetAllBuildableReferences(list, (SolutionItem)item, configuration, conf, includeExternalReferences, false); } } }
static void CollectBuildableDependencies(HashSet <SolutionItem> collected, SolutionItem item, ConfigurationSelector configuration, SolutionConfiguration conf) { foreach (var it in item.GetReferencedItems(configuration)) { if (collected.Contains(it) || !conf.BuildEnabledForItem(it)) { continue; } collected.Add(it); CollectBuildableDependencies(collected, it, configuration, conf); } }
/// <summary> /// Checks if this solution item has modified files and has to be built /// </summary> /// <returns> /// <c>true</c> if the solution item has to be built /// </returns> /// <param name='configuration'> /// Configuration for which to do the check /// </param> public bool NeedsBuilding(ConfigurationSelector configuration) { using (Counters.NeedsBuildingTimer.BeginTiming("NeedsBuilding check for " + Name)) { if (ParentSolution != null && this is SolutionEntityItem) { SolutionConfiguration sconf = ParentSolution.GetConfiguration(configuration); if (sconf != null && !sconf.BuildEnabledForItem((SolutionEntityItem)this)) { return(false); } } return(Services.ProjectService.GetExtensionChain(this).GetNeedsBuilding(this, configuration)); } }
void CollectBuildableEntries(HashSet <SolutionItem> collected, ConfigurationSelector configuration, SolutionConfiguration slnConf, bool includeDependencies) { foreach (SolutionFolderItem item in Items) { if (item is SolutionFolder sf) { sf.CollectBuildableEntries(collected, configuration, slnConf, includeDependencies); } else if (item is SolutionItem si && slnConf.BuildEnabledForItem(si) && si.SupportsBuild() && collected.Add(si)) { if (includeDependencies) { Solution.CollectBuildableDependencies(collected, si, configuration, slnConf); } } } }
void GetAllBuildableReferences(List <SolutionItem> list, SolutionItem item, ConfigurationSelector configuration, SolutionConfiguration conf, bool includeExternalReferences, bool isDirectReference) { if (list.Contains(item) || !conf.BuildEnabledForItem(item)) { return; } // Skip unsupported projects which are not directly referenced by other (supported) projects if (!isDirectReference && item.IsUnsupportedProject) { return; } list.Add(item); if (includeExternalReferences) { foreach (var it in item.GetReferencedItems(configuration)) { GetAllBuildableReferences(list, it, configuration, conf, includeExternalReferences, true); } } }
/** * returns a set of projects that a combine contains and a set of projects * that are referenced from combine projects but not part of the combine */ void GetAllProjects (SolutionFolder folder, SolutionConfiguration config, out Set<SolutionFolderItem> projects, out Set<SolutionFolderItem> references) { List<SolutionFolderItem> subitems = new List<SolutionFolderItem> (); GetSubItems (subitems, folder); projects = (Set<SolutionFolderItem>) combineProjects [folder]; if (projects != null) { references = (Set<SolutionFolderItem>) combineReferences [folder]; return; } projects = new Set<SolutionFolderItem>(); references = new Set<SolutionFolderItem>(); foreach (SolutionFolderItem item in subitems) { if (item is SolutionItem) { SolutionItem entry = (SolutionItem) item; if (!config.BuildEnabledForItem (entry)) continue; projects.Add (entry); references.Union (entry.GetReferencedItems (config.Selector)); } else if (item is SolutionFolder) { Set<SolutionFolderItem> subProjects; Set<SolutionFolderItem> subReferences; GetAllProjects ((SolutionFolder)item, config, out subProjects, out subReferences); projects.Union (subProjects); references.Union (subReferences); } } references.Without (projects); combineProjects [folder] = projects; combineReferences [folder] = references; }
// utility function for finding the correct order to process directories List<SolutionFolderItem> CalculateSubDirOrder (AutotoolsContext ctx, SolutionFolder folder, SolutionConfiguration config) { List<SolutionFolderItem> resultOrder = new List<SolutionFolderItem>(); Set<SolutionFolderItem> dependenciesMet = new Set<SolutionFolderItem>(); Set<SolutionFolderItem> inResult = new Set<SolutionFolderItem>(); // We don't have to worry about projects built in parent combines dependenciesMet.Union (ctx.GetBuiltProjects ()); bool added; string notMet; do { added = false; notMet = null; List<SolutionFolderItem> items = new List<SolutionFolderItem> (); GetSubItems (items, folder); foreach (SolutionFolderItem item in items) { Set<SolutionFolderItem> references, provides; if (inResult.Contains (item)) continue; if (item is SolutionItem) { SolutionItem entry = (SolutionItem) item; if (!config.BuildEnabledForItem (entry)) continue; references = new Set<SolutionFolderItem> (); provides = new Set<SolutionFolderItem>(); references.Union (entry.GetReferencedItems (config.Selector)); provides.Add (entry); } else if (item is SolutionFolder) { GetAllProjects ((SolutionFolder) item, config, out provides, out references); } else continue; if (dependenciesMet.ContainsSet (references) ) { resultOrder.Add (item); dependenciesMet.Union(provides); inResult.Add(item); added = true; } else notMet = item.Name; } } while (added); if (notMet != null) throw new Exception("Impossible to find a solution order that satisfies project references for '" + notMet + "'"); return resultOrder; }