/// <summary> /// Initializes the build manager with a concrete VSTS API implementation and all parameters necessary /// to orchestrate a distributed build /// </summary> /// <param name="vstsApi">Interface to interact with VSTS API</param> /// <param name="executor">Interface to execute the build engine</param> /// <param name="args">Build CLI arguments</param> /// <param name="logger">Interface to log build info</param> public BuildManager(IApi vstsApi, IBuildExecutor executor, string[] args, ILogger logger) { m_vstsApi = vstsApi ?? throw new ArgumentNullException(nameof(vstsApi)); m_executor = executor ?? throw new ArgumentNullException(nameof(executor)); m_logger = logger ?? throw new ArgumentNullException(nameof(logger)); m_buildArguments = args; }
private async Task BuildProject(IBuildExecutor buildExecutor) { if (!_source.BuildInReleaseMode) { await buildExecutor.ExecuteBuildInDebugModeWithoutDependencies(); } else { await buildExecutor.ExecuteBuildInReleaseModeWithoutDependencies(); } }
private static void ExecuteBuildInstructions(IBuildInstructionsCompiler compiler, IBuildExecutor executor, Dictionary<string, string> options) { var instructionsFilePath = options[CommandLineOption.PathToBuildInstructions]; var source = File.ReadAllText(instructionsFilePath); var instructions = compiler.Compile(source); if (instructions.Errors.HasErrors) { //TODO: Move all error reporting into one place, not here and in Program.Main. Console.WriteLine("Building the Build Instructions failed."); foreach (CompilerError error in instructions.Errors) { Console.WriteLine(error.ErrorText); } } else { var output = executor.ExecuteBuildInstructions(instructions, options[CommandLineOption.MethodToInvoke]); Console.WriteLine(output); } }