public static bool BuildUpdateSignature() { if (!File.Exists(CustomSignToolPath)) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[SKIPPED] CustomSignTool not found."); Console.ForegroundColor = ConsoleColor.White; return(true); } if (!File.Exists("build\\nightly.key")) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[SKIPPED] nightly.key not found."); Console.ForegroundColor = ConsoleColor.White; return(false); } if (!File.Exists(BuildOutputFolder + "\\processhacker-build-setup.exe")) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[SKIPPED] build-setup.exe not found."); Console.ForegroundColor = ConsoleColor.White; return(false); } BuildSetupSig = Win32.ExecCommand( CustomSignToolPath, "sign -k build\\nightly.key " + BuildOutputFolder + "\\processhacker-build-setup.exe -h" ); return(true); }
public static bool BuildUpdateSignature() { Program.PrintColorMessage("Building release signature...", ConsoleColor.Cyan); if (!File.Exists(CustomSignToolPath)) { Program.PrintColorMessage("[SKIPPED] CustomSignTool not found.", ConsoleColor.Yellow); return(true); } if (!File.Exists("build\\nightly.key")) { Program.PrintColorMessage("[SKIPPED] nightly.key not found.", ConsoleColor.Yellow); return(true); } if (!File.Exists(BuildOutputFolder + "\\processhacker-build-setup.exe")) { Program.PrintColorMessage("[SKIPPED] build-setup.exe not found.", ConsoleColor.Yellow); return(false); } BuildSetupSig = Win32.ExecCommand( CustomSignToolPath, "sign -k build\\nightly.key " + BuildOutputFolder + "\\processhacker-build-setup.exe -h" ); return(true); }
public static void ShowBuildEnvironment(bool ShowBuildInfo) { Program.PrintColorMessage("Setting up build environment...", ConsoleColor.Cyan); string currentGitTag = Win32.ExecCommand(GitExePath, "describe --abbrev=0 --tags --always"); string latestGitRevision = Win32.ExecCommand(GitExePath, "rev-list --count \"" + currentGitTag + ".." + BuildBranch + "\""); if (string.IsNullOrEmpty(latestGitRevision)) { BuildRevision = "0"; } else { BuildRevision = latestGitRevision.Trim(); } BuildVersion = "3.0." + BuildRevision; // TODO: Remove hard-coded major/minor version. BuildMessage = Win32.ExecCommand(GitExePath, "log -n 5 --date=format:%Y-%m-%d --pretty=format:\"[%cd] %an %s\" --abbrev-commit"); if (ShowBuildInfo) { string buildMessage = string.Empty; if (BuildNightly) { buildMessage = Win32.ExecCommand(GitExePath, "log -n 5 --date=format:%Y-%m-%d --pretty=format:\"[%cd] %an: %<(65,trunc)%s (%h)\" --abbrev-commit"); } else { 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); buildMessage = Win32.ExecCommand(GitExePath, "log -n 5 --date=format:%Y-%m-%d --pretty=format:\"%C(green)[%cd]%Creset %C(bold blue)%an%Creset %<(65,trunc)%s%Creset (%C(yellow)%h%Creset)\" --abbrev-commit"); } string currentBranch = Win32.ExecCommand(GitExePath, "rev-parse --abbrev-ref HEAD"); string currentCommitTag = Win32.ExecCommand(GitExePath, "rev-parse --short HEAD"); // rev-parse HEAD //string latestGitCount = Win32.GitExecCommand("rev-list --count " + BuildBranch); if (!string.IsNullOrEmpty(currentBranch)) { Program.PrintColorMessage(Environment.NewLine + "Branch: ", ConsoleColor.Cyan, false); Program.PrintColorMessage(currentBranch, ConsoleColor.White); } if (!string.IsNullOrEmpty(BuildVersion)) { Program.PrintColorMessage("Version: ", ConsoleColor.Cyan, false); Program.PrintColorMessage(BuildVersion, ConsoleColor.White); } Program.PrintColorMessage("Commit: ", ConsoleColor.Cyan, false); Program.PrintColorMessage(currentCommitTag + Environment.NewLine, ConsoleColor.White); if (!BuildNightly && !string.IsNullOrEmpty(buildMessage)) { Console.WriteLine(buildMessage + Environment.NewLine); } } }
public static bool BuildSolution(string Solution) { Console.ForegroundColor = ConsoleColor.Cyan; Console.Write("Building " + Path.GetFileNameWithoutExtension(Solution) + " ("); Console.ForegroundColor = ConsoleColor.Green; Console.Write("x32"); Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine(")..."); Console.ForegroundColor = ConsoleColor.White; string error32 = Win32.ExecCommand( MSBuildExePath, "/m /nologo /verbosity:quiet /p:Configuration=Release /p:Platform=Win32 " + Solution ); if (!string.IsNullOrEmpty(error32)) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("[ERROR] "); return(false); } Console.ForegroundColor = ConsoleColor.Cyan; Console.Write("Building " + Path.GetFileNameWithoutExtension(Solution) + " ("); Console.ForegroundColor = ConsoleColor.Green; Console.Write("x64"); Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine(")..."); Console.ForegroundColor = ConsoleColor.White; string error64 = Win32.ExecCommand( MSBuildExePath, "/m /nologo /verbosity:quiet /p:Configuration=Release /p:Platform=x64 " + Solution ); if (!string.IsNullOrEmpty(error64)) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("[ERROR] "); return(false); } return(true); }
public static bool BuildSrcZip() { if (!File.Exists(GitExePath)) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[SKIPPED] Git not installed."); return(false); } try { if (File.Exists(BuildOutputFolder + "\\processhacker-build-src.zip")) { File.Delete(BuildOutputFolder + "\\processhacker-build-src.zip"); } } catch (Exception ex) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("[ERROR] " + ex); return(false); } string output = Win32.ExecCommand( GitExePath, "--git-dir=.git " + "--work-tree=.\\ archive " + "--format zip " + "--output " + BuildOutputFolder + "\\processhacker-build-src.zip " + BuildBranch ); if (!string.IsNullOrEmpty(output)) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("[ERROR] " + output); return(false); } return(true); }
public static void ShowBuildEnvironment(bool ShowVersion = false) { string currentBranch = Win32.ExecCommand(GitExePath, "rev-parse --abbrev-ref HEAD"); string currentCommitTag = Win32.ExecCommand(GitExePath, "rev-parse --short HEAD"); // rev-parse HEAD string currentGitTag = Win32.ExecCommand(GitExePath, "describe --abbrev=0 --tags --always"); string latestGitRevision = Win32.ExecCommand(GitExePath, "rev-list --count \"" + currentGitTag + ".." + BuildBranch + "\""); //string latestGitCount = Win32.GitExecCommand("rev-list --count " + BuildBranch); string buildMessageColor = Win32.ExecCommand(GitExePath, "log -n 1 --date=format:%Y-%m-%d --pretty=format:\"%C(green)[%cd]%Creset %C(bold blue)%an%Creset %<(65,trunc)%s%Creset (%C(yellow)%h%Creset)\" --abbrev-commit"); BuildMessage = Win32.ExecCommand(GitExePath, "log -n 5 --date=format:%Y-%m-%d --pretty=format:\"[%cd] %an %s\" --abbrev-commit"); BuildRevision = latestGitRevision.Trim(); BuildVersion = "3.0." + BuildRevision; // TODO: Remove hard-coded major/minor version. if (ShowVersion) { Console.WriteLine("Branch: " + currentBranch); Console.WriteLine("Version: " + BuildVersion); Console.WriteLine("Commit: " + currentCommitTag); Console.WriteLine("Message: " + buildMessageColor + Environment.NewLine); } }
public static bool BuildSrcZip() { Program.PrintColorMessage("Building build-src.zip...", ConsoleColor.Cyan); if (!File.Exists(GitExePath)) { Program.PrintColorMessage("[SKIPPED] Git not installed.", ConsoleColor.Yellow); return(false); } try { if (File.Exists(BuildOutputFolder + "\\processhacker-build-src.zip")) { File.Delete(BuildOutputFolder + "\\processhacker-build-src.zip"); } } catch (Exception ex) { Program.PrintColorMessage("[ERROR] " + ex, ConsoleColor.Red); return(false); } string output = Win32.ExecCommand( GitExePath, "--git-dir=.git " + "--work-tree=.\\ archive " + "--format zip " + "--output " + BuildOutputFolder + "\\processhacker-build-src.zip " + BuildBranch ); if (!string.IsNullOrEmpty(output)) { Program.PrintColorMessage("[ERROR] " + output, ConsoleColor.Red); return(false); } return(true); }
public static bool BuildSolution(string Solution, bool Build64bit, bool BuildDebug, bool Verbose) { if (Verbose) { Program.PrintColorMessage("Building " + Path.GetFileNameWithoutExtension(Solution) + " (", ConsoleColor.Cyan, false); Program.PrintColorMessage("x32", ConsoleColor.Green, false); Program.PrintColorMessage(")...", ConsoleColor.Cyan); } string error32 = Win32.ExecCommand( MSBuildExePath, "/m /nologo /verbosity:quiet /p:Configuration=" + (BuildDebug ? "Debug" : "Release") + " /p:Platform=Win32 " + Solution ); if (!string.IsNullOrEmpty(error32)) { Program.PrintColorMessage("[ERROR] " + error32, ConsoleColor.Red); return(false); } if (Build64bit) { Program.PrintColorMessage("Building " + Path.GetFileNameWithoutExtension(Solution) + " (", ConsoleColor.Cyan, false); Program.PrintColorMessage("x64", ConsoleColor.Green, false); Program.PrintColorMessage(")...", ConsoleColor.Cyan); string error64 = Win32.ExecCommand( MSBuildExePath, "/m /nologo /verbosity:quiet /p:Configuration=" + (BuildDebug ? "Debug" : "Release") + " /p:Platform=x64 " + Solution ); if (!string.IsNullOrEmpty(error64)) { Program.PrintColorMessage("[ERROR] " + error64, ConsoleColor.Red); return(false); } } return(true); }
public static bool BuildKphSignatureFile() { if (!File.Exists(CustomSignToolPath)) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[SKIPPED] CustomSignTool not found."); Console.ForegroundColor = ConsoleColor.White; return(true); } if (!File.Exists("build\\kph.key")) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[SKIPPED] kph.key not found."); Console.ForegroundColor = ConsoleColor.White; return(true); } if (!File.Exists("bin\\Release32\\ProcessHacker.exe")) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[SKIPPED] Release32\\ProcessHacker.exe not found."); Console.ForegroundColor = ConsoleColor.White; return(true); } if (!File.Exists("bin\\Release64\\ProcessHacker.exe")) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[SKIPPED] Release64\\ProcessHacker.exe not found."); Console.ForegroundColor = ConsoleColor.White; return(true); } if (File.Exists("bin\\Debug32\\ProcessHacker.sig")) { File.Delete("bin\\Debug32\\ProcessHacker.sig"); } if (File.Exists("bin\\Debug64\\ProcessHacker.sig")) { File.Delete("bin\\Debug64\\ProcessHacker.sig"); } if (File.Exists("bin\\Release32\\ProcessHacker.sig")) { File.Delete("bin\\Release32\\ProcessHacker.sig"); } if (File.Exists("bin\\Release64\\ProcessHacker.sig")) { File.Delete("bin\\Release64\\ProcessHacker.sig"); } File.Create("bin\\Release32\\ProcessHacker.sig").Dispose(); File.Create("bin\\Release64\\ProcessHacker.sig").Dispose(); string output = Win32.ExecCommand(CustomSignToolPath, "sign -k build\\kph.key bin\\Debug32\\ProcessHacker.exe -s bin\\Debug32\\ProcessHacker.sig"); if (!string.IsNullOrEmpty(output)) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("[ERROR] (Debug32) " + output); Console.ForegroundColor = ConsoleColor.White; return(false); } output = Win32.ExecCommand(CustomSignToolPath, "sign -k build\\kph.key bin\\Debug64\\ProcessHacker.exe -s bin\\Debug64\\ProcessHacker.sig"); if (!string.IsNullOrEmpty(output)) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("[ERROR] (Debug64) " + output); Console.ForegroundColor = ConsoleColor.White; return(false); } output = Win32.ExecCommand(CustomSignToolPath, "sign -k build\\kph.key bin\\Release32\\ProcessHacker.exe -s bin\\Release32\\ProcessHacker.sig"); if (!string.IsNullOrEmpty(output)) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("[ERROR] (Release32) " + output); Console.ForegroundColor = ConsoleColor.White; return(false); } output = Win32.ExecCommand(CustomSignToolPath, "sign -k build\\kph.key bin\\Release64\\ProcessHacker.exe -s bin\\Release64\\ProcessHacker.sig"); if (!string.IsNullOrEmpty(output)) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("[ERROR] (Release64) " + output); Console.ForegroundColor = ConsoleColor.White; return(false); } return(true); }
public static bool AppveyorUploadBuildFiles() { string[] buildFileArray = { BuildOutputFolder + "\\processhacker-build-setup.exe", BuildOutputFolder + "\\processhacker-build-bin.zip", BuildOutputFolder + "\\processhacker-build-checksums.txt" }; string[] releaseFileArray = { BuildOutputFolder + "\\processhacker-" + BuildVersion + "-setup.exe", BuildOutputFolder + "\\processhacker-" + BuildVersion + "-bin.zip", BuildOutputFolder + "\\processhacker-" + BuildVersion + "-checksums.txt" }; if (!BuildNightly) { return(false); } for (int i = 0; i < releaseFileArray.Length; i++) { if (File.Exists(releaseFileArray[i])) { try { File.Delete(releaseFileArray[i]); } catch (Exception ex) { Program.PrintColorMessage("[WebServiceUploadBuild] " + ex, ConsoleColor.Red); return(false); } } } for (int i = 0; i < buildFileArray.Length; i++) { if (File.Exists(buildFileArray[i])) { try { File.Move(buildFileArray[i], releaseFileArray[i]); } catch (Exception ex) { Program.PrintColorMessage("[WebServiceUploadBuild] " + ex, ConsoleColor.Red); return(false); } } } for (int i = 0; i < releaseFileArray.Length; i++) { if (File.Exists(releaseFileArray[i])) { Console.WriteLine("Uploading " + releaseFileArray[i] + "..."); try { Win32.ExecCommand("appveyor", "PushArtifact " + releaseFileArray[i]); } catch (Exception ex) { Program.PrintColorMessage("[WebServicePushArtifact] " + ex, ConsoleColor.Red); return(false); } } } return(true); }
public static bool BuildKphSignatureFile(bool DebugBuild) { string output; Program.PrintColorMessage("Building KPH signature...", ConsoleColor.Cyan); if (!File.Exists(CustomSignToolPath)) { Program.PrintColorMessage("[SKIPPED] CustomSignTool not found.", ConsoleColor.Yellow); return(true); } if (!File.Exists("build\\kph.key")) { Program.PrintColorMessage("[SKIPPED] kph.key not found.", ConsoleColor.Yellow); return(true); } if (DebugBuild) { if (!File.Exists("bin\\Debug32\\ProcessHacker.exe")) { Program.PrintColorMessage("[SKIPPED] Debug32\\ProcessHacker.exe not found.", ConsoleColor.Yellow); return(true); } if (!File.Exists("bin\\Debug64\\ProcessHacker.exe")) { Program.PrintColorMessage("[SKIPPED] Debug64\\ProcessHacker.exe not found.", ConsoleColor.Yellow); return(true); } if (File.Exists("bin\\Debug32\\ProcessHacker.sig")) { File.Delete("bin\\Debug32\\ProcessHacker.sig"); } if (File.Exists("bin\\Debug64\\ProcessHacker.sig")) { File.Delete("bin\\Debug64\\ProcessHacker.sig"); } File.Create("bin\\Debug32\\ProcessHacker.sig").Dispose(); File.Create("bin\\Debug64\\ProcessHacker.sig").Dispose(); if (!string.IsNullOrEmpty(output = Win32.ExecCommand(CustomSignToolPath, "sign -k build\\kph.key bin\\Debug32\\ProcessHacker.exe -s bin\\Debug32\\ProcessHacker.sig"))) { Program.PrintColorMessage("[WARN] (Debug32) " + output, ConsoleColor.Yellow); return(false); } if (!string.IsNullOrEmpty(output = Win32.ExecCommand(CustomSignToolPath, "sign -k build\\kph.key bin\\Debug64\\ProcessHacker.exe -s bin\\Debug64\\ProcessHacker.sig"))) { Program.PrintColorMessage("[WARN] (Debug64) " + output, ConsoleColor.Yellow); return(false); } } else { if (!File.Exists("bin\\Release32\\ProcessHacker.exe")) { Program.PrintColorMessage("[SKIPPED] Release32\\ProcessHacker.exe not found.", ConsoleColor.Yellow); return(true); } if (!File.Exists("bin\\Release64\\ProcessHacker.exe")) { Program.PrintColorMessage("[SKIPPED] Release64\\ProcessHacker.exe not found.", ConsoleColor.Yellow); return(true); } if (File.Exists("bin\\Release32\\ProcessHacker.sig")) { File.Delete("bin\\Release32\\ProcessHacker.sig"); } if (File.Exists("bin\\Release64\\ProcessHacker.sig")) { File.Delete("bin\\Release64\\ProcessHacker.sig"); } File.Create("bin\\Release32\\ProcessHacker.sig").Dispose(); File.Create("bin\\Release64\\ProcessHacker.sig").Dispose(); if (!string.IsNullOrEmpty(output = Win32.ExecCommand(CustomSignToolPath, "sign -k build\\kph.key bin\\Release32\\ProcessHacker.exe -s bin\\Release32\\ProcessHacker.sig"))) { Program.PrintColorMessage("[ERROR] (Release32) " + output, ConsoleColor.Red); return(false); } if (!string.IsNullOrEmpty(output = Win32.ExecCommand(CustomSignToolPath, "sign -k build\\kph.key bin\\Release64\\ProcessHacker.exe -s bin\\Release64\\ProcessHacker.sig"))) { Program.PrintColorMessage("[ERROR] (Release64) " + output, ConsoleColor.Red); return(false); } } return(true); }