public void RegisterCallbacks( AstManager astManager, ISolution solution, ProjectModelViewHost host, DteProtocolModel model ) { model.Solution_FileName.SetWithReadLock(() => solution.SolutionFilePath.FullPath); model.Solution_Count.SetWithReadLock(() => solution.GetAllProjects().Count); model.Solution_Item.SetWithReadLock(index => { var projects = solution.GetAllProjects(); if (projects.Count < index) { return(new Rider.Model.ProjectModel(-1)); } var project = projects.ElementAt(index - 1); int id = host.GetIdByItem(project); return(new Rider.Model.ProjectModel(id)); }); model.Solution_get_Projects.SetWithReadLock(() => solution .GetAllProjects() .Select(host.GetIdByItem) .Where(id => id != 0) .Select(id => new Rider.Model.ProjectModel(id)) .AsList()); }
private void CheckAllProjects() { foreach (var project in mySolution.GetAllProjects()) { InstallPluginIfRequired(myLifetime, project); } }
private List <HandlerCompletionItem> DetermineHandlers(ISolution solution) { var handlers = new List <HandlerCompletionItem>(); using (ReadLockCookie.Create()) { var projects = solution.GetAllProjects(); foreach (var project in projects) { if (!LambdaFinder.IsLambdaProjectType(project)) { continue; } var psiModules = project.GetPsiModules(); foreach (var psiModule in psiModules) { using (CompilationContextCookie.OverrideOrCreate(psiModule.GetContextFromModule())) { var scope = _symbolCache.GetSymbolScope(psiModule, false, true); var namespaces = scope.GlobalNamespace.GetNestedNamespaces(scope); foreach (var @namespace in namespaces) { ProcessNamespace(@namespace, scope, handlers); } } } } } return(handlers); }
private static IEnumerable <IPsiSourceFile> GetAllSolutionFiles([NotNull] ISolution solution) { var psiModules = solution.GetComponent <IPsiModules>(); foreach (var project in solution.GetAllProjects()) { var projectKind = project.ProjectProperties.ProjectKind; if (projectKind == ProjectKind.MISC_FILES_PROJECT) { continue; } foreach (var module in psiModules.GetPsiModules(project)) { foreach (var sourceFile in module.SourceFiles) { // filter out synthetic files out of solution var projectFile = sourceFile.ToProjectFile(); if (projectFile == null) { continue; } yield return(sourceFile); } } } }
private IEnumerable <DebuggerOutputAssemblyInfo> GetOutputAssembliesInfoInternal() { var assemblyInfoDatabase = mySolution.GetComponent <AssemblyInfoDatabase>(); foreach (var project in mySolution.GetAllProjects().Where(x => x.IsProjectFromUserView())) { var configurations = project.ProjectProperties.ActiveConfigurations; foreach (var targetFrameworkId in project.TargetFrameworkIds) { var pathMap = configurations.TryGetPathMap(targetFrameworkId); var outputAssemblyName = project.GetOutputFilePath(targetFrameworkId).Name; var projectLocation = project.ProjectFileLocation.Parent; var unityOutputPath = projectLocation.Combine("Library/ScriptAssemblies").Combine(outputAssemblyName); if (!unityOutputPath.IsEmpty && unityOutputPath.IsAbsolute) { var assemblyNameInfo = assemblyInfoDatabase.GetAssemblyName(unityOutputPath); if (assemblyNameInfo.IsNullOrEmpty()) { // The file should always exist - Unity will make sure it's there, as long as there are no // compile errors. And if there are compile errors (or the file doesn't exist for other // reasons), then debugging is unlikely to be successful, so there's nothing useful we can // do here myLogger.Warn("Cannot create assembly name for {0}", unityOutputPath); continue; } yield return(new DebuggerOutputAssemblyInfo(assemblyNameInfo, projectLocation.FullPath, unityOutputPath.FullPath, in pathMap)); } } } }
private bool TryFindExistingPluginInSolution(ISolution solution, Version newVersion, out InstallationInfo result) { var locationDll = solution.GetAllAssemblies() .Select(assembly => assembly.GetLocation()) .FirstOrDefault(t => t.Name == PluginPathsProvider.BasicPluginDllFile); if (locationDll == null || !locationDll.ExistsFile) { result = InstallationInfo.DoNotInstall; return(false); } var pluginFiles = solution.GetAllProjects().SelectMany(p => p. GetAllProjectFiles(f => { var location = f.Location; if (location == null || !location.ExistsFile) { return(false); } return(location.Name == PluginCsFile); })) .Select(f => f.Location) .ToList(); pluginFiles.Add(locationDll); result = GetInstallationInfoFromFoundInstallation(pluginFiles, newVersion); return(true); }
private bool TryFindInSolution(ISolution solution, out InstallationInfo result) { result = ShouldNotInstall; var locationDll = solution.GetAllAssemblies() .Select(assembly => assembly.GetLocation()) .FirstOrDefault(t => t.Name == PluginPathsProvider.BasicPluginDllFile); if (locationDll == null) { return(false); } var pluginFiles = solution.GetAllProjects().SelectMany(p => p. GetAllProjectFiles(f => { var location = f.Location; if (location == null) { return(false); } var fileName = location.Name; return(ourPluginCsFile.Contains(fileName)); })) .Select(f => f.Location) .ToList(); pluginFiles.Add(locationDll); result = ExistingInstallation(pluginFiles); return(true); }
public override ICollection <IOccurence> Search(IProgressIndicator progressIndicator) { var typeElements = new List <ITypeDeclaration>(); var multiCoreFibersPool = new MultiCoreFibersPool("Search type declarations", locks); using (IMultiCoreFibers multiCoreFibers = multiCoreFibersPool.Create()) { foreach (var project in solution.GetAllProjects()) { var sourceFiles = project.GetAllProjectFiles().SelectMany(projectFile => projectFile.ToSourceFiles()); foreach (var psiSourceFile in sourceFiles) { IFile file = psiSourceFile.GetCSharpFile(); if (file == null) { continue; } multiCoreFibers.EnqueueJob(() => file.ProcessChildren <ITypeDeclaration>(typeElements.Add)); } } } return((from typeDeclaration in typeElements let element = typeDeclaration.DeclaredElement where element != null where componentRegistration.IsSatisfiedBy(element) select new DeclaredElementOccurence(element)).Cast <IOccurence>().ToList()); }
private static IDeclaredElement FindTypeInFile(ISolution solution, string testFile, int typeSequenceInFile) { var projectFile = solution.GetAllProjects() .SelectMany(p => p.GetAllProjectFiles()).SingleOrDefault(p => p.GetPresentableProjectPath() == testFile); if (projectFile == null) { solution.GetAllProjects().SelectMany(p => p.GetAllProjectFiles()).ForEach(p => Debug.WriteLine(p.GetPresentableProjectPath())); throw new Exception("Whilst configuring test I didn't find project item: " + testFile); } var document = DocumentManager.GetInstance(solution).GetOrCreateDocument(projectFile); var findFirstTypeInFile = ResharperHelper.FindDeclaredElementInFile(solution, document, typeSequenceInFile); return(findFirstTypeInFile); }
private IProject ResolveTargetTestProject([NotNull] ITreeNode contextNode, [NotNull] ISolution solution, [NotNull] ReSharperHelperSettings helperSettings) { // Get project by assembly attribute (if present). var projectName = solution.GetPsiServices() .Symbols .GetModuleAttributes(contextNode.GetPsiModule()) .GetAttributeInstances(AssemblyMetadataAttributeName, false) .Select(TryExtractProjectNameFromAssemblyMetadataAttribute) .FirstNotNull(); // Check whether we have configured global test project. if (string.IsNullOrEmpty(projectName)) { projectName = helperSettings.TestsProjectName; } if (!string.IsNullOrEmpty(projectName)) { return(solution.GetProjectByName(projectName)); } // Try to guess project specific test project. var currentProjectName = contextNode.GetProject()?.Name; if (currentProjectName == null) { return(null); } var candidates = TestProjectSuffixes .SelectMany(suffix => solution.GetProjectsByName(currentProjectName + suffix)) .WhereNotNull() .ToArray(); if (candidates.Length > 0) { if (candidates.Length == 1) { return(candidates[0]); } return(null); } // Try to guess global test project. candidates = solution.GetAllProjects() .Where(proj => TestProjectSuffixes.Any(suffix => proj.Name.EndsWith(suffix, StringComparison.Ordinal))) .ToArray(); if (candidates.Length == 1) { return(candidates[0]); } return(null); }
IEnumerable <IDotNetProject> GetProjects(ISolution solution) { if (solution != null) { foreach (IDotNetProject project in solution.GetAllProjects()) { yield return(project); } } }
/// <summary> /// Requires re-entrency guard (ReentrancyGuard.Current.Execute) and read lock (ReadLockCookie.Execute). /// </summary> public void AnalyzeAllProjects() { var projects = _solution.GetAllProjects(); projects.Remove(_solution.MiscFilesProject); projects.Remove(_solution.SolutionProject); foreach (var project in projects) { AnalyzeProject(project); } }
public void DoTestFiles(string fullProjectPathToTestFile) { Assert.IsNotNull(_loadedTestSolution, "Expected solution to be loaded"); bool processedFile = false; var listOfProjectPaths = new List <string>(); RunGuarded(() => { foreach (var project in _loadedTestSolution.GetAllProjects()) { List <IProjectFile> projectFiles = project.GetAllProjectFiles().ToList(); foreach (IProjectFile projectFile in projectFiles.Where(p => p.LanguageType.Is <CSharpProjectFileType>())) { listOfProjectPaths.Add(projectFile.GetPresentableProjectPath()); if (fullProjectPathToTestFile != projectFile.GetPresentableProjectPath()) { continue; } IPsiSourceFile sourceFile = projectFile.ToSourceFile(); Assert.IsNotNull(sourceFile); if (!sourceFile.Properties.IsNonUserFile) { processedFile = true; Assert.IsTrue(projectFile.Kind == ProjectItemKind.PHYSICAL_FILE); IProjectFile file = projectFile; ExecuteWithGold(projectFile.Location.FullPath , (writer => { var highlightDumper = CreateHighlightDumper(sourceFile, writer); highlightDumper.DoHighlighting( DaemonProcessKind.VISIBLE_DOCUMENT); highlightDumper.Dump(); DumperShortCutAction(file, writer); })); return; } } } }); if (!processedFile) { listOfProjectPaths.ForEach(f => System.Diagnostics.Trace.WriteLine("Located Item:" + f)); Assert.Fail("Failed to project file by project path " + fullProjectPathToTestFile); } }
public UnrealPluginDetector(Lifetime lifetime, ILogger logger, UnrealHost unrealHost, CppUE4SolutionDetector solutionDetector, ISolution solution) { myLifetime = lifetime; InstallInfoProperty = new Property <UnrealPluginInstallInfo>(myLifetime, "UnrealPlugin.InstallInfoNotification", null, true); myLogger = logger; myUnrealHost = unrealHost; mySolution = solution; mySolutionDetector = solutionDetector; mySolutionDetector.IsUE4Solution_Observable.Change.Advise_When(myLifetime, newValue => newValue == TriBool.True, isUESolution => { myUnrealVersion = new Version(4, mySolutionDetector.UE4Version, mySolutionDetector.UE4PatchVersion); var installInfo = new UnrealPluginInstallInfo(); var foundEnginePlugin = TryGetEnginePluginFromSolution(mySolution, installInfo); var uprojectLocations = mySolution.GetAllProjects().SelectMany(project => project.GetAllProjectFiles(projectFile => { var location = projectFile.Location; if (location == null || !location.ExistsFile) { return(false); } return(location.ExtensionNoDot == UPROJECT_FILE_FORMAT && location.NameWithoutExtension == project.Name); })).Select(file => file.Location).ToSet(); if (!foundEnginePlugin) { // All projects in the solution are bound to the same engine // So take first project and use it to find Unreal Engine foundEnginePlugin = TryGetEnginePluginFromUproject(uprojectLocations.FirstNotNull(), installInfo); } if (!foundEnginePlugin) { // We didn't find Engine plugins, let's gather data about Project plugins foreach (var uprojectLocation in uprojectLocations) { var projectPlugin = GetProjectPluginForUproject(uprojectLocation, installInfo); installInfo.ProjectPlugins.Add(projectPlugin); } } InstallInfoProperty.SetValue(installInfo); }); }
protected override Action <ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress) { // Main logic var sb = new StringBuilder(); var sbOccur = new StringBuilder(); _output = new List <string>(); var projects = solution.GetAllProjects(); foreach (var project in projects) { sb.AppendLine(project.Name); //var assemblyReferences = project.GetAssemblyReferences(TargetFrameworkId.Default).Where(_ => _.Name.Contains("SunGard.AvantGard.Quantum") && !_.Name.Contains("SunGard.AvantGard.Quantum.External")); var assemblyReferences = project.GetProjectReferences(TargetFrameworkId.Default).Where(_ => _.Name.Contains("ES.Shared")).ToList(); foreach (var reference in assemblyReferences) { sb.AppendLine($" - {reference.Name}"); } var moduleReference = assemblyReferences.Cast <IProjectToModuleReference>().ToList(); if (moduleReference.Count == 0) { continue; } sbOccur.AppendLine(project.Name); var searchRequest = new SearchCodeDependentOnReferenceRequest(moduleReference); var occurrences = searchRequest.Search(); var referenceOccurrences = occurrences.Cast <ReferenceOccurrence>().ToList(); foreach (var sameReferenceGroup in referenceOccurrences.GroupBy(_ => _.Target.ToString()).OrderBy(_ => _.Key)) { sbOccur.AppendLine($" - {sameReferenceGroup.Key}"); //not output details for now //foreach (var item in sameReferenceGroup) //{ // sbOccur.AppendLine(string.Format(" - {0}", item.DumpToString())); //} } } _output.Add(sb.ToString()); _output.Add(sbOccur.ToString()); // Pass all the environment variables to the form and gather the main logic there _observerThread = new Thread(ObserverThread); _observerThread.Start(); return(null); }
private static bool HasModernUnityProjects(ISolution solution) { // Either all projects are not loaded, when msbuild is not found or // Unity, which requires new MSBuild with C# 7.3 support, writes TargetFrameworkVersion 4.7.1 to csproj using (solution.Locks.UsingReadLock()) { var projects = solution.GetAllProjects(); return (projects.All(project => !project.GetAllTargetFrameworks().Any()) || projects.Any(project => project.TargetFrameworkIds .Any(x => x.IsNetFramework && x.Version.Major >= 4 && x.Version.Minor >= 7 && x.Version.MajorRevision >= 1))); } }
private List <FileSystemPath> CollectAllFilesToAnalyze(ISolution solution) { List <FileSystemPath> files_to_analyze = new List <FileSystemPath>(); SimianProjectVisitor visitor = new SimianProjectVisitor(files_to_analyze); visitor.AddExcludeSpecs(SimianOptions.Instance.SpecsToExclude); visitor.AddIncludeSpecs(SimianOptions.Instance.SpecsToInclude); foreach (IProject project in solution.GetAllProjects()) { project.Accept(visitor); } return(files_to_analyze); }
void UnloadMSBuildHost() { if (solutionContainingProjectBuildersToDispose == null) { return; } GuiSyncDispatch(() => { foreach (IDotNetProject project in solutionContainingProjectBuildersToDispose.GetAllProjects()) { project.DisposeProjectBuilder(); } }); }
void SolutionLoaded(object sender, EventArgs e) { var solutionEventArgs = (DotNetSolutionEventArgs)e; ISolution solution = solutionEventArgs.Solution; solution.ProjectAdded += ProjectAdded; List <IDotNetProject> projects = solution.GetAllProjects().ToList(); foreach (IDotNetProject project in projects) { project.Modified += ProjectModified; } monitoredSolutions.Add(new MonitoredSolution { Solution = solution, Projects = projects }); }
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 static bool TryGetProject( ISolution solution, RelativePath relativeFilePath, out IProject project, out string failReason) { string projectName = relativeFilePath.FirstComponent; project = solution.GetAllProjects() .FirstOrDefault(x => string.Equals(x.Name, projectName, StringComparison.OrdinalIgnoreCase)); if (project == null) { failReason = $"Invalid file path '{relativeFilePath}'. The prject '{projectName}' is not found."; return(false); } failReason = null; return(true); }
public IModule GetTargetModule <T>(T element) { var value = element as ICSharpExpression; if (value == null || value.ConstantValue == null || !value.ConstantValue.IsString()) { // currently only direct string values are supported; return(null); } string assemblyName = Convert.ToString(value.ConstantValue.Value); ISolution solution = value.GetSolution(); IProject result = solution.GetAllProjects().FirstOrDefault(project => project.Name.Equals(assemblyName, StringComparison.OrdinalIgnoreCase)); return(result); }
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 ManagePackagesViewModel( IMonoDevelopSolutionManager solutionManager, ISolution solution, INuGetProjectContext projectContext, RecentManagedNuGetPackagesRepository recentPackagesRepository, IDotNetProject project) { this.solutionManager = solutionManager; this.projectContext = projectContext; this.recentPackagesRepository = recentPackagesRepository; IsManagingSolution = project == null; PackageViewModels = new ObservableCollection <ManagePackagesSearchResultViewModel> (); CheckedPackageViewModels = new ObservableCollection <ManagePackagesSearchResultViewModel> (); ProjectViewModels = new ObservableCollection <ManageProjectViewModel> (); ErrorMessage = String.Empty; PageSelected = ManagePackagesPage.Browse; if (project != null) { dotNetProjects = new List <IDotNetProject> (); dotNetProjects.Add(project); } else { dotNetProjects = solution.GetAllProjects().ToList(); } packageManager = new NuGetPackageManager( solutionManager.CreateSourceRepositoryProvider(), solutionManager.Settings, solutionManager, new DeleteOnRestartManager() ); nugetProjects = dotNetProjects .Select(dotNetProject => solutionManager.GetNuGetProject(dotNetProject)) .ToList(); GetPackagesInstalledInProjects().Ignore(); }
private static IEnumerable <IProject> GetSearcheableProjects([CanBeNull] IProject project) { if (project == null) { return(EmptyList <IProject> .InstanceList); } ISolution solution = project.GetSolution(); IPsiModules psiModules = solution.PsiModules(); return(( from prj in solution.GetAllProjects().Where(new Func <IProject, bool>(psiModules.IsSourceProject)) where ( from _ in ( from _ in psiModules.GetPsiModules(prj).SelectMany((IPsiModule _) => psiModules.GetModuleReferences(_, project.GetResolveContext())) select _.Module).OfType <IProjectPsiModule>() select _.Project).Contains(project) select prj).Prepend(new IProject[] { project }).Distinct <IProject>()); }
public AwsProjectHost(ISolution solution) { var model = solution.GetProtocolSolution().GetAwsProjectModel(); model.GetProjectOutput.Set((lifetime, request) => { var task = new RdTask <AwsProjectOutput>(); var assemblyPathPrefix = FileSystemPath.Parse(request.ProjectPath); using (ReadLockCookie.Create()) { var allProjects = solution.GetAllProjects(); foreach (var project in allProjects) { var targetFrameworks = project.GetAllTargetFrameworks(); foreach (var targetFramework in targetFrameworks) { var assembly = project.GetOutputAssemblyInfo(targetFramework.FrameworkId); if (assembly == null) { continue; } if (assembly.Location.FullPath.StartsWith(assemblyPathPrefix.FullPath)) { task.Set(new AwsProjectOutput(assembly.AssemblyNameInfo.Name, assembly.Location.FullPath)); return(task); } } } task.SetCancelled(); return(task); } }); }
public UnrealPluginDetector(Lifetime lifetime, ILogger logger, CppUE4SolutionDetector solutionDetector, ISolution solution, IShellLocks locks, ISolutionLoadTasksScheduler scheduler) { myLifetime = lifetime; InstallInfoProperty = new Property <UnrealPluginInstallInfo>(myLifetime, "UnrealPlugin.InstallInfoNotification", null, true); myLogger = logger; mySolution = solution; mySolutionDetector = solutionDetector; mySolutionDetector.IsUE4Solution_Observable.Change.Advise_When(myLifetime, newValue => newValue == TriBool.True, _ => { scheduler.EnqueueTask(new SolutionLoadTask("Find installed RiderLink plugins", SolutionLoadTaskKinds.Done, () => { myLogger.Info("[UnrealLink]: Looking for RiderLink plugins"); myUnrealVersion = mySolutionDetector.Version; if (myUnrealVersion < myMinimalSupportedVersion) { locks.ExecuteOrQueue(myLifetime, "UnrealLink.CheckSupportedVersion", () => { var notification = new NotificationModel( $"Unreal Engine {myMinimalSupportedVersion}+ is required", $"<html>UnrealLink supports Unreal Engine versions starting with {myMinimalSupportedVersion}<br>" + "<b>WARNING: Advanced users only</b><br>" + "You can manually download the latest version of plugin and build It for your version of Unreal Editor<br>" + RiderContextNotificationHelper.MakeLink( "https://github.com/JetBrains/UnrealLink/releases/latest", "Download latest Unreal Editor plugin") + "</html>", true, RdNotificationEntryType.WARN, new List <NotificationHyperlink>()); var notificationsModel = Shell.Instance.GetComponent <NotificationsModel>(); notificationsModel.Notification(notification); }); return; } var installInfo = new UnrealPluginInstallInfo(); var foundEnginePlugin = TryGetEnginePluginFromSolution(solutionDetector, installInfo); ISet <FileSystemPath> uprojectLocations; using (solution.Locks.UsingReadLock()) { var allProjects = mySolution.GetAllProjects(); if (solutionDetector.SupportRiderProjectModel == CppUE4ProjectModelSupportMode.UprojectOpened) { uprojectLocations = allProjects.Where(project => { if (project.IsMiscProjectItem() || project.IsMiscFilesProject()) { return(false); } var location = project.Location; if (location == null) { return(false); } if (EXCLUDED_PROJECTS.Contains(location.NameWithoutExtension)) { return(false); } // TODO: drop this ugly check after updating to net211 where Location == "path/to/game.uproject" var isUproject = location.ExistsFile && location.ExtensionNoDot == UPROJECT_FILE_FORMAT && location.NameWithoutExtension == project.Name; return(isUproject || (location / $"{location.Name}.uproject").ExistsFile); }).Select(project => { var location = project.Location; if (location.ExistsFile) { return(location); } return(location / $"{location.Name}.uproject"); }).ToSet(); } else { uprojectLocations = allProjects.SelectMany(project => project.GetAllProjectFiles(projectFile => { var location = projectFile.Location; if (location == null || !location.ExistsFile) { return(false); } return(location.ExtensionNoDot == UPROJECT_FILE_FORMAT && location.NameWithoutExtension == project.Name); })).Select(file => file.Location).ToSet(); } } myLogger.Info($"[UnrealLink]: Found {uprojectLocations.Count} uprojects"); if (!foundEnginePlugin && !uprojectLocations.IsEmpty()) { // All projects in the solution are bound to the same engine // So take first project and use it to find Unreal Engine TryGetEnginePluginFromUproject(uprojectLocations.FirstNotNull(), installInfo); foundEnginePlugin = installInfo.EnginePlugin.IsPluginAvailable; } // Gather data about Project plugins foreach (var uprojectLocation in uprojectLocations) { myLogger.Info($"[UnrealLink]: Looking for plugin in {uprojectLocation}"); var projectPlugin = GetProjectPluginForUproject(uprojectLocation); if (projectPlugin.IsPluginAvailable) { myLogger.Info( $"[UnrealLink]: found plugin {projectPlugin.UnrealPluginRootFolder}"); } installInfo.ProjectPlugins.Add(projectPlugin); } if (foundEnginePlugin) { installInfo.Location = PluginInstallLocation.Engine; } else if (installInfo.ProjectPlugins.Any(description => description.IsPluginAvailable)) { installInfo.Location = PluginInstallLocation.Game; } else { installInfo.Location = PluginInstallLocation.NotInstalled; } InstallInfoProperty.SetValue(installInfo); })); }); }
private List<FileSystemPath> CollectAllFilesToAnalyze(ISolution solution) { List<FileSystemPath> files_to_analyze = new List<FileSystemPath>(); SimianProjectVisitor visitor = new SimianProjectVisitor(files_to_analyze); visitor.AddExcludeSpecs(SimianOptions.Instance.SpecsToExclude); visitor.AddIncludeSpecs(SimianOptions.Instance.SpecsToInclude); foreach (IProject project in solution.GetAllProjects()) { project.Accept(visitor); } return files_to_analyze; }
private void CheckAllProjectsIfAutoInstallEnabled(PropertyChangedEventArgs <bool> args) { if (!args.GetNewOrNull()) { return; } myShellLocks.ExecuteOrQueueReadLockEx(myLifetime, "UnityPluginInstaller.CheckAllProjectsIfAutoInstallEnabled", () => InstallPluginIfRequired(mySolution.GetAllProjects().Where(p => p.IsUnityProject()).ToList())); }
public static IEnumerable <IProjectFile> GetAllProjectFilesWithPathPrefix(this ISolution solution, string prefix) { return(GetAllProjectFilesWithPathPrefix(solution.GetAllProjects(), prefix)); }
private SolutionModel ParseSolution(ISolution solution) { var projects = solution.GetAllProjects(); var resultSolution = new SolutionModel { FilePath = solution.SolutionFile?.Location.FullPath, Id = Guid.NewGuid(), Name = solution.Name, Projects = new List <ProjectModel>(projects.Count) }; foreach (var project in projects) { var targetFrameworkId = project.GetCurrentTargetFrameworkId(); var moduleReferences = project.GetModuleReferences(targetFrameworkId).ToArray(); var projectFiles = project.GetAllProjectFiles().ToArray(); var resultProject = new ProjectModel { FilePath = project.ProjectFileLocation.FullPath, Id = project.Guid, Name = project.Name, AssemblyName = project.GetOutputAssemblyName(targetFrameworkId), Documents = new List <DocumentModel>(projectFiles.Length), ProjectAssemblyReferences = new List <ProjectAssemblyReference>(), ProjectToProjectReferences = new List <ProjectProjectReference>(), AnalyzerReferences = new List <ProjectAssemblyReference>() }; resultSolution.Projects.Add(resultProject); foreach (var packageReference in moduleReferences) { var projectToAssemblyReference = packageReference as IProjectToAssemblyReference; if (projectToAssemblyReference != null) { resultProject.ProjectAssemblyReferences.Add(new ProjectAssemblyReference { Name = projectToAssemblyReference.Name, LibraryPath = projectToAssemblyReference.ReferenceTarget.AssemblyFileName }); } else { var projectToProjectReference = packageReference as GuidProjectReference; if (projectToProjectReference != null) { resultProject.ProjectToProjectReferences.Add(new ProjectProjectReference { Name = projectToProjectReference.Name, Id = projectToProjectReference.ReferencedProjectGuid }); } } } foreach (var projectFile in projectFiles) { resultProject.Documents.Add(new DocumentModel { Name = projectFile.Name, Path = projectFile.Location.FullPath }); } } return(resultSolution); }
/// <summary> /// Returns all 'real' user projects within solution /// </summary> public static IEnumerable <IProject> GetAllCodeProjects(this ISolution solution) { return(solution.GetAllProjects().Where(p => p.IsProjectFromUserView())); }