Esempio n. 1
0
        public async Task CanReadOldProjectCache_MissingAdditionalFiles_MissingEditorConfigFiles()
        {
            FilePath solFile = Util.GetSampleProject("additional-files", "additional-files.sln");

            using (var sol = (Solution)await Services.ProjectService.ReadWorkspaceItem(Util.GetMonitor(), solFile)) {
                var p = sol.FindProjectByName("library") as DotNetProject;

                var cacheDirectory   = sol.GetPreferencesDirectory().Combine("project-cache");
                var projectCacheFile = GetProjectCacheFile(cacheDirectory, p, "Debug");

                var cache = new WorkspaceFilesCache.ProjectCache {
                    Format             = WorkspaceFilesCache.format,
                    Analyzers          = Array.Empty <string> (),
                    BuildActions       = Array.Empty <string> (),
                    Files              = Array.Empty <string> (),
                    Framework          = null,
                    MetadataReferences = Array.Empty <WorkspaceFilesCache.ReferenceItem> (),
                    ProjectReferences  = Array.Empty <WorkspaceFilesCache.ReferenceItem> (),
                    AdditionalFiles    = null,
                    EditorConfigFiles  = null
                };

                Directory.CreateDirectory(projectCacheFile.ParentDirectory);
                var workspaceFilesCache = new WorkspaceFilesCache();
                workspaceFilesCache.WriteCacheFile(cache, projectCacheFile);

                var cacheInfo = GetProjectCacheInfo(sol, p);
                Assert.IsNotNull(cacheInfo);

                Assert.AreEqual(0, cacheInfo.AdditionalFiles.Length);
                Assert.AreEqual(0, cacheInfo.EditorConfigFiles.Length);
            }
        }
        static ProjectCacheInfo GetProjectCacheInfo(Solution sol, Project p)
        {
            var ws    = IdeServices.TypeSystemService.GetWorkspace(sol);
            var cache = new WorkspaceFilesCache();

            cache.Load(sol);

            if (cache.TryGetCachedItems(p, ws.MetadataReferenceManager, ws.ProjectMap, out ProjectCacheInfo cacheInfo))
            {
                return(cacheInfo);
            }
            return(null);
        }
Esempio n. 3
0
            public ProjectSystemHandler(MonoDevelopWorkspace workspace, ProjectDataMap projectMap, ProjectionData projections)
            {
                this.workspace      = workspace;
                this.projectMap     = projectMap;
                this.projections    = projections;
                this.workspaceCache = new WorkspaceFilesCache();

                metadataHandler            = new Lazy <MetadataReferenceHandler> (() => new MetadataReferenceHandler(workspace.MetadataReferenceManager, projectMap));
                hostDiagnosticUpdateSource = new Lazy <HostDiagnosticUpdateSource> (() => new HostDiagnosticUpdateSource(workspace, workspace.compositionManager.GetExportedValue <IDiagnosticUpdateSourceRegistrationService> ()));

                var persistentStorageLocationService = (MonoDevelopPersistentStorageLocationService)workspace.Services.GetService <IPersistentStorageLocationService> ();

                if (workspace.MonoDevelopSolution != null)
                {
                    persistentStorageLocationServiceRegistration = persistentStorageLocationService.RegisterPrimaryWorkspace(workspace.Id);
                }
            }
Esempio n. 4
0
 internal void ReloadProjectCache()
 {
     workspaceCache = new WorkspaceFilesCache();
     workspaceCache.Load(workspace.MonoDevelopSolution);
 }