public static bool CreateIfEnabled(AbsolutePath target, AbsolutePath source, PathTable pathTable, out PathTranslator translator) { translator = null; if (!target.IsValid || !source.IsValid) { return(false); } translator = new PathTranslator(target.ToString(pathTable), source.ToString(pathTable)); return(true); }
public static bool CreateIfEnabled(AbsolutePath from, AbsolutePath to, PathTable pathTable, out PathTranslator translator) { translator = null; if (!from.IsValid || !to.IsValid) { return(false); } translator = new PathTranslator(from.ToString(pathTable), to.ToString(pathTable)); return(true); }
/// <summary> /// Create a new standard console /// </summary> /// <param name="colorize"> /// When true, errors and warnings are colorized in the output. When false, all output is /// monochrome. /// </param> /// <param name="animateTaskbar"> /// When true, BuildXL animates its taskbar icon during execution. /// </param> /// <param name="supportsOverwriting"> /// When true, messages printed to the console may be updated in-place (if supported) /// </param> /// <param name="pathTranslator"> /// The object to use to translate paths from one root to another (if specified) /// </param> public StandardConsole(bool colorize, bool animateTaskbar, bool supportsOverwriting, PathTranslator pathTranslator = null) { m_defaultForegroundColor = Console.ForegroundColor; // If any output is redirected, updating the cursor position won't work. We assume the output won't get // redirected after the process starts. m_updatingConsole = !Console.IsOutputRedirected && !Console.IsErrorRedirected && supportsOverwriting; m_pathTranslator = pathTranslator; if (colorize) { m_errorColor = ConsoleColor.Red; m_warningColor = ConsoleColor.Yellow; } else { m_errorColor = m_warningColor = m_defaultForegroundColor; } if (animateTaskbar) { m_taskbar = new TaskbarInterop(); m_taskbar.Init(); m_taskbar.SetTaskbarState(TaskbarInterop.TaskbarProgressStates.Normal); } var debugConsole = Environment.GetEnvironmentVariable("BUILDXLDEBUGCONSOLE"); if (!string.IsNullOrWhiteSpace(debugConsole) && debugConsole != "0") { m_debugConsole = true; } }