Пример #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);
        }
        public static GlobalJsonFile Read(DnxProject project)
        {
            var jsonFile = new GlobalJsonFile(project.ParentSolution.BaseDirectory.Combine("global.json"));

            jsonFile.Read();
            return(jsonFile);
        }
        public BuildResult GetBuildResult(DnxProject project)
        {
            var result = new BuildResult();

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

            return CreateMSBuildProject ();
        }
        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);
        }
        void UpdateDependencies(OmniSharp.Dnx.Project project, DependenciesMessage message)
        {
            DnxProject matchedProject = FindProjectByProjectJsonFileName(project.Path);

            if (matchedProject != null)
            {
                matchedProject.UpdateDependencies(message);
            }
        }
        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);
        }
        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);
        }
        void UpdateProject(OmniSharp.Models.DnxProject project)
        {
            DnxProject matchedProject = FindProjectByProjectJsonFileName(project.Path);

            if (matchedProject != null)
            {
                matchedProject.Update(project);
            }
        }
 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());
        }
 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);
         }
     }
 }
        void OnPackageRestoreFinished(string projectJsonFileName, bool success)
        {
            DnxProject matchedProject = FindProjectByProjectJsonFileName(projectJsonFileName);

            if (matchedProject != null)
            {
                restoreProgressMonitor.OnRestoreFinished(success);
                matchedProject.OnPackageRestoreFinished();
            }
        }
        void OnPackageRestoreStarted(string projectJsonFileName)
        {
            DnxProject matchedProject = FindProjectByProjectJsonFileName(projectJsonFileName);

            if (matchedProject != null)
            {
                restoreProgressMonitor.OnRestoreStarted();
                matchedProject.OnPackageRestoreStarted();
            }
        }
        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);
        }
 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);
         }
     });
 }
 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);
         }
     });
 }
 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);
         }
     });
 }
        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);
            }
        }
 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);
         }
     });
 }
        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;
            }
        }
        public void SaveProject(ProgressMonitor monitor, MSBuildProject project)
        {
            dnxProject = EntityItem as DnxProject;
            if (dnxProject == null || !dnxProject.IsDirty)
            {
                return;
            }

            msbuildProject = project;

            CreateMSBuildProject();
        }
        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);
        }
 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)));
             }
         }
     });
 }
        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);
            }
        }
        public void OnUnresolvedDependencies(string projectJsonFileName)
        {
            if (!RestoreDependencies)
            {
                return;
            }

            Runtime.RunInMainThread(() => {
                DnxProject matchedProject = FindProjectByProjectJsonFileName(projectJsonFileName);
                if (matchedProject != null && matchedProject.RestoredUnresolvedDependenciesAfterLoading)
                {
                    matchedProject.RestoredUnresolvedDependenciesAfterLoading = false;
                    Restore(projectJsonFileName);
                }
            });
        }
        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
         });
     }
 }
 public static GlobalJsonFile Read(DnxProject project)
 {
     var jsonFile = new GlobalJsonFile (project.ParentSolution.BaseDirectory.Combine ("global.json"));
     jsonFile.Read ();
     return jsonFile;
 }
        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 CreateFilesFromTemplate(DnxProject project)
        {
            string projectTemplateName = Parameters["Template"];

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

            return project;
        }
 public static void InstallHandler(DnxProject project)
 {
     var itemType = new DnxMSBuildProjectItemType ();
     itemType.InitializeHandler (project);
 }
 public static ProjectJsonFile Read(DnxProject project)
 {
     var jsonFile = new ProjectJsonFile (project.BaseDirectory.Combine ("project.json"));
     jsonFile.Read ();
     return jsonFile;
 }
 void OpenProjectFile(DnxProject project)
 {
     IdeApp.Workbench.OpenProjectFile (project, Parameters["OpenFile"]);
 }
 void RemoveProjectFromSolution(DnxProject project)
 {
     project.ParentFolder.Items.Remove (project);
     project.Dispose ();
 }