public void ReportDiagnostics(OmniSharp.Dnx.Project project, DiagnosticsMessage[] messages) { if (builder != null) { builder.OnDiagnostics(messages); builder = null; } }
void UpdateDependencies(OmniSharp.Dnx.Project project, DependenciesMessage message) { DnxProject matchedProject = FindProjectByProjectJsonFileName(project.Path); if (matchedProject != null) { matchedProject.UpdateDependencies(message); } }
public DnxProject(Project project) { Path = project.Path; Name = project.Name; Commands = project.Commands; Configurations = project.Configurations; GlobalJsonPath = project.GlobalJsonPath; ProjectSearchPaths = project.ProjectSearchPaths; Frameworks = project.ProjectsByFramework.Values.Select(framework => new DnxFramework(framework)).ToList(); SourceFiles = project.SourceFiles; }
public void Run(Project project) { if (!_options.Dnx.EnablePackageRestore) { return; } Task.Factory.StartNew(() => { object projectLock; lock (_lock) { if (!_projectLocks.TryGetValue(project.Path, out projectLock)) { projectLock = new object(); _projectLocks.Add(project.Path, projectLock); } else { return; } } lock (projectLock) { var exitCode = -1; _emitter.Emit(EventTypes.PackageRestoreStarted, new PackageRestoreMessage() { FileName = project.Path }); _semaphore.Wait(); try { exitCode = DoRun(project, 1); _context.Connection.Post(new Message() { ContextId = project.ContextId, MessageType = "RestoreComplete", HostId = _context.HostId }); } finally { _semaphore.Release(); _projectLocks.Remove(project.Path); _emitter.Emit(EventTypes.PackageRestoreFinished, new PackageRestoreMessage() { FileName = project.Path, Succeeded = exitCode == 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))); } } }); }
public void DependenciesUpdated(OmniSharp.Dnx.Project project, DependenciesMessage message) { DispatchService.GuiDispatch(() => UpdateDependencies(project, message)); }
private int DoRun(Project project, int retry) { var psi = new ProcessStartInfo() { FileName = _paths.Dnu ?? _paths.Kpm, WorkingDirectory = Path.GetDirectoryName(project.Path), CreateNoWindow = true, UseShellExecute = false, RedirectStandardOutput = true, RedirectStandardError = true, Arguments = "restore" }; _logger.LogInformation("restore packages {0} {1} for {2}", psi.FileName, psi.Arguments, psi.WorkingDirectory); var restoreProcess = Process.Start(psi); if (restoreProcess.HasExited) { _logger.LogError("restore command ({0}) failed with error code {1}", psi.FileName, restoreProcess.ExitCode); return restoreProcess.ExitCode; } // watch dog to workaround dnu restore hangs var lastSignal = DateTime.UtcNow; var wasKilledByWatchDog = false; var watchDog = Task.Factory.StartNew(async () => { while (!restoreProcess.HasExited) { if (DateTime.UtcNow - lastSignal > TimeSpan.FromSeconds(_options.Dnx.PackageRestoreTimeout)) { _logger.LogError("killing restore comment ({0}) because it seems be stuck. retrying {1} more time(s)...", restoreProcess.Id, retry); wasKilledByWatchDog = true; restoreProcess.KillAll(); } await Task.Delay(TimeSpan.FromSeconds(10)); } }); restoreProcess.OutputDataReceived += (sender, e) => { if (e.Data != null) _logger.LogInformation(e.Data); lastSignal = DateTime.UtcNow; }; restoreProcess.ErrorDataReceived += (sender, e) => { if (e.Data != null) _logger.LogError(e.Data); lastSignal = DateTime.UtcNow; }; restoreProcess.BeginOutputReadLine(); restoreProcess.BeginErrorReadLine(); restoreProcess.WaitForExit(); return wasKilledByWatchDog && retry > 0 ? DoRun(project, retry - 1) : restoreProcess.ExitCode; }
public void ReportDiagnostics(OmniSharp.Dnx.Project project, DiagnosticsListMessage message) { DnxServices.ProjectService.ReportDiagnostics(project, message); }
// public void OnDocumentChanged(DocumentId documentId, SourceText text) // { // OnDocumentTextChanged(documentId, text, PreservationMode.PreserveIdentity); // } // // public DocumentId GetDocumentId(string filePath) // { // var documentIds = CurrentSolution.GetDocumentIdsWithFilePath(filePath); // return documentIds.FirstOrDefault(); // } // // public IEnumerable<Document> GetDocuments(string filePath) // { // return CurrentSolution.GetDocumentIdsWithFilePath(filePath).Select(id => CurrentSolution.GetDocument(id)); // } // // public Document GetDocument(string filePath) // { // var documentId = GetDocumentId(filePath); // if (documentId == null) // { // return null; // } // return CurrentSolution.GetDocument(documentId); // } // // public override bool CanApplyChange(ApplyChangesKind feature) // { // return true; // } public void DependenciesUpdated(OmniSharp.Dnx.Project project, DependenciesMessage message) { DnxServices.ProjectService.DependenciesUpdated(project, message); }
public void DependenciesUpdated(OmniSharp.Dnx.Project project, DependenciesMessage message) { Runtime.RunInMainThread(() => UpdateDependencies(project, message)); }