Esempio n. 1
0
            public TypeDataProvider(MonoDevelop.Projects.DotNetProject project)
            {
                var dom = MonoDevelop.Projects.Dom.Parser.ProjectDomService.GetProjectDom(project);

                List          = new List <MonoDevelop.Projects.Dom.IType> (dom.Types);
                this.ambience = AmbienceService.GetAmbienceForLanguage(project.LanguageName);
            }
Esempio n. 2
0
            public TypeDataProvider(MonoDevelop.Projects.DotNetProject project)
            {
                var ctx = TypeSystemService.GetCompilation(project);

                List          = new List <ITypeDefinition> (ctx.MainAssembly.GetAllTypeDefinitions());
                this.ambience = AmbienceService.GetAmbience(project.LanguageName);
            }
 void LogProjectPropertiesMergeResult(DotNetProject project, MSBuildProjectPropertiesMergeResult result)
 {
     logger.Log(
         MessageLevel.Info,
         "Project properties merge result for project '{0}':\r\n{1}",
         project.Name,
         result);
 }
 void LogProjectImportsChanged(DotNetProject project)
 {
     logger.Log(
         MessageLevel.Info,
         "Project imports have been modified outside {0} for project '{1}'.",
         BrandingService.ApplicationName,
         project.Name);
 }
		public MSBuildProjectPropertiesMerger (
			Project msbuildProject,
			DotNetProject dotNetProject,
			IPackageManagementProjectService projectService)
		{
			this.msbuildProject = msbuildProject;
			this.dotNetProject = dotNetProject;
			this.projectService = projectService;
		}
 public MSBuildProjectPropertiesMerger(
     Project msbuildProject,
     DotNetProject dotNetProject,
     IPackageManagementProjectService projectService)
 {
     this.msbuildProject = msbuildProject;
     this.dotNetProject  = dotNetProject;
     this.projectService = projectService;
 }
		public static string GetProjectType(DotNetProject project)
		{
			if (project.LanguageName == "VBNet")
				return VB;
			else if (project.LanguageName == "CSharp")
				return CSharp;
			else
				return project.LanguageName;
		}
		void AddProject (DotNetProject dotNetProject)
		{
			Project globalProject = GetGlobalProjectCollection ().LoadProject (dotNetProject.FileName);

			projects.Add (new GlobalAndInternalProject {
				GlobalMSBuildProject = globalProject,
				DotNetProject = dotNetProject,
				GlobalMSBuildProjectImportsCount = globalProject.Xml.Imports.Count
			});
		}
        void AddProject(DotNetProject dotNetProject)
        {
            Project globalProject = GetGlobalProjectCollection().LoadProject(dotNetProject.FileName);

            projects.Add(new GlobalAndInternalProject {
                GlobalMSBuildProject             = globalProject,
                DotNetProject                    = dotNetProject,
                GlobalMSBuildProjectImportsCount = globalProject.Xml.Imports.Count
            });
        }
Esempio n. 10
0
            public TypeDataProvider(MonoDevelop.Projects.DotNetProject project)
            {
                TypeNamesList = new List <string> ();
                var ctx = TypeSystemService.GetCompilation(project);

                TypesList     = new List <ITypeDefinition> (ctx.MainAssembly.GetAllTypeDefinitions());
                this.ambience = AmbienceService.GetAmbience(project.LanguageName);
                foreach (var typeDef in TypesList)
                {
                    TypeNamesList.Add(ambience.GetString((IEntity)typeDef, OutputFlags.IncludeGenerics | OutputFlags.UseFullName | OutputFlags.IncludeMarkup));
                }
            }
Esempio n. 11
0
        Task <ProjectInfo> LoadProject(MonoDevelop.Projects.DotNetProject p, CancellationToken token)
        {
            if (!projectIdMap.ContainsKey(p))
            {
                p.FileAddedToProject     += OnFileAdded;
                p.FileRemovedFromProject += OnFileRemoved;
                p.FileRenamedInProject   += OnFileRenamed;
                p.Modified += OnProjectModified;
            }

            var projectId   = GetOrCreateProjectId(p);
            var projectData = GetOrCreateProjectData(projectId);

            return(Task.Run(async() => {
                var references = await CreateMetadataReferences(p, projectId, token).ConfigureAwait(false);
                if (token.IsCancellationRequested)
                {
                    return null;
                }
                var config = IdeApp.Workspace != null ? p.GetConfiguration(IdeApp.Workspace.ActiveConfiguration) as MonoDevelop.Projects.DotNetProjectConfiguration : null;
                MonoDevelop.Projects.DotNetCompilerParameters cp = null;
                if (config != null)
                {
                    cp = config.CompilationParameters;
                }
                FilePath fileName = IdeApp.Workspace != null ? p.GetOutputFileName(IdeApp.Workspace.ActiveConfiguration) : (FilePath)"";
                if (fileName.IsNullOrEmpty)
                {
                    fileName = new FilePath(p.Name + ".dll");
                }

                var sourceFiles = await p.GetSourceFilesAsync(config != null ? config.Selector : null).ConfigureAwait(false);

                var info = ProjectInfo.Create(
                    projectId,
                    VersionStamp.Create(),
                    p.Name,
                    fileName.FileNameWithoutExtension,
                    LanguageNames.CSharp,
                    p.FileName,
                    fileName,
                    cp != null ? cp.CreateCompilationOptions() : null,
                    cp != null ? cp.CreateParseOptions() : null,
                    CreateDocuments(projectData, p, token, sourceFiles),
                    CreateProjectReferences(p, token),
                    references
                    );
                projectData.Info = info;
                return info;
            }, token));
        }
Esempio n. 12
0
 public static string GetProjectType(DotNetProject project)
 {
     if (project.LanguageName == "VBNet")
     {
         return(VB);
     }
     else if (project.LanguageName == "CSharp")
     {
         return(CSharp);
     }
     else
     {
         return(project.LanguageName);
     }
 }
Esempio n. 13
0
 IEnumerable <ProjectReference> CreateProjectReferences(MonoDevelop.Projects.DotNetProject p, CancellationToken token)
 {
     foreach (var referencedProject in p.GetReferencedAssemblyProjects(IdeApp.Workspace?.ActiveConfiguration ?? MonoDevelop.Projects.ConfigurationSelector.Default))
     {
         if (token.IsCancellationRequested)
         {
             yield break;
         }
         if (TypeSystemService.IsOutputTrackedProject(referencedProject))
         {
             continue;
         }
         yield return(new ProjectReference(GetOrCreateProjectId(referencedProject)));
     }
 }
		void LogProjectPropertiesMergeResult (DotNetProject project, MSBuildProjectPropertiesMergeResult result)
		{
			logger.Log (
				MessageLevel.Info,
				"Project properties merge result for project '{0}':\r\n{1}",
				project.Name,
				result);
		}
		public MSBuildProjectPropertiesMerger (Project msbuildProject, DotNetProject dotNetProject)
			: this (msbuildProject, dotNetProject, new PackageManagementProjectService ())
		{
		}
            IEnumerable <ProjectReference> CreateProjectReferencesFromAssemblyReferences(MonoDevelop.Projects.DotNetProject p, List <MonoDevelop.Projects.AssemblyReference> references)
            {
                var addedProjects = new HashSet <MonoDevelop.Projects.DotNetProject> ();

                foreach (var pr in references)
                {
                    if (!pr.IsProjectReference || !pr.ReferenceOutputAssembly)
                    {
                        continue;
                    }

                    var referencedItem = pr.GetReferencedItem(p.ParentSolution);
                    if (!(referencedItem is MonoDevelop.Projects.DotNetProject referencedProject))
                    {
                        continue;
                    }

                    if (!addedProjects.Add(referencedProject))
                    {
                        continue;
                    }

                    if (IdeApp.TypeSystemService.IsOutputTrackedProject(referencedProject))
                    {
                        continue;
                    }

                    var aliases = pr.EnumerateAliases();
                    yield return(new ProjectReference(projectMap.GetOrCreateId(referencedProject, null), aliases.ToImmutableArray()));
                }
            }
 public MSBuildProjectPropertiesMerger(Project msbuildProject, DotNetProject dotNetProject)
     : this(msbuildProject, dotNetProject, new PackageManagementProjectService())
 {
 }
Esempio n. 18
0
        static async Task <List <MetadataReference> > CreateMetadataReferences(MonoDevelop.Projects.DotNetProject netProject, ProjectId projectId, CancellationToken token)
        {
            List <MetadataReference> result = new List <MetadataReference> ();

            var configurationSelector = IdeApp.Workspace?.ActiveConfiguration ?? MonoDevelop.Projects.ConfigurationSelector.Default;
            var hashSet = new HashSet <string> (FilePath.PathComparer);

            try {
                foreach (string file in await netProject.GetReferencedAssemblies(configurationSelector, false).ConfigureAwait(false))
                {
                    if (token.IsCancellationRequested)
                    {
                        return(result);
                    }
                    string fileName;
                    if (!Path.IsPathRooted(file))
                    {
                        fileName = Path.Combine(Path.GetDirectoryName(netProject.FileName), file);
                    }
                    else
                    {
                        fileName = Path.GetFullPath(file);
                    }
                    if (hashSet.Contains(fileName))
                    {
                        continue;
                    }
                    hashSet.Add(fileName);
                    if (!File.Exists(fileName))
                    {
                        LoggingService.LogError("Error while getting referenced Assembly " + fileName + " for project " + netProject.Name + ": File doesn't exist");
                        continue;
                    }
                    var metadataReference = MetadataReferenceCache.LoadReference(projectId, fileName);
                    if (metadataReference == null)
                    {
                        continue;
                    }
                    result.Add(metadataReference);
                }
            } catch (Exception e) {
                LoggingService.LogError("Error while getting referenced assemblies", e);
            }

            foreach (var pr in netProject.GetReferencedItems(configurationSelector))
            {
                if (token.IsCancellationRequested)
                {
                    return(result);
                }
                var referencedProject = pr as MonoDevelop.Projects.DotNetProject;
                if (referencedProject == null)
                {
                    continue;
                }
                if (TypeSystemService.IsOutputTrackedProject(referencedProject))
                {
                    var fileName = referencedProject.GetOutputFileName(configurationSelector);
                    if (!File.Exists(fileName))
                    {
                        LoggingService.LogError("Error while getting project Reference (" + referencedProject.Name + ") " + fileName + " for project " + netProject.Name + ": File doesn't exist");
                        continue;
                    }
                    var metadataReference = MetadataReferenceCache.LoadReference(projectId, fileName);
                    if (metadataReference != null)
                    {
                        result.Add(metadataReference);
                    }
                }
            }
            return(result);
        }
		void LogProjectImportsChanged (DotNetProject project)
		{
			logger.Log (
				MessageLevel.Info,
				"Project imports have been modified outside {0} for project '{1}'.",
				BrandingService.ApplicationName,
				project.Name);
		}