コード例 #1
0
        public static ProjectJsonFile Read(DnxProject project)
        {
            var jsonFile = new ProjectJsonFile(project.BaseDirectory.Combine("project.json"));

            jsonFile.Read();
            return(jsonFile);
        }
        void UpdateReferences(DnxProject project, FrameworkProject frameworkProject)
        {
            if (!project.IsCurrentFramework (frameworkProject.Framework, frameworkProject.Project.ProjectsByFramework.Keys))
                return;

            project.UpdateReferences (frameworkProject.FileReferences.Keys);
        }
コード例 #3
0
        void CreateFilesFromTemplate(DnxProject project)
        {
            string projectTemplateName = Parameters["Template"];

            string[] files = Parameters["Files"].Split('|');
            FileTemplateProcessor.CreateFilesFromTemplate(project, projectTemplateName, files);
        }
コード例 #4
0
        public static GlobalJsonFile Read(DnxProject project)
        {
            var jsonFile = new GlobalJsonFile(project.ParentSolution.BaseDirectory.Combine("global.json"));

            jsonFile.Read();
            return(jsonFile);
        }
コード例 #5
0
        public BuildResult GetBuildResult(DnxProject project)
        {
            var result = new BuildResult();

            result.Append(errorWriter.GetBuildResults(project));
            result.SourceTarget = project.Project;
            return(result);
        }
コード例 #6
0
        protected override MSBuildProject SaveProject(IProgressMonitor monitor)
        {
            dnxProject = EntityItem as DnxProject;
            if (dnxProject == null || !dnxProject.IsDirty)
                return new MSBuildProject ();

            return CreateMSBuildProject ();
        }
コード例 #7
0
        void OnPackageRestoreFinished(string projectJsonFileName)
        {
            DnxProject matchedProject = FindProjectByProjectJsonFileName(projectJsonFileName);

            if (matchedProject != null)
            {
                matchedProject.OnPackageRestoreFinished();
            }
        }
        public void UpdateReferences(ProjectId projectId, FrameworkProject frameworkProject)
        {
            DnxProject project = FindProject(projectId);

            if (project != null)
            {
                UpdateReferences(project, frameworkProject);
            }
        }
コード例 #9
0
        DnxProject CreateProject(Solution solution, string projectName)
        {
            var project = new DnxProject();

            project.IsDirty = true;
            project.GenerateNewProjectFileName(solution, projectName);

            return(project);
        }
コード例 #10
0
        void UpdateDependencies(OmniSharp.Dnx.Project project, DependenciesMessage message)
        {
            DnxProject matchedProject = FindProjectByProjectJsonFileName(project.Path);

            if (matchedProject != null)
            {
                matchedProject.UpdateDependencies(message);
            }
        }
コード例 #11
0
        public static void CreateFilesFromTemplate(DnxProject project, string projectTemplateName, params string[] files)
        {
            CreateFileFromTemplate(project, projectTemplateName, "project.json");

            foreach (string templateFileName in files)
            {
                CreateFileFromTemplate(project, projectTemplateName, templateFileName);
            }
        }
        void UpdateReferences(DnxProject project, FrameworkProject frameworkProject)
        {
            if (!project.IsCurrentFramework(frameworkProject.Framework, frameworkProject.Project.ProjectsByFramework.Keys))
            {
                return;
            }

            project.UpdateReferences(frameworkProject.FileReferences.Keys);
        }
コード例 #13
0
        public static BuildResult ToBuildResult(this DiagnosticsListMessage message, DnxProject project)
        {
            var result = new BuildResult();

            AddErrors(result.AddWarning, message.Warnings, project);
            AddErrors(result.AddError, message.Errors, project);
            result.SourceTarget = project.Project;
            return(result);
        }
コード例 #14
0
        public static void OpenProjectFile(this Workbench workbench, DnxProject project, string file)
        {
            if (string.IsNullOrEmpty (file))
                return;

            string fullPath = project.GetAbsoluteChildPath (file);
            workbench.OpenDocument (fullPath, project, false);
            workbench.SelectFile (project, fullPath);
        }
コード例 #15
0
        void UpdateProject(OmniSharp.Models.DnxProject project)
        {
            DnxProject matchedProject = FindProjectByProjectJsonFileName(project.Path);

            if (matchedProject != null)
            {
                matchedProject.Update(project);
            }
        }
コード例 #16
0
 public static void EnsureConfigurationHasBuildEnabled(this Solution solution, DnxProject project)
 {
     foreach (SolutionConfiguration solutionConfiguration in solution.Configurations) {
         foreach (SolutionConfigurationEntry projectConfiguration in solutionConfiguration.Configurations) {
             if (projectConfiguration.Item == project && !projectConfiguration.Build) {
                 projectConfiguration.Build = true;
             }
         }
     }
 }
コード例 #17
0
        protected override MSBuildProject SaveProject(IProgressMonitor monitor)
        {
            dnxProject = EntityItem as DnxProject;
            if (dnxProject == null || !dnxProject.IsDirty)
            {
                return(new MSBuildProject());
            }

            return(CreateMSBuildProject());
        }
コード例 #18
0
 public static void GenerateDefaultDnxProjectConfigurations(this Solution solution, DnxProject project)
 {
     foreach (SolutionItemConfiguration configuration in project.Configurations) {
         SolutionConfiguration existingConfiguration = solution.GetConfiguration (configuration);
         if (existingConfiguration == null) {
             SolutionConfiguration newConfiguration = solution.AddConfiguration (configuration.Name, false);
             newConfiguration.AddItem (project);
         }
     }
 }
コード例 #19
0
        void OnPackageRestoreFinished(string projectJsonFileName, bool success)
        {
            DnxProject matchedProject = FindProjectByProjectJsonFileName(projectJsonFileName);

            if (matchedProject != null)
            {
                restoreProgressMonitor.OnRestoreFinished(success);
                matchedProject.OnPackageRestoreFinished();
            }
        }
コード例 #20
0
        void OnPackageRestoreStarted(string projectJsonFileName)
        {
            DnxProject matchedProject = FindProjectByProjectJsonFileName(projectJsonFileName);

            if (matchedProject != null)
            {
                restoreProgressMonitor.OnRestoreStarted();
                matchedProject.OnPackageRestoreStarted();
            }
        }
コード例 #21
0
        DnxProject CreateProject(Solution solution, string projectName)
        {
            Project    xproject = IdeApp.Services.ProjectService.CreateProject(DnxProject.ProjectTypeGuid, "Dnx");
            DnxProject project  = xproject.AsFlavor <DnxProject> ();

            project.IsDirty = true;
            project.GenerateNewProjectFileName(solution, projectName);

            return(project);
        }
コード例 #22
0
 public void OnCompilationOptionsChanged(ProjectId projectId, CSharpCompilationOptions compilationOptions, CSharpParseOptions parseOptions)
 {
     Runtime.RunInMainThread(() => {
         var locator        = new DnxProjectLocator(context);
         DnxProject project = locator.FindProject(projectId);
         if (project != null)
         {
             project.UpdateCompilationOptions(locator.FrameworkProject, compilationOptions, parseOptions);
         }
     });
 }
コード例 #23
0
 public void OnReferencesUpdated(ProjectId projectId, FrameworkProject frameworkProject)
 {
     DispatchService.GuiDispatch(() => {
         var locator        = new DnxProjectLocator(context);
         DnxProject project = locator.FindProject(projectId);
         if (project != null)
         {
             project.UpdateReferences(frameworkProject);
         }
     });
 }
コード例 #24
0
 public void OnReferencesUpdated(ProjectId projectId, FrameworkProject frameworkProject)
 {
     Runtime.RunInMainThread(() => {
         var locator        = new DnxProjectLocator(context);
         DnxProject project = locator.FindProject(projectId);
         if (project != null)
         {
             project.UpdateReferences(frameworkProject);
         }
     });
 }
コード例 #25
0
        public static void SelectFile(this Workbench workbench, DnxProject project, string file)
        {
            var pad = workbench.Pads.SolutionPad;
            if (pad == null)
                return;

            var solutionPad = pad.Content as SolutionPad;
            if (solutionPad != null) {
                SelectFile (solutionPad.TreeView, project, file);
            }
        }
コード例 #26
0
 public void OnParseOptionsChanged(ProjectId projectId, ParseOptions options)
 {
     DispatchService.GuiDispatch(() => {
         var locator        = new DnxProjectLocator(context);
         DnxProject project = locator.FindProject(projectId);
         if (project != null)
         {
             project.UpdateParseOptions(locator.FrameworkProject, options);
         }
     });
 }
コード例 #27
0
        static void SelectFile(ExtensibleTreeView treeView, DnxProject project, string file)
        {
            var projectFile = project.Files.GetFile (file);
            if (projectFile == null)
                return;

            ITreeNavigator navigator = treeView.GetNodeAtObject (projectFile, true);
            if (navigator != null) {
                navigator.ExpandToNode ();
                navigator.Selected = true;
            }
        }
コード例 #28
0
        public void SaveProject(ProgressMonitor monitor, MSBuildProject project)
        {
            dnxProject = EntityItem as DnxProject;
            if (dnxProject == null || !dnxProject.IsDirty)
            {
                return;
            }

            msbuildProject = project;

            CreateMSBuildProject();
        }
コード例 #29
0
        public static void OpenProjectFile(this Workbench workbench, DnxProject project, string file)
        {
            if (string.IsNullOrEmpty(file))
            {
                return;
            }

            string fullPath = project.GetAbsoluteChildPath(file);

            workbench.OpenDocument(fullPath, project, false);
            workbench.SelectFile(project, fullPath);
        }
コード例 #30
0
        public BuildResult GetBuildResults(DnxProject project)
        {
            var result = new BuildResult();

            result.SourceTarget = project.Project;

            foreach (var error in parser.GetBuildErrors(project))
            {
                result.Append(error);
            }

            return(result);
        }
コード例 #31
0
        void AddProjectReference(string fileName)
        {
            DnxProject project = ParentSolution.FindProjectByProjectJsonFileName(fileName);

            if (project != null)
            {
                var projectItem = new ProjectReference(ReferenceType.Project, project.Name);
                References.Add(projectItem);
            }
            else
            {
                LoggingService.LogDebug("Unable to find project by json filename '{0}'.", fileName);
            }
        }
コード例 #32
0
        public DnxProject FindProjectForCurrentFramework(ProjectId projectId)
        {
            if (!Init(projectId))
            {
                return(null);
            }

            DnxProject project = solution.FindProjectByProjectJsonFileName(frameworkProject.Project.Path);

            if (project.IsCurrentFramework(frameworkProject.Framework, frameworkProject.Project.ProjectsByFramework.Keys))
            {
                return(project);
            }
            return(null);
        }
コード例 #33
0
 public void ReportDiagnostics(OmniSharp.Dnx.Project project, DiagnosticsListMessage message)
 {
     Runtime.RunInMainThread(() => {
         DnxProject matchedProject = FindProjectByProjectJsonFileName(project.Path);
         if (matchedProject != null)
         {
             if (message.Framework != null && message.Framework.FrameworkName == matchedProject.CurrentFramework)
             {
                 TaskService.Errors.ClearByOwner(matchedProject.Project);
                 var result = message.ToBuildResult(matchedProject);
                 TaskService.Errors.AddRange(result.Errors.Select(error => new TaskListEntry(error, matchedProject.Project)));
             }
         }
     });
 }
コード例 #34
0
        public static void SelectFile(this Workbench workbench, DnxProject project, string file)
        {
            var pad = workbench.Pads.SolutionPad;

            if (pad == null)
            {
                return;
            }

            var solutionPad = pad.Content as SolutionPad;

            if (solutionPad != null)
            {
                SelectFile(solutionPad.TreeView, project, file);
            }
        }
コード例 #35
0
        public void OnUnresolvedDependencies(string projectJsonFileName)
        {
            if (!RestoreDependencies)
            {
                return;
            }

            Runtime.RunInMainThread(() => {
                DnxProject matchedProject = FindProjectByProjectJsonFileName(projectJsonFileName);
                if (matchedProject != null && matchedProject.RestoredUnresolvedDependenciesAfterLoading)
                {
                    matchedProject.RestoredUnresolvedDependenciesAfterLoading = false;
                    Restore(projectJsonFileName);
                }
            });
        }
コード例 #36
0
        static void SelectFile(ExtensibleTreeView treeView, DnxProject project, string file)
        {
            var projectFile = project.Files.GetFile(file);

            if (projectFile == null)
            {
                return;
            }

            ITreeNavigator navigator = treeView.GetNodeAtObject(projectFile, true);

            if (navigator != null)
            {
                navigator.ExpandToNode();
                navigator.Selected = true;
            }
        }
コード例 #37
0
 public IEnumerable <BuildError> GetBuildErrors(DnxProject project)
 {
     foreach (var result in results)
     {
         yield return(new BuildError {
             FileName = result.Origin ?? String.Empty,
             Line = result.Line,
             Column = result.Column,
             EndLine = result.EndLine,
             EndColumn = result.EndColumn,
             ErrorNumber = result.Code,
             ErrorText = result.Message,
             SourceTarget = project.Project,
             Subcategory = result.Subcategory,
             IsWarning = !result.IsError
         });
     }
 }
コード例 #38
0
 public static GlobalJsonFile Read(DnxProject project)
 {
     var jsonFile = new GlobalJsonFile (project.ParentSolution.BaseDirectory.Combine ("global.json"));
     jsonFile.Read ();
     return jsonFile;
 }
コード例 #39
0
        public static void CreateFilesFromTemplate(DnxProject project, string projectTemplateName, params string[] files)
        {
            CreateFileFromTemplate (project, projectTemplateName, "project.json");

            foreach (string templateFileName in files) {
                CreateFileFromTemplate (project, projectTemplateName, templateFileName);
            }
        }
コード例 #40
0
        void CreateFilesFromTemplate(DnxProject project)
        {
            string projectTemplateName = Parameters["Template"];

            string[] files = Parameters["Files"].Split ('|');
            FileTemplateProcessor.CreateFilesFromTemplate (project, projectTemplateName, files);
        }
コード例 #41
0
 public DnxProjectBuilder(DnxProject project, IProgressMonitor monitor)
 {
     this.project = project;
     this.monitor = monitor;
     this.monitor.CancelRequested += CancelRequested;
 }
コード例 #42
0
        DnxProject CreateProject(Solution solution, string projectName)
        {
            var project = new DnxProject ();
            project.IsDirty = true;
            project.GenerateNewProjectFileName (solution, projectName);

            return project;
        }
コード例 #43
0
 public static void InstallHandler(DnxProject project)
 {
     var itemType = new DnxMSBuildProjectItemType ();
     itemType.InitializeHandler (project);
 }
コード例 #44
0
 public static ProjectJsonFile Read(DnxProject project)
 {
     var jsonFile = new ProjectJsonFile (project.BaseDirectory.Combine ("project.json"));
     jsonFile.Read ();
     return jsonFile;
 }
コード例 #45
0
 void OpenProjectFile(DnxProject project)
 {
     IdeApp.Workbench.OpenProjectFile (project, Parameters["OpenFile"]);
 }
コード例 #46
0
 void RemoveProjectFromSolution(DnxProject project)
 {
     project.ParentFolder.Items.Remove (project);
     project.Dispose ();
 }