public PerProjectSettings(Lifetime lifetime, ISolution solution, ChangeManager changeManager, ModuleReferenceResolveSync moduleReferenceResolveSync, IViewableProjectsCollection projects, ISettingsSchema settingsSchema, SettingsStorageProvidersCollection settingsStorageProviders, IShellLocks locks, ILogger logger, InternKeyPathComponent interned, UnityProjectFileCacheProvider unityProjectFileCache) { mySolution = solution; myChangeManager = changeManager; mySettingsSchema = settingsSchema; mySettingsStorageProviders = settingsStorageProviders; myLocks = locks; myLogger = logger; myInterned = interned; myUnityProjectFileCache = unityProjectFileCache; myProjectMountPoints = new Dictionary <IProject, SettingsStorageMountPoint>(); myProjectLifetimes = new Dictionary <IProject, Lifetime>(); changeManager.RegisterChangeProvider(lifetime, this); changeManager.AddDependency(lifetime, this, moduleReferenceResolveSync); projects.Projects.View(lifetime, (projectLifetime, project) => { myProjectLifetimes.Add(project, projectLifetime); if (!project.IsUnityProject()) { return; } InitialiseProjectSettings(project); }); }
public MetaFileTracker(Lifetime lifetime, ChangeManager changeManager, ISolution solution, ILogger logger) { mySolution = solution; myLogger = logger; changeManager.RegisterChangeProvider(lifetime, this); changeManager.AddDependency(lifetime, this, solution); }
private void Register() { using (myShellLocks.UsingReadLock()) { var unityProjectLifetimes = new Dictionary <IProject, Lifetime>(); myProjects.Projects.View(myLifetime, (projectLifetime, project) => { if (project.IsUnityProject()) { unityProjectLifetimes.Add(project, projectLifetime); } myProjectLifetimes.Add(project, projectLifetime); }); var unityProjects = new UnityProjectsCollection(unityProjectLifetimes, mySolution.SolutionFilePath); foreach (var handler in myHandlers) { handler.OnSolutionLoaded(unityProjects); } myChangeManager.RegisterChangeProvider(myLifetime, this); myChangeManager.AddDependency(myLifetime, this, myModuleReferenceResolveSync); } }
private void OnSolutionPreparePsiModules() { myChangeManager.RegisterChangeProvider(myLifetime, this); myChangeManager.AddDependency(myLifetime, this, myModuleReferenceResolveSync); // Track the lifetime of all projects, so we can pass it to the handler later myProjects.Projects.View(myLifetime, (projectLifetime, project) => { myAllProjectLifetimes.Add(projectLifetime, project, projectLifetime); if (HasUnityReferenceOrFlavour(project)) { myUnityProjects.Add(projectLifetime, project); } }); var unityProjectLifetimes = myAllProjectLifetimes.Where(pair => HasUnityReferenceOrFlavour(pair.Key)).ToList(); if (unityProjectLifetimes.Count == 0) { return; } NotifyHasUnityReference(); NotifyOnUnityProjectAdded(unityProjectLifetimes); }
private void AfterSolutionLoadDone() { using (myShellLocks.UsingReadLock()) { // Track the lifetime of all projects, so we can pass it to the handler later myProjects.Projects.View(myLifetime, (projectLifetime, project) => myProjectLifetimes.Add(project, projectLifetime)); var unityProjectLifetimes = myProjectLifetimes.Where(pl => pl.Key.IsUnityProject()).ToList(); if (unityProjectLifetimes.Any()) { HasUnityReference.SetValue(true); } foreach (var handler in myHandlers) { foreach (var(project, lifetime) in unityProjectLifetimes) { handler.OnUnityProjectAdded(lifetime, project); } } myChangeManager.RegisterChangeProvider(myLifetime, this); myChangeManager.AddDependency(myLifetime, this, myModuleReferenceResolveSync); } }
public ProjectReferenceChangeTracker( Lifetime lifetime, ISolution solution, ModuleReferenceResolveSync moduleReferenceResolveSync, ChangeManager changeManager, IViewableProjectsCollection projects) { myHandlers = new ConcurrentBag <Action <Lifetime, IProject> >(); myProjectLifetimes = new Dictionary <IProject, Lifetime>(); mySolution = solution; myChangeManager = changeManager; myProjectLifetimes = new Dictionary <IProject, Lifetime>(); myChangeManager.RegisterChangeProvider(lifetime, this); myChangeManager.AddDependency(lifetime, this, moduleReferenceResolveSync); projects.Projects.View(lifetime, (projectLifetime, project) => { myProjectLifetimes.Add(project, projectLifetime); if (!project.IsUnityProject()) { return; } Handle(project); }); }
internal T4PsiModule([NotNull] Lifetime lifetime, [NotNull] IPsiModules psiModules, [NotNull] DocumentManager documentManager, [NotNull] ChangeManager changeManager, [NotNull] IAssemblyFactory assemblyFactory, [NotNull] IShellLocks shellLocks, [NotNull] IProjectFile projectFile, [NotNull] T4FileDataCache fileDataCache, [NotNull] T4Environment t4Environment, [NotNull] OutputAssemblies outputAssemblies) { _lifetime = lifetime; lifetime.AddAction(Dispose); _psiModules = psiModules; _assemblyFactory = assemblyFactory; _changeManager = changeManager; _shellLocks = shellLocks; _projectFile = projectFile; IProject project = projectFile.GetProject(); Assertion.AssertNotNull(project, "project != null"); _project = project; _solution = project.GetSolution(); changeManager.RegisterChangeProvider(lifetime, this); changeManager.AddDependency(lifetime, psiModules, this); _t4Environment = t4Environment; _outputAssemblies = outputAssemblies; _resolveProject = new T4ResolveProject(lifetime, _solution, _shellLocks, t4Environment.PlatformID, project); _sourceFile = CreateSourceFile(projectFile, documentManager); _isValid = true; fileDataCache.FileDataChanged.Advise(lifetime, OnDataFileChanged); AddBaseReferences(); }
protected FileSystemShimChangeProvider(Lifetime lifetime, Shim.IFileSystem fileSystem, ChangeManager changeManager, params IChangeProvider[] changeProviders) : base(lifetime, fileSystem) { changeManager.RegisterChangeProvider(lifetime, this); foreach (var changeProvider in changeProviders) { changeManager.AddDependency(lifetime, this, changeProvider); } }
public NitraSolutionComponent(Lifetime lifetime, ISolution solution, ChangeManager changeManager, DocumentManager documentManager, IShellLocks locks, IPsiConfiguration psiConfiguration, IPersistentIndexManager persistentIndexManager) { _persistentIndexManager = persistentIndexManager; _psiConfiguration = psiConfiguration; _locks = locks; _solution = solution; _documentManager = documentManager; //changeManager.Changed2.Advise(lifetime, OnChangeManagerChanged); changeManager.RegisterChangeProvider(lifetime, this); changeManager.AddDependency(lifetime, this, documentManager.ChangeProvider); changeManager.AddDependency(lifetime, this, solution); foreach (var project in solution.GetAllProjects()) { Debug.WriteLine(project.Name); //var projectItem = project as JetBrains.Proj foreach (var file in project.GetAllProjectFiles()) { var ext = System.IO.Path.GetExtension(file.Name); if (string.Equals(ext, ".dll", StringComparison.InvariantCultureIgnoreCase)) { continue; } if (file.LanguageType.Name == "MSBuild") { continue; } if (string.Equals(ext, ".dsl", StringComparison.InvariantCultureIgnoreCase)) { var stream = file.CreateReadStream(); string content = ""; using (var streamReader = new StreamReader(stream)) content = streamReader.ReadToEnd(); Debug.WriteLine(content); } Debug.WriteLine(file.Name); } } }
public NitraSolutionComponent(Lifetime lifetime, ISolution solution, ChangeManager changeManager, DocumentManager documentManager, IShellLocks locks, IPsiConfiguration psiConfiguration, IPersistentIndexManager persistentIndexManager) { _persistentIndexManager = persistentIndexManager; _psiConfiguration = psiConfiguration; _locks = locks; _solution = solution; _documentManager = documentManager; //changeManager.Changed2.Advise(lifetime, OnChangeManagerChanged); changeManager.RegisterChangeProvider(lifetime, this); changeManager.AddDependency(lifetime, this, documentManager.ChangeProvider); changeManager.AddDependency(lifetime, this, solution); foreach (var project in solution.GetAllProjects()) { Debug.WriteLine(project.Name); //var projectItem = project as JetBrains.Proj foreach (var file in project.GetAllProjectFiles()) { var ext = System.IO.Path.GetExtension(file.Name); if (string.Equals(ext, ".dll", StringComparison.InvariantCultureIgnoreCase)) continue; if (file.LanguageType.Name == "MSBuild") continue; if (string.Equals(ext, ".dsl", StringComparison.InvariantCultureIgnoreCase)) { var stream = file.CreateReadStream(); string content = ""; using (var streamReader = new StreamReader(stream)) content = streamReader.ReadToEnd(); Debug.WriteLine(content); } Debug.WriteLine(file.Name); } } }
public MetaFileTracker(Lifetime lifetime, ChangeManager changeManager, ISolution solution, ILogger logger, ISolutionLoadTasksScheduler solutionLoadTasksScheduler) { mySolution = solution; myLogger = logger; solutionLoadTasksScheduler.EnqueueTask(new SolutionLoadTask("AdviseForChanges", SolutionLoadTaskKinds.AfterDone, () => { changeManager.RegisterChangeProvider(lifetime, this); changeManager.AddDependency(lifetime, this, solution); })); }
public T4PsiModuleProvider([NotNull] Lifetime lifetime, [NotNull] IShellLocks shellLocks, [NotNull] ChangeManager changeManager, [NotNull] T4Environment t4Environment, [NotNull] ISolution solution) { _lifetime = lifetime; _shellLocks = shellLocks; _changeManager = changeManager; _t4Environment = t4Environment; _solution = solution; changeManager.RegisterChangeProvider(lifetime, this); changeManager.AddDependency(lifetime, this, solution); }
public UnityExternalFilesModuleProcessor(Lifetime lifetime, ILogger logger, ISolution solution, ChangeManager changeManager, IShellLocks locks, ISolutionLoadTasksScheduler scheduler, IFileSystemTracker fileSystemTracker, ProjectFilePropertiesFactory projectFilePropertiesFactory, UnityYamlPsiSourceFileFactory psiSourceFileFactory, UnityExternalFilesModuleFactory moduleFactory, UnityYamlDisableStrategy unityYamlDisableStrategy, BinaryUnityFileCache binaryUnityFileCache, ISettingsSchema settingsSchema, SettingsLayersProvider settingsLayersProvider, AssetSerializationMode assetSerializationMode, UnityYamlSupport unityYamlSupport) { myLifetime = lifetime; myLogger = logger; mySolution = solution; myChangeManager = changeManager; myLocks = locks; myFileSystemTracker = fileSystemTracker; myProjectFilePropertiesFactory = projectFilePropertiesFactory; myPsiSourceFileFactory = psiSourceFileFactory; myModuleFactory = moduleFactory; myUnityYamlDisableStrategy = unityYamlDisableStrategy; myBinaryUnityFileCache = binaryUnityFileCache; mySettingsSchema = settingsSchema; mySettingsLayersProvider = settingsLayersProvider; myAssetSerializationMode = assetSerializationMode; myUnityYamlSupport = unityYamlSupport; changeManager.RegisterChangeProvider(lifetime, this); myRootPaths = new JetHashSet <FileSystemPath>(); // SolutionDirectory isn't absolute in tests, and will throw an exception if we use it when we call Exists mySolutionDirectory = solution.SolutionDirectory; if (!mySolutionDirectory.IsAbsolute) { mySolutionDirectory = solution.SolutionDirectory.ToAbsolutePath(FileSystemUtil.GetCurrentDirectory()); } scheduler.EnqueueTask(new SolutionLoadTask(GetType().Name + ".Activate", SolutionLoadTaskKinds.PreparePsiModules, () => myChangeManager.AddDependency(myLifetime, mySolution.PsiModules(), this))); }
public T4FilePsiModule( Lifetime lifetime, [NotNull] IProjectFile projectFile, [NotNull] ChangeManager changeManager, [NotNull] IShellLocks shellLocks, [NotNull] IT4Environment t4Environment ) { Lifetime = lifetime; lifetime.AddDispose(this); ProjectFile = projectFile; Solution = ProjectFile.GetSolution(); PsiModules = Solution.GetComponent <IPsiModules>(); PsiServices = Solution.GetComponent <IPsiServices>(); ChangeManager = changeManager; ShellLocks = shellLocks; ChangeProvider = new FakeChangeProvider(); TargetFrameworkId = ProjectFile.SelectTargetFrameworkId(t4Environment); Project = ProjectFile.GetProject().NotNull(); var resolveContext = Project.IsMiscFilesProject() ? UniversalModuleReferenceContext.Instance : this.GetResolveContextEx(ProjectFile); AssemblyReferenceManager = new T4AssemblyReferenceManager( Solution.GetComponent <IAssemblyFactory>(), SourceFile, ProjectFile, resolveContext, shellLocks ); ProjectReferenceManager = new T4ProjectReferenceManager(ProjectFile, Solution); changeManager.RegisterChangeProvider(lifetime, ChangeProvider); changeManager.AddDependency(lifetime, PsiModules, ChangeProvider); var documentManager = Solution.GetComponent <DocumentManager>(); SourceFile = CreateSourceFile(ProjectFile, documentManager); Solution.GetComponent <T4DeclaredAssembliesManager>().FileDataChanged.Advise(lifetime, OnFileDataChanged); ChangeManager.ExecuteAfterChange(() => { AssemblyReferenceManager.AddBaseReferences(); NotifyModuleChange(); }); }
public MetaFileTracker(Lifetime lifetime, ChangeManager changeManager, ISolution solution, ILogger logger, ISolutionLoadTasksScheduler solutionLoadTasksScheduler, UnitySolutionTracker unitySolutionTracker) { mySolution = solution; myLogger = logger; solutionLoadTasksScheduler.EnqueueTask(new SolutionLoadTask("AdviseForChanges", SolutionLoadTaskKinds.AfterDone, () => { if (!unitySolutionTracker.IsUnityGeneratedProject.Value) { return; } changeManager.RegisterChangeProvider(lifetime, this); changeManager.AddDependency(lifetime, this, solution); })); }
public T4FilePsiModule( Lifetime lifetime, [NotNull] IProjectFile projectFile, [NotNull] ChangeManager changeManager, [NotNull] IShellLocks shellLocks, [NotNull] IT4Environment t4Environment, [CanBeNull] TargetFrameworkId primaryTargetFrameworkId ) { Lifetime = lifetime; lifetime.AddDispose(this); ProjectFile = projectFile; Solution = ProjectFile.GetSolution(); PsiModules = Solution.GetComponent <IPsiModules>(); PsiServices = Solution.GetComponent <IPsiServices>(); ChangeManager = changeManager; ShellLocks = shellLocks; ChangeProvider = new T4WriteOnlyChangeProvider(); changeManager.RegisterChangeProvider(lifetime, ChangeProvider); changeManager.AddDependency(lifetime, PsiModules, ChangeProvider); TargetFrameworkId = t4Environment.SelectTargetFrameworkId(primaryTargetFrameworkId, projectFile); Project = ProjectFile.GetProject().NotNull(); var resolveContext = Project.IsMiscFilesProject() ? UniversalModuleReferenceContext.Instance : this.GetResolveContextEx(ProjectFile); Assertion.Assert(resolveContext.TargetFramework == TargetFrameworkId, "Failed to select TargetFrameworkId"); var documentManager = Solution.GetComponent <DocumentManager>(); SourceFile = CreateSourceFile(ProjectFile, documentManager, resolveContext); AssemblyReferenceManager = new T4AssemblyReferenceManager( Solution.GetComponent <IAssemblyFactory>(), SourceFile, ProjectFile, resolveContext, shellLocks ); Solution.GetComponent <T4DeclaredAssembliesManager>().FileDataChanged.Advise(lifetime, OnFileDataChanged); PersistentId = BuildPersistentId(primaryTargetFrameworkId); OriginalTargetFrameworkId = primaryTargetFrameworkId; }
public UnresolvedUnityReferencesTracker( Lifetime lifetime, ILogger logger, ISolution solution, IEnumerable <IHandler> handlers, ModuleReferenceResolveSync moduleReferenceResolveSync, ChangeManager changeManager) { myLifetime = lifetime; myLogger = logger; mySolution = solution; myHandlers = handlers.ToList(); myModuleReferenceResolveSync = moduleReferenceResolveSync; myChangeManager = changeManager; myChangeManager.RegisterChangeProvider(myLifetime, this); myChangeManager.AddDependency(myLifetime, this, myModuleReferenceResolveSync); }
internal T4PsiModule([NotNull] Lifetime lifetime, [NotNull] PsiModuleManager psiModuleManager, [NotNull] DocumentManager documentManager, [NotNull] ChangeManager changeManager, [NotNull] IAssemblyFactory assemblyFactory, [NotNull] IShellLocks shellLocks, [NotNull] IProjectFile projectFile, [NotNull] T4FileDataCache fileDataCache, [NotNull] T4Environment t4Environment, [NotNull] OutputAssembliesCache outputAssembliesCache) { _lifetime = lifetime; lifetime.AddAction(Dispose); _psiModuleManager = psiModuleManager; _documentManager = documentManager; _assemblyFactory = assemblyFactory; _changeManager = changeManager; changeManager.RegisterChangeProvider(lifetime, this); changeManager.AddDependency(lifetime, psiModuleManager, this); _shellLocks = shellLocks; _projectFile = projectFile; _project = projectFile.GetProject(); Assertion.AssertNotNull(_project, "_project != null"); _solution = _project.GetSolution(); _t4Environment = t4Environment; _outputAssembliesCache = outputAssembliesCache; _resolveProject = new T4ResolveProject(_solution, _shellLocks, t4Environment.PlatformID, _project); _sourceFile = new PsiProjectFile( this, _projectFile, (pf, sf) => new DefaultPsiProjectFileProperties(pf, sf), JetFunc <IProjectFile, IPsiSourceFile> .True, _documentManager); _isValid = true; fileDataCache.FileDataChanged.Advise(lifetime, OnDataFileChanged); AddBaseReferences(); }