async Task <Tuple <List <DocumentInfo>, List <DocumentInfo> > > CreateDocuments(ProjectData projectData, MonoDevelop.Projects.Project p, CancellationToken token, ImmutableArray <MonoDevelop.Projects.ProjectFile> sourceFiles, ProjectData oldProjectData) { var documents = new List <DocumentInfo> (); // We don' add additionalDocuments anymore because they were causing slowdown of compilation generation // and no upside to setting additionalDocuments, keeping this around in case this changes in future. var additionalDocuments = new List <DocumentInfo> (); var duplicates = new HashSet <DocumentId> (); // use given source files instead of project.Files because there may be additional files added by msbuild targets foreach (var f in sourceFiles) { if (token.IsCancellationRequested) { return(null); } if (f.Subtype == MonoDevelop.Projects.Subtype.Directory) { continue; } if (p.IsCompileable(f.FilePath) || CanGenerateAnalysisContextForNonCompileable(p, f)) { var filePath = (FilePath)f.Name; var id = projectData.DocumentData.GetOrCreate(filePath.ResolveLinks(), oldProjectData?.DocumentData); if (!duplicates.Add(id)) { continue; } documents.Add(CreateDocumentInfo(solutionData, p.Name, projectData, f)); } else { foreach (var projectedDocument in await GenerateProjections(f, projectData.DocumentData, p, token, oldProjectData, null)) { var projectedId = projectData.DocumentData.GetOrCreate(projectedDocument.FilePath, oldProjectData?.DocumentData); if (!duplicates.Add(projectedId)) { continue; } documents.Add(projectedDocument); } } } var projectId = projectMap.GetId(p); lock (workspace.generatedFiles) { foreach (var generatedFile in workspace.generatedFiles) { if (generatedFile.Key.Id.ProjectId == projectId) { documents.Add(generatedFile.Key); } } } return(Tuple.Create(documents, additionalDocuments)); }
static bool CanCompile(MonoDevelop.Projects.Project project, ProjectFile file) { return(project.IsCompileable(file.FilePath) && project.IsCompileBuildAction(file.BuildAction)); }
public static bool IsCompileableFile(MonoDevelop.Projects.Project p, ProjectFile file, out Microsoft.CodeAnalysis.SourceCodeKind sck) { sck = file.SourceCodeKind; return(p.IsCompileable(file.FilePath)); }