public override bool Execute() { var log = new MSBuildLogger(Log); // Log inputs log.LogDebug($"(in) RestoreGraphItems Count '{RestoreGraphItems?.Count() ?? 0}'"); log.LogDebug($"(in) RestoreSources '{RestoreSources}'"); log.LogDebug($"(in) RestorePackagesPath '{RestorePackagesPath}'"); log.LogDebug($"(in) RestoreFallbackFolders '{RestoreFallbackFolders}'"); log.LogDebug($"(in) RestoreDisableParallel '{RestoreDisableParallel}'"); log.LogDebug($"(in) RestoreConfigFile '{RestoreConfigFile}'"); log.LogDebug($"(in) RestoreNoCache '{RestoreNoCache}'"); log.LogDebug($"(in) RestoreIgnoreFailedSources '{RestoreIgnoreFailedSources}'"); log.LogDebug($"(in) RestoreRecursive '{RestoreRecursive}'"); try { return(ExecuteAsync(log).Result); } catch (Exception e) { ExceptionUtilities.HandleException(e, log); return(false); } }
public override bool Execute() { var log = new MSBuildLogger(Log); // Log inputs log.LogDebug($"(in) RestoreGraphItems Count '{RestoreGraphItems?.Count() ?? 0}'"); log.LogDebug($"(in) RestoreSources '{RestoreSources}'"); log.LogDebug($"(in) RestorePackagesPath '{RestorePackagesPath}'"); log.LogDebug($"(in) RestoreFallbackFolders '{RestoreFallbackFolders}'"); log.LogDebug($"(in) RestoreDisableParallel '{RestoreDisableParallel}'"); log.LogDebug($"(in) RestoreConfigFile '{RestoreConfigFile}'"); log.LogDebug($"(in) RestoreNoCache '{RestoreNoCache}'"); log.LogDebug($"(in) RestoreIgnoreFailedSources '{RestoreIgnoreFailedSources}'"); log.LogDebug($"(in) RestoreRecursive '{RestoreRecursive}'"); log.LogDebug($"(in) RestoreForce '{RestoreForce}'"); log.LogDebug($"(in) HideWarningsAndErrors '{HideWarningsAndErrors}'"); try { return(ExecuteAsync(log).Result); } catch (AggregateException ex) when(_cts.Token.IsCancellationRequested && ex.InnerException is TaskCanceledException) { // Canceled by user log.LogError(Strings.RestoreCanceled); return(false); } catch (Exception e) { ExceptionUtilities.LogException(e, log); return(false); } }
public override bool Execute() { #if DEBUG var debugRestoreTask = Environment.GetEnvironmentVariable("DEBUG_RESTORE_TASK"); if (!string.IsNullOrEmpty(debugRestoreTask) && debugRestoreTask.Equals(bool.TrueString, StringComparison.OrdinalIgnoreCase)) { #if IS_CORECLR Console.WriteLine("Waiting for debugger to attach."); Console.WriteLine($"Process ID: {Process.GetCurrentProcess().Id}"); while (!Debugger.IsAttached) { System.Threading.Thread.Sleep(100); } Debugger.Break(); #else Debugger.Launch(); #endif } #endif var log = new MSBuildLogger(Log); // Log inputs log.LogDebug($"(in) RestoreGraphItems Count '{RestoreGraphItems?.Count() ?? 0}'"); log.LogDebug($"(in) RestoreDisableParallel '{RestoreDisableParallel}'"); log.LogDebug($"(in) RestoreNoCache '{RestoreNoCache}'"); log.LogDebug($"(in) RestoreIgnoreFailedSources '{RestoreIgnoreFailedSources}'"); log.LogDebug($"(in) RestoreRecursive '{RestoreRecursive}'"); log.LogDebug($"(in) RestoreForce '{RestoreForce}'"); log.LogDebug($"(in) HideWarningsAndErrors '{HideWarningsAndErrors}'"); log.LogDebug($"(in) RestoreForceEvaluate '{RestoreForceEvaluate}'"); try { DefaultCredentialServiceUtility.SetupDefaultCredentialService(log, !Interactive); return(ExecuteAsync(log).Result); } catch (AggregateException ex) when(_cts.Token.IsCancellationRequested && ex.InnerException is TaskCanceledException) { // Canceled by user log.LogError(Strings.RestoreCanceled); return(false); } catch (Exception e) { ExceptionUtilities.LogException(e, log); return(false); } finally { // The CredentialService lifetime is for the duration of the process. We should not leave a potentially unavailable logger. // We need to update the delegating logger with a null instance // because the tear downs of the plugins and similar rely on idleness and process exit. DefaultCredentialServiceUtility.UpdateCredentialServiceDelegatingLogger(NullLogger.Instance); } }
public override bool Execute() { #if DEBUG var debugRestoreTask = Environment.GetEnvironmentVariable("DEBUG_RESTORE_TASK"); if (!string.IsNullOrEmpty(debugRestoreTask) && debugRestoreTask.Equals(bool.TrueString, StringComparison.OrdinalIgnoreCase)) { #if IS_CORECLR Console.WriteLine("Waiting for debugger to attach."); Console.WriteLine($"Process ID: {Process.GetCurrentProcess().Id}"); while (!Debugger.IsAttached) { System.Threading.Thread.Sleep(100); } Debugger.Break(); #else Debugger.Launch(); #endif } #endif var log = new MSBuildLogger(Log); // Log inputs log.LogDebug($"(in) RestoreGraphItems Count '{RestoreGraphItems?.Count() ?? 0}'"); log.LogDebug($"(in) RestoreDisableParallel '{RestoreDisableParallel}'"); log.LogDebug($"(in) RestoreNoCache '{RestoreNoCache}'"); log.LogDebug($"(in) RestoreIgnoreFailedSources '{RestoreIgnoreFailedSources}'"); log.LogDebug($"(in) RestoreRecursive '{RestoreRecursive}'"); log.LogDebug($"(in) RestoreForce '{RestoreForce}'"); log.LogDebug($"(in) HideWarningsAndErrors '{HideWarningsAndErrors}'"); log.LogDebug($"(in) RestoreForceEvaluate '{RestoreForceEvaluate}'"); log.LogDebug($"(in) RestorePackagesConfig '{RestorePackagesConfig}'"); try { return(ExecuteAsync(log).Result); } catch (AggregateException ex) when(_cts.Token.IsCancellationRequested && ex.InnerException is TaskCanceledException) { // Canceled by user log.LogError(Strings.RestoreCanceled); return(false); } catch (Exception e) { ExceptionUtilities.LogException(e, log); return(false); } }
public override bool Execute() { #if DEBUG var debugRestoreTask = Environment.GetEnvironmentVariable("DEBUG_RESTORE_GRAPH_TASK"); if (!string.IsNullOrEmpty(debugRestoreTask) && debugRestoreTask.Equals(bool.TrueString, StringComparison.OrdinalIgnoreCase)) { Debugger.Launch(); } #endif if (RestoreGraphItems.Length < 1) { Log.LogWarning("Unable to find a project to restore!"); return(true); } var log = new MSBuildLogger(Log); log.LogDebug($"(in) RestoreGraphItems Count '{RestoreGraphItems?.Count() ?? 0}'"); log.LogDebug($"(in) RestoreGraphOutputPath '{RestoreGraphOutputPath}'"); log.LogDebug($"(in) RestoreRecursive '{RestoreRecursive}'"); // Convert to the internal wrapper var wrappedItems = RestoreGraphItems.Select(GetMSBuildItem); // Create file var dgFile = MSBuildRestoreUtility.GetDependencySpec(wrappedItems); // Add all child projects if (RestoreRecursive) { BuildTasksUtility.AddAllProjectsForRestore(dgFile); } var fileInfo = new FileInfo(RestoreGraphOutputPath); fileInfo.Directory.Create(); // Save file log.LogMinimal($"Writing {fileInfo.FullName}"); dgFile.Save(fileInfo.FullName); return(true); }
public override bool Execute() { if (RestoreGraphItems.Length < 1) { Log.LogWarning("Unable to find a project to restore!"); return(true); } var log = new MSBuildLogger(Log); log.LogDebug($"(in) RestoreGraphItems Count '{RestoreGraphItems?.Count() ?? 0}'"); log.LogDebug($"(in) RestoreGraphOutputPath '{RestoreGraphOutputPath}'"); log.LogDebug($"(in) RestoreRecursive '{RestoreRecursive}'"); // Convert to the internal wrapper var wrappedItems = RestoreGraphItems.Select(GetMSBuildItem); // Create file var dgFile = MSBuildRestoreUtility.GetDependencySpec(wrappedItems); // Add all child projects if (RestoreRecursive) { BuildTasksUtility.AddAllProjectsForRestore(dgFile); } var fileInfo = new FileInfo(RestoreGraphOutputPath); fileInfo.Directory.Create(); // Save file log.LogMinimal($"Writing {fileInfo.FullName}"); dgFile.Save(fileInfo.FullName); return(true); }
public override bool Execute() { var log = new MSBuildLogger(Log); // Log inputs log.LogDebug($"(in) RestoreGraphItems Count '{RestoreGraphItems?.Count() ?? 0}'"); log.LogDebug($"(in) RestoreSources '{RestoreSources}'"); log.LogDebug($"(in) RestorePackagesPath '{RestorePackagesPath}'"); log.LogDebug($"(in) RestoreFallbackFolders '{RestoreFallbackFolders}'"); log.LogDebug($"(in) RestoreDisableParallel '{RestoreDisableParallel}'"); log.LogDebug($"(in) RestoreConfigFile '{RestoreConfigFile}'"); log.LogDebug($"(in) RestoreNoCache '{RestoreNoCache}'"); log.LogDebug($"(in) RestoreIgnoreFailedSources '{RestoreIgnoreFailedSources}'"); log.LogDebug($"(in) RestoreRecursive '{RestoreRecursive}'"); try { return(ExecuteAsync(log).Result); } catch (Exception e) { // Log the error if (ExceptionLogger.Instance.ShowStack) { log.LogError(e.ToString()); } else { log.LogError(ExceptionUtilities.DisplayMessage(e)); } // Log the stack trace as verbose output. log.LogVerbose(e.ToString()); return(false); } }