public void UpdateLog(SolutionObjectView solution)
        {
            StringBuilder logBuilder = new StringBuilder();

            logBuilder.Append(solution.BuildLog);
            Log = logBuilder.ToString();
        }
Exemple #2
0
        private int PerformPostbuildStep(SolutionObjectView solution, ref int currentProcessId)
        {
            if (solution.PostBuildStep == null || solution.PostBuildStep.Length == 0)
            {
                return(-1);
            }
            System.Diagnostics.Process          process   = new System.Diagnostics.Process();
            System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo()
            {
                WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden, RedirectStandardOutput = true, UseShellExecute = false, CreateNoWindow = true
            };
            startInfo.FileName         = "cmd.exe";
            startInfo.WorkingDirectory = BaseDir;
            string command = solution.PostBuildStep;

            command = command.Replace(@"{Name}", solution.Name);

            startInfo.Arguments = @"/c " + command;
            process.StartInfo   = startInfo;
            bool Success = process.Start();

            currentProcessId = process.Id;
            process.BeginOutputReadLine();
            process.WaitForExit();
            string strLog = "PostBuild: " + command + " finished with " + process.ExitCode;

            solution.BuildLog += strLog;
            AddToLog?.Invoke(strLog + Environment.NewLine);
            return(process.ExitCode);
        }
Exemple #3
0
        private bool BuildSolution(FileInfo buildExe, string solutionPath, string baseOptions, SolutionObjectView solution, ref int currentProcessId)
        {
            bool buildFailure = true;

            solution.BuildLog = "";
            System.Diagnostics.Process          process   = new System.Diagnostics.Process();
            System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo()
            {
                WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden, RedirectStandardOutput = true, UseShellExecute = false, CreateNoWindow = true
            };
            startInfo.FileName  = buildExe.ToString();
            startInfo.Arguments = baseOptions + " " + solution.Options + " " + solutionPath;
            process.StartInfo   = startInfo;
            // Set event handler
            process.OutputDataReceived += (s, eventargs) => BuildOutputHandler(s, eventargs, solution);
            bool Success = process.Start();

            currentProcessId = process.Id;
            process.BeginOutputReadLine();
            process.WaitForExit();
            int exitCode = process.ExitCode;

            if (exitCode == 0)
            {
                buildFailure        = false;
                solution.BuildState = View.State.Success;
            }
            else
            {
                buildFailure        = true;
                solution.BuildState = View.State.Failure;
            }

            solution.SuccessFlag = exitCode == 0 ? true : false;
            if (solution.SuccessFlag)
            {
                PerformPostbuildStep(solution, ref currentProcessId);
            }

            return(buildFailure);
        }
Exemple #4
0
        private void BuildOutputHandler(object sender, DataReceivedEventArgs e, SolutionObjectView solution)
        {
            string line = e.Data + Environment.NewLine;

            solution.BuildLog += line;
        }