Esempio n. 1
0
        private static bool BuildCSProj(FileInfo msbuild, string projFileName, string config, string platform, string optionalArgs, bool isRequired)
        {
            try
            {
                FileInfo projFile;
                if (!SourceDownloader.GetBuildRelFile(projFileName, out projFile) || !projFile.Exists)
                {
                    if (isRequired)
                    {
                        Program.WriteError("Could not find project file {0}", projFileName);
                        return(false);
                    }
                    else
                    {
                        Program.WriteWarning("Could not find project file {0}", projFileName);
                        return(true);
                    }
                }

                var psi = new ProcessStartInfo();
                psi.UseShellExecute        = false;
                psi.RedirectStandardError  = true;
                psi.RedirectStandardOutput = true;
                psi.WorkingDirectory       = projFile.Directory.FullName;
                psi.FileName       = msbuild.FullName;
                psi.Arguments      = string.Format(MsBuildCommand, projFile.Name, config, platform, optionalArgs);
                psi.CreateNoWindow = true;

                var process = new Process();
                process.StartInfo           = psi;
                process.OutputDataReceived += OutputReceived;
                process.Start();
                process.BeginErrorReadLine();
                process.BeginOutputReadLine();
                process.WaitForExit();

                Program.WriteInfo("EXIT: {0}", process.ExitCode);
                return(process.ExitCode == 0 || !isRequired);
            }
            catch (Exception e)
            {
                if (isRequired)
                {
                    Program.WriteError("Failed to build project {0} - {1}", projFileName, e.Message);
                    return(false);
                }
                else
                {
                    Program.WriteWarning("Failed to build project {0} - {1}", projFileName, e.Message);
                    return(true);
                }
            }
        }
Esempio n. 2
0
        private static bool BuildPlatform(FileInfo vcVars, string bat)
        {
            try
            {
                FileInfo batFile;
                if (!SourceDownloader.GetBuildRelFile(bat, out batFile))
                {
                    Program.WriteError("Could not find file {0}", bat);
                    return(false);
                }

                var psi = new ProcessStartInfo();
                psi.UseShellExecute        = false;
                psi.RedirectStandardError  = true;
                psi.RedirectStandardOutput = true;
                psi.WorkingDirectory       = batFile.Directory.FullName;
                psi.FileName       = batFile.FullName;
                psi.Arguments      = string.Format("\"{0}\"", vcVars.FullName);
                psi.CreateNoWindow = true;

                var process = new Process();
                process.StartInfo           = psi;
                process.OutputDataReceived += OutputReceived;
                process.Start();
                process.BeginErrorReadLine();
                process.BeginOutputReadLine();
                process.WaitForExit();

                Program.WriteInfo("EXIT: {0}", process.ExitCode);
                return(process.ExitCode == 0);
            }
            catch (Exception e)
            {
                Program.WriteError("Failed to build z3 ({0}) - {1}", bat, e.Message);
                return(false);
            }
        }