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
        public static bool Build(bool isRebuildForced)
        {
            if (!isRebuildForced && Verify(outputs))
            {
                Program.WriteInfo("Z3 dependencies have already been built; skipping this build step.");
                return(true);
            }

            var           result = true;
            DirectoryInfo z3Src  = new DirectoryInfo(@"C:\Projects\Git\Formula\Ext\Z3\z3_");

            result = SourceDownloader.Download(SourceDownloader.DependencyKind.Z3, out z3Src) && result;
            if (!result)
            {
                Program.WriteError("Could not acquire Z3 dependency");
                return(false);
            }

            FileInfo vcVars;

            result = SourceDownloader.GetVCVarsBat(out vcVars) && result;
            if (!result)
            {
                Program.WriteError("Could not find Visual Studio environment variables");
                return(false);
            }

            Program.WriteInfo("Building Z3 for x86.");
            DirectoryInfo outDir;

            result = BuildPlatform(vcVars, Z3Buildx86) &&
                     SourceDownloader.GetBuildRelDir(Z3x86Drop, true, out outDir) &&
                     DoMove(z3Src, z3x86MoveMap) &&
                     result;
            if (!result)
            {
                Program.WriteError("Could not build z3 (x86)");
                return(false);
            }

            Program.WriteInfo("Building Z3 for x64.");
            result = BuildPlatform(vcVars, Z3Buildx64) &&
                     SourceDownloader.GetBuildRelDir(Z3x64Drop, true, out outDir) &&
                     DoMove(z3Src, z3x64MoveMap) &&
                     result;
            if (!result)
            {
                Program.WriteError("Could not build z3 (x64)");
                return(false);
            }

            return(result);
        }
Esempio n. 3
0
        void Run()
        {
            if (layout)
            {
                SourceDownloader.PrintSourceURLs();
                GardensPointBuilder.PrintOutputs();
                Z3Builder.PrintOutputs();
                return;
            }

            string python = FindInPath("Python.exe");

            if (python == null)
            {
                Program.WriteError("Could not find Python, please install Python 2.7");
                Program.WriteError("and make sure the location is in your PATH environment.");
                Program.WriteError("See: https://www.python.org/downloads/release");
                return;
            }

            WriteInfo("Building in {0} configuration", isDebug ? "debug" : "release");

            var result = GardensPointBuilder.Build(isForced);

            if (solver)
            {
                result |= Z3Builder.Build(isForced);
            }

            result |= FormulaBuilder.Build(isDebug, solver, isForced);

            if (!result)
            {
                WriteError("Build failed");
                Environment.ExitCode = FailCode;
                return;
            }
            else
            {
                WriteInfo("Build succeeded");
            }
        }
Esempio n. 4
0
        public static bool Build(bool isBldDebug, bool solver, bool isForced)
        {
            var      result = true;
            FileInfo msbuild, msbuild32 = null;

            result = SourceDownloader.GetMsbuild(out msbuild) &&
                     SourceDownloader.GetMsbuild(out msbuild32, true) &&
                     result;
            if (!result)
            {
                Program.WriteError("Could not build Formula, unable to find msbuild");
                return(false);
            }

            var config = isBldDebug ? ConfigDebug : ConfigRelease;

            foreach (var proj in Projects)
            {
                Program.WriteInfo("Building {0}: Config = {1}, Platform = {2}", proj.Item2, config, proj.Item3);
                string optionalArgs = solver ? "/p:SOLVER=SOLVER" : "/p:SOLVER=NOSOLVER";
                if (isForced)
                {
                    optionalArgs += " /t:rebuild";
                }
                result = BuildCSProj(proj.Item1 ? msbuild32 : msbuild, proj.Item2, config, proj.Item3, optionalArgs, proj.Item4) && result;
            }

            if (!result)
            {
                return(false);
            }

            result = DoMove(isBldDebug ? DebugMoveMap : ReleaseMoveMap) && result;
            if (solver)
            {
                result = DoMove(isBldDebug ? DebugZ3MoveMap : ReleaseZ3MoveMap) && result;
            }
            InstallVsix(isBldDebug ? CodeGeneratorDebug : CodeGeneratorRelease);
            return(result);
        }
Esempio n. 5
0
        private static bool InstallVsix(string vsixName)
        {
            Program.WriteInfo("Installing vsix {0}", vsixName);
            try
            {
                var runningLoc = new FileInfo(Assembly.GetExecutingAssembly().Location);
                var vsix       = new FileInfo(Path.Combine(runningLoc.Directory.FullName, vsixName));
                if (!vsix.Exists)
                {
                    Program.WriteWarning("Could not install vsix; file {0} does not exist.", vsix.FullName);
                    return(false);
                }

                FileInfo installer;
                if (!SourceDownloader.GetVsixInstaller(out installer))
                {
                    Program.WriteWarning("Could not install vsix; unable to find vsix installer.");
                    return(false);
                }

                if (!RunInstaller(installer, "/q /u:4f5a7e3b-98cc-4601-a247-51cdbb9eb444"))
                {
                    Program.WriteWarning("Attempt to uninstall previous vsix failed.");
                }

                if (!RunInstaller(installer, string.Format("/q \"{0}\"", vsix.FullName)))
                {
                    Program.WriteWarning("Could not install vsix extension {0}", vsix.FullName);
                    return(false);
                }

                return(true);
            }
            catch (Exception e)
            {
                Program.WriteWarning("Could not install vsix {0} - {1}", vsixName, e.Message);
                return(false);
            }
        }
Esempio n. 6
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);
            }
        }
Esempio n. 7
0
        public static bool Build(bool isRebuildForced)
        {
            if (!isRebuildForced && Verify(outputs))
            {
                Program.WriteInfo("Gardens Point dependencies have already been built; skipping this build step.");
                return(true);
            }

            var           result = true;
            FileInfo      gppg, gplex;
            DirectoryInfo gplexSrc, gppgSrc;

            result = SourceDownloader.DownloadGardensPointBoot(out gppg, out gplex) && result;
            result = SourceDownloader.Download(SourceDownloader.DependencyKind.GPLEX, out gplexSrc) && result;
            result = SourceDownloader.Download(SourceDownloader.DependencyKind.GPPG, out gppgSrc) && result;
            if (!result)
            {
                Program.WriteError("Could not acquire Gardens Point dependencies");
                return(false);
            }

            FileInfo csc;

            result = SourceDownloader.GetCsc(out csc) && result;
            if (!result)
            {
                Program.WriteError("Could not find CSharp compiler");
                return(false);
            }

            FileInfo msbuild;

            result = SourceDownloader.GetMsbuild(out msbuild) && result;
            if (!result)
            {
                Program.WriteError("Could not find msbuild");
                return(false);
            }


            //// Next try to compile gplex
            result = GenerateSpecFiles(gplexSrc, gplexGenBat, gplexGenBatOut, csc, gplex, gppg) &&
                     UpgradeAndCompile(gplexSrc, gplexProj, msbuild, "v4.5") &&
                     DoMove(gplexSrc, gplexMoveMap) &&
                     result;
            if (!result)
            {
                Program.WriteError("Could not compile the gplex dependency");
                return(false);
            }

            //// Next try to compile gppg
            result = GenerateSpecFiles(gppgSrc, gppgGenBat, gppgGenBatOut, csc, gplex, gppg) &&
                     UpgradeAndCompile(gppgSrc, gppgProj, msbuild, "v4.5") &&
                     DoMove(gppgSrc, gppgMoveMap) &&
                     result;
            if (!result)
            {
                Program.WriteError("Could not compile the gppg dependency");
                return(false);
            }

            return(result);
        }