Esempio n. 1
0
        public static void Main(string[] args)
        {
            ProgramArgs = ParseArgs(args);

            if (ProgramArgs.ContainsKey("-cleanup"))
            {
                if (Restart("-cleanup"))
                {
                    return;
                }

                if (!Build.InitializeBuildEnvironment(true))
                {
                    return;
                }

                Build.CleanupAppxSignature();
                Build.CleanupBuildEnvironment();

                Build.ShowBuildStats();
            }
            else if (ProgramArgs.ContainsKey("-phapppub_gen"))
            {
                if (!Build.InitializeBuildEnvironment(false))
                {
                    return;
                }

                Build.BuildPublicHeaderFiles();
            }
            else if (ProgramArgs.ContainsKey("-graph"))
            {
                if (!Build.InitializeBuildEnvironment(true))
                {
                    return;
                }

                Build.ShowBuildEnvironment("changelog", true, false);

                if (Win32.GetConsoleMode(Win32.GetStdHandle(Win32.STD_OUTPUT_HANDLE), out ConsoleMode mode))
                {
                    Win32.SetConsoleMode(Win32.GetStdHandle(Win32.STD_OUTPUT_HANDLE), mode | ConsoleMode.ENABLE_VIRTUAL_TERMINAL_PROCESSING);
                }

                Console.WriteLine(Build.GetBuildLogString());

                Build.ShowBuildStats();
            }
            else if (ProgramArgs.ContainsKey("-sdk"))
            {
                if (!Build.InitializeBuildEnvironment(false))
                {
                    return;
                }

                Build.CopyKProcessHacker(
                    BuildFlags.Build32bit | BuildFlags.Build64bit |
                    BuildFlags.BuildDebug
                    );

                BuildSdk(
                    BuildFlags.Build32bit | BuildFlags.Build64bit |
                    BuildFlags.BuildDebug | BuildFlags.BuildVerbose
                    );
            }
            else if (ProgramArgs.ContainsKey("-cleansdk"))
            {
                if (!Build.InitializeBuildEnvironment(false))
                {
                    return;
                }

                if (!Build.BuildSolution("ProcessHacker.sln",
                                         BuildFlags.Build32bit | BuildFlags.Build64bit |
                                         BuildFlags.BuildVerbose
                                         ))
                {
                    return;
                }

                BuildSdk(BuildFlags.Build32bit | BuildFlags.Build64bit | BuildFlags.BuildVerbose);

                Build.ShowBuildStats();
            }
            else if (ProgramArgs.ContainsKey("-bin"))
            {
                if (!Build.InitializeBuildEnvironment(false))
                {
                    return;
                }

                Build.ShowBuildEnvironment("bin", false, true);
                Build.CopyKeyFiles();

                if (!Build.BuildSolution("ProcessHacker.sln",
                                         BuildFlags.Build32bit | BuildFlags.Build64bit | BuildFlags.BuildVerbose))
                {
                    return;
                }

                if (!Build.CopyKProcessHacker(
                        BuildFlags.Build32bit | BuildFlags.Build64bit | BuildFlags.BuildVerbose))
                {
                    return;
                }

                if (!BuildSdk(BuildFlags.Build32bit | BuildFlags.Build64bit | BuildFlags.BuildVerbose))
                {
                    return;
                }

                if (!Build.BuildSolution("plugins\\Plugins.sln",
                                         BuildFlags.Build32bit | BuildFlags.Build64bit | BuildFlags.BuildVerbose))
                {
                    return;
                }

                if (!Build.CopyWow64Files(BuildFlags.None))
                {
                    return;
                }

                if (!Build.BuildBinZip())
                {
                    return;
                }

                Build.ShowBuildStats();
            }
            else if (ProgramArgs.ContainsKey("-debug"))
            {
                if (!Build.InitializeBuildEnvironment(true))
                {
                    return;
                }

                Build.ShowBuildEnvironment("debug", true, true);
                Build.CopyKeyFiles();

                if (!Build.BuildSolution("ProcessHacker.sln",
                                         BuildFlags.Build32bit | BuildFlags.Build64bit |
                                         BuildFlags.BuildDebug | BuildFlags.BuildVerbose))
                {
                    return;
                }

                if (!Build.CopyKProcessHacker(
                        BuildFlags.Build32bit | BuildFlags.Build64bit |
                        BuildFlags.BuildDebug | BuildFlags.BuildVerbose))
                {
                    return;
                }

                if (!BuildSdk(
                        BuildFlags.Build32bit | BuildFlags.Build64bit |
                        BuildFlags.BuildDebug | BuildFlags.BuildVerbose
                        ))
                {
                    return;
                }

                if (!Build.BuildSolution("plugins\\Plugins.sln",
                                         BuildFlags.Build32bit | BuildFlags.Build64bit |
                                         BuildFlags.BuildDebug | BuildFlags.BuildVerbose
                                         ))
                {
                    return;
                }

                if (!Build.CopyWow64Files(BuildFlags.BuildDebug))
                {
                    return;
                }

                Build.ShowBuildStats();
            }
            else if (ProgramArgs.ContainsKey("-appveyor"))
            {
                if (!Build.InitializeBuildEnvironment(true))
                {
                    return;
                }

                Build.ShowBuildEnvironment("nightly", true, true);
                Build.CopyKeyFiles();

                if (!Build.BuildSolution("ProcessHacker.sln",
                                         BuildFlags.Build32bit | BuildFlags.Build64bit | BuildFlags.BuildVerbose))
                {
                    return;
                }

                if (!Build.CopyKProcessHacker(BuildFlags.Build32bit | BuildFlags.Build64bit | BuildFlags.BuildVerbose))
                {
                    return;
                }

                if (!BuildSdk(BuildFlags.Build32bit | BuildFlags.Build64bit | BuildFlags.BuildVerbose))
                {
                    return;
                }

                if (!Build.BuildSolution("plugins\\Plugins.sln", BuildFlags.Build32bit | BuildFlags.Build64bit | BuildFlags.BuildVerbose))
                {
                    return;
                }

                if (!Build.CopyWow64Files(BuildFlags.None))
                {
                    return;
                }

                if (!Build.BuildBinZip())
                {
                    return;
                }
                if (!Build.BuildSetupExe())
                {
                    return;
                }
                if (!Build.BuildChecksumsFile())
                {
                    return;
                }
                if (!Build.BuildUpdateSignature())
                {
                    return;
                }

                if (Build.AppveyorUploadBuildFiles())
                {
                    Build.WebServiceUpdateConfig();
                }
            }
            else if (ProgramArgs.ContainsKey("-appxbuild"))
            {
                if (!Build.InitializeBuildEnvironment(true))
                {
                    return;
                }

                Build.ShowBuildEnvironment("appx", true, true);
                Build.CopyKeyFiles();

                if (!Build.BuildSolution("ProcessHacker.sln", BuildFlags.Build32bit | BuildFlags.Build64bit | BuildFlags.BuildVerbose))
                {
                    return;
                }

                if (!BuildSdk(BuildFlags.Build32bit | BuildFlags.Build64bit | BuildFlags.BuildVerbose))
                {
                    return;
                }

                if (!Build.BuildSolution("plugins\\Plugins.sln", BuildFlags.Build32bit | BuildFlags.Build64bit | BuildFlags.BuildVerbose))
                {
                    return;
                }

                if (!Build.CopyWow64Files(BuildFlags.None))
                {
                    return;
                }

                Build.BuildAppxPackage(BuildFlags.Build32bit | BuildFlags.Build64bit | BuildFlags.BuildVerbose);

                Build.ShowBuildStats();
            }
            else if (ProgramArgs.ContainsKey("-appxmakecert"))
            {
                if (Restart("-appxmakecert"))
                {
                    return;
                }

                if (!Build.InitializeBuildEnvironment(false))
                {
                    return;
                }

                Build.ShowBuildEnvironment("appxcert", true, true);

                Build.BuildAppxSignature();

                Build.ShowBuildStats();
            }
            else
            {
                if (!Build.InitializeBuildEnvironment(true))
                {
                    return;
                }

                Build.ShowBuildEnvironment("release", true, true);
                Build.CopyKeyFiles();

                if (!Build.BuildSolution("ProcessHacker.sln",
                                         BuildFlags.Build32bit | BuildFlags.Build64bit | BuildFlags.BuildVerbose))
                {
                    return;
                }

                if (!Build.CopyKProcessHacker(BuildFlags.Build32bit | BuildFlags.Build64bit | BuildFlags.BuildVerbose))
                {
                    return;
                }

                if (!BuildSdk(BuildFlags.Build32bit | BuildFlags.Build64bit | BuildFlags.BuildVerbose))
                {
                    return;
                }

                if (!Build.BuildSolution("plugins\\Plugins.sln",
                                         BuildFlags.Build32bit | BuildFlags.Build64bit | BuildFlags.BuildVerbose))
                {
                    return;
                }

                if (!Build.CopyWow64Files(BuildFlags.None))
                {
                    return;
                }

                if (!Build.BuildBinZip())
                {
                    return;
                }
                if (!Build.BuildSetupExe())
                {
                    return;
                }
                Build.BuildPdbZip();
                Build.BuildSdkZip();
                Build.BuildSrcZip();

                Build.ShowBuildStats();
            }
        }