Пример #1
0
        public static void ConnectNodes(Project project, CppReferenceNode node, Project graph, bool connectNamespaces)
        {
            for (int i = 0; i < node.FileLookups.Count; i++)
            {
                string         lookup = node.FileLookups[i];
                FileDescriptor file   = FileDescriptor.Create(graph.Location, lookup);
                ReferenceNode  @ref   = graph.Files.Nodes.FirstOrDefault(x => x.File == file);
                if (@ref != null)
                {
                    node.AddDependency(@ref);
                    if (project != graph)
                    {
                        lock (project)
                        {
                            if (!project.References.Contains(graph))
                            {
                                project.References.Add(graph);
                            }

                            node.FileLookups.RemoveAt(i);

                            i--;
                            continue;
                        }
                    }
                }
            }
        }
Пример #2
0
        public static Project CreateProject(Project project, List <FileSystemDescriptor> files)
        {
            StorageDescriptor cache = project.Cache;

            files.ParallelFor((file) =>
            {
                CppReferenceNode node = new CppReferenceNode(project.Target, file as FileDescriptor);
                node.FetchImports();

                lock (project)
                    project.Files.Nodes.Add(node);

                StorageContainer element = cache.Store(file);
                if (node.Flags.Count != 0)
                {
                    switch ((OutputAssemblyType)node.Flags[0])
                    {
                    case OutputAssemblyType.Library: element.Tag = LibraryStorageTag; break;

                    case OutputAssemblyType.Console: element.Tag = ConsoleStorageTag; break;

                    case OutputAssemblyType.Executable: element.Tag = ExeStorageTag; break;
                    }
                    lock (project)
                        project.AssemblyType = (OutputAssemblyType)node.Flags[0];
                }
            });

            ProjectAnalyzer.AddProjectFiles(project);

            Filter filter = new Filter();

            filter.Add(".*").Exclude = true;

            project.Location.FindDirectories(filter).ParallelFor((directory) =>
            {
                cache.Store(directory);
            });

            Analyzer.SetProjectType(project);
            Analyzer.SetProjectDependencies(project);
            return(project);
        }