Beispiel #1
0
        public static Project CreateProject(UInt32 tag, PathDescriptor location, List <FileSystemDescriptor> files)
        {
            Project project = new Project(tag, location);

            files.ParallelFor((file) =>
            {
                SharpReferenceNode node = new SharpReferenceNode(file as FileDescriptor);
                node.FetchExports();
                lock (project)
                {
                    project.Files.Nodes.Add(node);
                    foreach (KeyValuePair <int, string> type in node.Declarations)
                    {
                        project.Files[type.Value].Add(node);
                    }
                }
                if (node.Flags.Count != 0)
                {
                    lock (project)
                        project.AssemblyType = (OutputAssemblyType)node.Flags[0];
                }
            });

            ProjectAnalyzer.AddProjectFiles(project);
            return(project);
        }
Beispiel #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);
        }