public UnityReferenceSynchronizer(Lifetime lifetime, UnityHost host, UnityReferencesTracker referencesTracker)
 {
     host.PerformModelAction(m =>
     {
         referencesTracker.HasUnityReference.Advise(lifetime, res => { m.HasUnityReference.SetValue(res); });
     });
 }
        public UnityInstallationSynchronizer(Lifetime lifetime, UnityReferencesTracker referencesTracker,
                                             UnityHost host, UnityInstallationFinder finder, UnityVersion unityVersion)
        {
            referencesTracker.HasUnityReference.Advise(lifetime, hasReference =>
            {
                if (!hasReference)
                {
                    return;
                }
                var version = unityVersion.GetActualVersionForSolution();
                var path    = finder.GetApplicationPath(version);
                if (path == null)
                {
                    return;
                }

                var contentPath = finder.GetApplicationContentsPath(version);

                host.PerformModelAction(rd =>
                {
                    // ApplicationPath may be already set via UnityEditorProtocol, which is more accurate
                    if (!rd.ApplicationPath.HasValue())
                    {
                        rd.ApplicationPath.SetValue(path.FullPath);
                    }
                    if (!rd.ApplicationContentsPath.HasValue())
                    {
                        rd.ApplicationContentsPath.SetValue(contentPath.FullPath);
                    }
                });
            });
        }
示例#3
0
 public ExpensiveCodeCallGraphAnalyzer(Lifetime lifetime, ISolution solution, UnityReferencesTracker referencesTracker,
                                       UnitySolutionTracker unitySolutionTracker)
     : base(MarkId, new CalleeToCallerCallGraphPropagator(solution, MarkId))
 {
     Enabled.Value = unitySolutionTracker.IsUnityProject.HasTrueValue();
     referencesTracker.HasUnityReference.Advise(lifetime, b => Enabled.Value = Enabled.Value | b);
 }
 public PerformanceCriticalCodeMarksProvider(Lifetime lifetime, ISolution solution,
                                             UnityReferencesTracker referencesTracker, UnitySolutionTracker tracker)
     : base(MarkId, new CallGraphOutcomingPropagator(solution, MarkId))
 {
     Enabled.Value = tracker.IsUnityProject.HasTrueValue();
     referencesTracker.HasUnityReference.Advise(lifetime, b => Enabled.Value = Enabled.Value | b);
 }
示例#5
0
 public PerformanceCriticalCodeCallGraphAnalyzer(Lifetime lifetime, ISolution solution, UnityApi unityApi,
                                                 UnityReferencesTracker referencesTracker, UnitySolutionTracker tracker)
     : base(MarkId, new CallerToCalleeCallGraphPropagator(solution, MarkId))
 {
     myUnityApi    = unityApi;
     Enabled.Value = tracker.IsUnityProject.HasTrueValue();
     referencesTracker.HasUnityReference.Advise(lifetime, b => Enabled.Value = Enabled.Value | b);
 }
示例#6
0
 public UnityGameEngineDirectiveResolver(ISolution solution, UnitySolutionTracker solutionTracker,
                                         UnityReferencesTracker referencesTracker, ILogger logger)
 {
     mySolution          = solution;
     mySolutionTracker   = solutionTracker;
     myReferencesTracker = referencesTracker;
     myLogger            = logger;
 }
 public UnityPencilsFilter(Lifetime lifetime, UnitySolutionTracker solutionTracker,
                           UnityReferencesTracker referencesTracker, ISettingsStore store)
     : base("Unity", "Plugins", "Unity", "", solutionTracker.IsUnityProject.HasTrueValue(), store,
            s => s.EnablePerformanceCriticalCodeHighlighting)
 {
     referencesTracker.HasUnityReference.Advise(lifetime,
                                                b => IsVisible.Value = solutionTracker.IsUnityProject.HasTrueValue() || b);
 }
示例#8
0
 public BurstStrictlyBannedMarkProvider(
     Lifetime lifetime,
     [NotNull] UnitySolutionTracker tracker,
     [NotNull] UnityReferencesTracker referencesTracker)
     : base(BurstMarksProvider.MarkId, MarkId, new SimplePropagator())
 {
     Enabled.Value = tracker.IsUnityProject.HasTrueValue();
     referencesTracker.HasUnityReference.Advise(lifetime, b => Enabled.Value = Enabled.Value | b);
 }
 public BurstMarksProvider(Lifetime lifetime, ISolution solution,
                           UnityReferencesTracker referencesTracker,
                           UnitySolutionTracker tracker,
                           IEnumerable <IBurstBannedAnalyzer> prohibitedContextAnalyzers)
     : base(MarkId, new BurstPropagator(solution, MarkId))
 {
     Enabled.Value = tracker.IsUnityProject.HasTrueValue();
     referencesTracker.HasUnityReference.Advise(lifetime, b => Enabled.Value = Enabled.Value | b);
     myBurstBannedAnalyzers = prohibitedContextAnalyzers.ToList();
 }
        public Tuple <IProjectPsiModuleHandler, IPsiModuleDecorator> OverrideHandler(Lifetime lifetime, IProject project,
                                                                                     IProjectPsiModuleHandler handler)
        {
            if (handler.PrimaryModule != null && UnityReferencesTracker.ReferencesUnity(project))
            {
                var module = new UnityShaderModule(project.GetSolution(), project.Name, handler.PrimaryModule.TargetFrameworkId);

                var newHandlerAndDecorator = new UnityShaderModuleHandlerAndDecorator(module, handler);
                return(new Tuple <IProjectPsiModuleHandler, IPsiModuleDecorator>(newHandlerAndDecorator,
                                                                                 newHandlerAndDecorator));
            }

            return(null);
        }
示例#11
0
        public UnitySolutionTracker(ISolution solution, IFileSystemTracker fileSystemTracker, Lifetime lifetime, IShellLocks locks,
                                    UnityHost unityHost, UnityReferencesTracker unityReferencesTracker)
        {
            mySolution = solution;
            if (locks.Dispatcher.IsAsyncBehaviorProhibited) // for tests
            {
                return;
            }

            SetValues();

            fileSystemTracker.AdviseDirectoryChanges(lifetime, mySolution.SolutionDirectory.Combine(ProjectExtensions.AssetsFolder), false,
                                                     OnChangeAction);
            // track not only folder itself, but also files inside
            fileSystemTracker.AdviseDirectoryChanges(lifetime, mySolution.SolutionDirectory.Combine(ProjectExtensions.ProjectSettingsFolder), true,
                                                     OnChangeActionProjectSettingsFolder);

            unityHost.PerformModelAction(model =>
            {
                unityReferencesTracker.HasUnityReference.Advise(lifetime, res => { model.HasUnityReference.SetValue(res); });
            });
        }
 public CgIncludeDirectoryTracker(Lifetime lifetime, UnityReferencesTracker unityReferencesTracker,
                                  SolutionCaches solutionCaches, IShellLocks shellLocks, ISolutionLoadTasksScheduler scheduler,
                                  CppGlobalCacheImpl cppGlobalCache, UnityVersion unityVersion, ILogger logger)
 {
     scheduler.EnqueueTask(new SolutionLoadTask("InitCgIncludeDirectoryTracker", SolutionLoadTaskKinds.PreparePsiModules,
                                                () =>
     {
         unityReferencesTracker.HasUnityReference.AdviseOnce(lifetime, _ =>
         {
             if (solutionCaches.PersistentProperties.TryGetValue(CG_INCLUDE_DIRECTORY_PATH, out var result))
             {
                 var oldPath = FileSystemPath.TryParse(result, FileSystemPathInternStrategy.INTERN);
                 var newPath = GetCgIncludeFolderPath(unityVersion);
                 if (!oldPath.Equals(newPath))
                 {
                     cppGlobalCache.IsCacheStarted.Change.Advise(lifetime, v =>
                     {
                         if (v.HasNew && v.New)
                         {
                             shellLocks.Tasks.StartNew(lifetime, Scheduling.MainGuard, TaskPriority.High, () =>
                             {
                                 logger.Verbose("Dropping C++ cache, because Unity version is changed");
                                 cppGlobalCache.ResetCache();
                                 solutionCaches.PersistentProperties[CG_INCLUDE_DIRECTORY_PATH] = newPath.FullPath;
                             });
                         }
                     });
                 }
             }
             else
             {
                 solutionCaches.PersistentProperties[CG_INCLUDE_DIRECTORY_PATH] = GetCgIncludeFolderPath(unityVersion).FullPath;
             }
         });
     }));
 }
示例#13
0
 public UnityProjectTypeLogContributor(UnitySolutionTracker unitySolutionTracker, UnityReferencesTracker unityReferencesTracker)
 {
     myUnitySolutionTracker   = unitySolutionTracker;
     myUnityReferencesTracker = unityReferencesTracker;
 }
 public UnityReferenceSynchronizer(Lifetime lifetime, FrontendBackendHost host, UnityReferencesTracker referencesTracker)
 {
     host.Do(m =>
     {
         referencesTracker.HasUnityReference.Advise(lifetime, res => { m.HasUnityReference.SetValue(res); });
     });
 }
 public UnityShortcutCache(Lifetime lifetime, IShellLocks shellLocks, IPersistentIndexManager persistentIndexManager, UnityReferencesTracker unityReferencesTracker)
     : base(lifetime, shellLocks, persistentIndexManager, CreateMarshaller())
 {
     myUnityReferencesTracker = unityReferencesTracker;
 }
        public UnityInstallationSynchronizer(Lifetime lifetime, UnitySolutionTracker solutionTracker,
                                             UnityHost host, UnityVersion unityVersion, UnityReferencesTracker referencesTracker,
                                             UnityEditorProtocol unityEditorProtocol)
        {
            myUnityEditorProtocol = unityEditorProtocol;
            solutionTracker.IsUnityProjectFolder.Advise(lifetime, res =>
            {
                if (!res)
                {
                    return;
                }
                NotifyFrontend(host, unityVersion);
            });

            referencesTracker.HasUnityReference.Advise(lifetime, res =>
            {
                if (!res)
                {
                    return;
                }
                NotifyFrontend(host, unityVersion);
            });
        }
 public UnityProjectTechnologyProvider(UnityReferencesTracker unityReferencesTracker)
 {
     myUnityReferencesTracker = unityReferencesTracker;
 }
 public UnityPencilsFilterProvider(UnitySolutionTracker solutionTracker, UnityReferencesTracker referencesTracker)
 {
     mySolutionTracker   = solutionTracker;
     myReferencesTracker = referencesTracker;
 }