/**
         * 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;
        }
Пример #2
0
		void CollectReferencedItems (SolutionItem item, HashSet<SolutionItem> collected, ConfigurationSelector configuration)
		{
			foreach (var refItem in item.GetReferencedItems (configuration)) {
				if (collected.Add (refItem)) {
					CollectReferencedItems (refItem, collected, configuration);
				}
			}
		}
Пример #3
0
		void GetBuildableReferencedItems (List<SolutionItem> referenced, SolutionItem item, ConfigurationSelector configuration)
		{
			if (referenced.Contains (item))
				return;

			if (item.NeedsBuilding (configuration))
				referenced.Add (item);

			foreach (SolutionItem ritem in item.GetReferencedItems (configuration))
				GetBuildableReferencedItems (referenced, ritem, configuration);
		}
        // 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);
        }