consolidate build products

This commit is contained in:
Johnny Shaw
2025-05-09 00:52:14 -05:00
parent b21397ddd4
commit c130e283f3
8 changed files with 87 additions and 209 deletions
+1
View File
@@ -266,6 +266,7 @@ typedef enum _PH_RELEASE_CHANNEL
PhPreviewChannel = 1, // unused, reserved
PhCanaryChannel = 2,
PhDeveloperChannel = 3,
PhInvalidChannel = ULONG_MAX,
} PH_RELEASE_CHANNEL, *PPH_RELEASE_CHANNEL;
PHAPPAPI
+1 -1
View File
@@ -75,7 +75,7 @@ typedef struct _PH_STARTUP_PARAMETERS
PPH_LIST PluginParameters;
PPH_STRING SelectTab;
PPH_STRING SysInfo;
ULONG UpdateChannel;
PH_RELEASE_CHANNEL UpdateChannel;
} PH_STARTUP_PARAMETERS, *PPH_STARTUP_PARAMETERS;
extern BOOLEAN PhPluginsEnabled;
+2 -2
View File
@@ -89,7 +89,7 @@ BOOLEAN PhInitializeTimerPolicy(
BOOLEAN PhPluginsEnabled = FALSE;
BOOLEAN PhPortableEnabled = FALSE;
PPH_STRING PhSettingsFileName = NULL;
PH_STARTUP_PARAMETERS PhStartupParameters = { 0 };
PH_STARTUP_PARAMETERS PhStartupParameters = { .UpdateChannel = PhInvalidChannel };
PH_PROVIDER_THREAD PhPrimaryProviderThread;
PH_PROVIDER_THREAD PhSecondaryProviderThread;
@@ -1202,7 +1202,7 @@ VOID PhpInitializeSettings(
PhSetIntegerSetting(L"SampleCount", sampleCount);
}
if (PhStartupParameters.UpdateChannel)
if (PhStartupParameters.UpdateChannel != PhInvalidChannel)
{
PhSetIntegerSetting(L"ReleaseChannel", PhStartupParameters.UpdateChannel);
}
+59 -166
View File
@@ -199,7 +199,7 @@ namespace CustomBuildTool
public static string BuildVersionBuild
{
get
get
{
// Extract the last two digits of the year. For example, if the year is 2023, (Year % 100) will result in 23.
var first = (TimeStart.Year % 100).ToString();
@@ -689,87 +689,25 @@ namespace CustomBuildTool
return true;
}
public static void CreateSettingsFile(string Channel, string Path)
{
StringBuilder stringBuilder = new StringBuilder(0x100);
stringBuilder.AppendLine("<settings>");
if (string.Equals(Channel, "release", StringComparison.OrdinalIgnoreCase))
{
stringBuilder.AppendLine("<setting name=\"ReleaseChannel\">0</setting>"); // PhReleaseChannel
}
else if (string.Equals(Channel, "preview", StringComparison.OrdinalIgnoreCase))
{
stringBuilder.AppendLine("<setting name=\"ReleaseChannel\">1</setting>"); // PhPreviewChannel
}
else if (string.Equals(Channel, "canary", StringComparison.OrdinalIgnoreCase))
{
stringBuilder.AppendLine("<setting name=\"ReleaseChannel\">2</setting>"); // PhCanaryChannel
}
else if (string.Equals(Channel, "developer", StringComparison.OrdinalIgnoreCase))
{
stringBuilder.AppendLine("<setting name=\"ReleaseChannel\">3</setting>"); // PhDeveloperChannel
}
else
{
throw new Exception($"Invalid channel: {Channel}");
}
stringBuilder.AppendLine("</settings>");
if (Directory.Exists(Path))
{
Win32.CreateEmptyFile($"{Path}\\SystemInformer.exe.settings.xml");
Utils.WriteAllText($"{Path}\\SystemInformer.exe.settings.xml", stringBuilder.ToString());
}
}
public static bool BuildBinZip(string Channel)
public static bool BuildBinZip()
{
Program.PrintColorMessage(BuildTimeSpan(), ConsoleColor.DarkGray, false);
Program.PrintColorMessage($"Building build-{Channel}-bin.zip... ", ConsoleColor.Cyan, false);
try
{
CreateSettingsFile(Channel, "bin\\Release32");
CreateSettingsFile(Channel, "bin\\Release64");
CreateSettingsFile(Channel, "bin\\ReleaseARM64");
}
catch (Exception ex)
{
Program.PrintColorMessage($"[WARN] {ex}", ConsoleColor.Yellow);
return false;
}
//try
//{
// if (Directory.Exists("bin\\Release32"))
// Win32.CreateEmptyFile("bin\\Release32\\usernotesdb.xml");
// if (Directory.Exists("bin\\Release64"))
// Win32.CreateEmptyFile("bin\\Release64\\usernotesdb.xml");
// if (Directory.Exists("bin\\ReleaseARM64"))
// Win32.CreateEmptyFile("bin\\ReleaseARM64\\usernotesdb.xml");
//}
//catch (Exception ex)
//{
// Program.PrintColorMessage($"[WARN] {ex}", ConsoleColor.Yellow);
//}
Program.PrintColorMessage($"Building build-bin.zip... ", ConsoleColor.Cyan, false);
try
{
Utils.CreateOutputDirectory();
Win32.DeleteFile(
$"{BuildOutputFolder}\\systeminformer-build-{Channel}-bin.zip"
$"{BuildOutputFolder}\\systeminformer-build-bin.zip"
);
Zip.CreateCompressedFolder(
"bin",
$"{BuildOutputFolder}\\systeminformer-build-{Channel}-bin.zip"
$"{BuildOutputFolder}\\systeminformer-build-bin.zip"
);
Program.PrintColorMessage(Win32.GetFileSize($"{BuildOutputFolder}\\systeminformer-build-{Channel}-bin.zip").ToPrettySize(), ConsoleColor.Green);
Program.PrintColorMessage(Win32.GetFileSize($"{BuildOutputFolder}\\systeminformer-build-bin.zip").ToPrettySize(), ConsoleColor.Green);
}
catch (Exception ex)
{
@@ -979,58 +917,45 @@ namespace CustomBuildTool
private struct BuildDeployInfo
{
public string BinFilename;
public string BinHash;
public string BinSig;
public ulong BinFileLength;
public string SetupFilename;
public string SetupHash;
public string SetupSig;
public ulong SetupFileLength;
public string Filename;
public string Hash;
public string Sig;
public ulong FileLength;
}
private static bool GetBuildDeployInfo(string Channel, out BuildDeployInfo Info)
{
Info = new BuildDeployInfo
{
BinFilename = $"{BuildOutputFolder}\\systeminformer-build-{Channel}-bin.zip",
SetupFilename = $"{BuildOutputFolder}\\systeminformer-build-{Channel}-setup.exe"
};
string channelKey;
Info = new BuildDeployInfo();
if (!Verify.CreateSigString(Channel, Info.BinFilename, out Info.BinSig))
if (string.IsNullOrEmpty(Channel))
{
Program.PrintColorMessage("failed to create bin signature string", ConsoleColor.Red);
// N.B. HACK we only produce a "release" (default setting) build for the binary (portable).
// Sign it using the "release" key. (jxy-s)
channelKey = "release";
Info.Filename = $"{BuildOutputFolder}\\systeminformer-build-bin.zip";
}
else
{
channelKey = Channel;
Info.Filename = $"{BuildOutputFolder}\\systeminformer-build-{Channel}-setup.exe";
}
if (!Verify.CreateSigString(channelKey, Info.Filename, out Info.Sig))
{
Program.PrintColorMessage("failed to create signature string", ConsoleColor.Red);
return false;
}
if (!Verify.CreateSigString(Channel, Info.SetupFilename, out Info.SetupSig))
if (File.Exists(Info.Filename))
{
Program.PrintColorMessage("failed to create setup signature string", ConsoleColor.Red);
return false;
Info.FileLength = Win32.GetFileSize(Info.Filename);
Info.Hash = Verify.HashFile(Info.Filename);
}
if (File.Exists(Info.BinFilename))
if (string.IsNullOrWhiteSpace(Info.Hash))
{
Info.BinFileLength = Win32.GetFileSize(Info.BinFilename);
Info.BinHash = Verify.HashFile(Info.BinFilename);
}
if (File.Exists(Info.SetupFilename))
{
Info.SetupFileLength = Win32.GetFileSize(Info.SetupFilename);
Info.SetupHash = Verify.HashFile(Info.SetupFilename);
}
if (string.IsNullOrWhiteSpace(Info.BinHash))
{
Program.PrintColorMessage("build-bin hash not found.", ConsoleColor.Red);
return false;
}
if (string.IsNullOrWhiteSpace(Info.SetupHash))
{
Program.PrintColorMessage("build-setup hash not found.", ConsoleColor.Red);
Program.PrintColorMessage("hash not found", ConsoleColor.Red);
return false;
}
@@ -1049,16 +974,6 @@ namespace CustomBuildTool
Program.PrintColorMessage("BUILD_BUILDID not found.", ConsoleColor.Red);
return false;
}
if (!Win32.GetEnvironmentVariable("BUILD_SF_API", out string buildPostSfUrl))
{
Program.PrintColorMessage("BUILD_SF_API not found.", ConsoleColor.Red);
return false;
}
if (!Win32.GetEnvironmentVariable("BUILD_SF_KEY", out string buildPostSfApiKey))
{
Program.PrintColorMessage("BUILD_SF_KEY not found.", ConsoleColor.Red);
return false;
}
if (!Win32.GetEnvironmentVariable("BUILD_CF_API", out string buildPostCfUrl))
{
Program.PrintColorMessage("BUILD_CF_API not found.", ConsoleColor.Red);
@@ -1070,6 +985,8 @@ namespace CustomBuildTool
return false;
}
if (!GetBuildDeployInfo(null, out BuildDeployInfo bin))
return false;
if (!GetBuildDeployInfo("release", out BuildDeployInfo release))
return false;
//if (!GetBuildDeployInfo("preview", out BuildDeployInfo preview))
@@ -1085,42 +1002,26 @@ namespace CustomBuildTool
return false;
}
if (!BuildUploadServerConfig(
buildBuildId,
buildPostSfUrl,
buildPostSfApiKey,
BuildUploadInfo.Item1,
BuildUploadInfo.Item2,
BuildUploadInfo.Item3,
BuildUploadInfo.Item4,
release,
canary
))
{
Program.PrintColorMessage("BuildUploadServerConfig-SF failed.", ConsoleColor.Red);
return false;
}
if (!BuildUploadServerConfig(
buildBuildId,
buildPostCfUrl,
buildPostCfApiKey,
BuildUploadInfo.Item1,
BuildUploadInfo.Item2,
BuildUploadInfo.Item3,
BuildUploadInfo.Item4,
BuildUploadInfo.Item1, // bin link
bin,
BuildUploadInfo.Item2, // canary setup link
release,
BuildUploadInfo.Item3, // release setup link
canary
))
{
Program.PrintColorMessage("BuildUploadServerConfig-CF failed.", ConsoleColor.Red);
Program.PrintColorMessage("BuildUploadServerConfig failed.", ConsoleColor.Red);
return false;
}
return true;
}
private static bool BuildUpdateGithubServer(out Tuple<string, string, string, string> BuildUploadInfo)
private static bool BuildUpdateGithubServer(out Tuple<string, string, string> BuildUploadInfo)
{
BuildUploadInfo = null;
@@ -1137,24 +1038,21 @@ namespace CustomBuildTool
return false;
}
string canaryBinlink = githubMirrorUpload.GetFileUrl($"systeminformer-{Build.BuildLongVersion}-canary-bin.zip");
string binLink = githubMirrorUpload.GetFileUrl($"systeminformer-{Build.BuildLongVersion}-bin.zip");
string canarySetuplink = githubMirrorUpload.GetFileUrl($"systeminformer-{Build.BuildLongVersion}-canary-setup.exe");
string releaseBinlink = githubMirrorUpload.GetFileUrl($"systeminformer-{Build.BuildLongVersion}-release-bin.zip");
string releaseSetuplink = githubMirrorUpload.GetFileUrl($"systeminformer-{Build.BuildLongVersion}-release-setup.exe");
if (string.IsNullOrWhiteSpace(canaryBinlink) ||
if (string.IsNullOrWhiteSpace(binLink) ||
string.IsNullOrWhiteSpace(canarySetuplink) ||
string.IsNullOrWhiteSpace(releaseBinlink) ||
string.IsNullOrWhiteSpace(releaseSetuplink))
{
Program.PrintColorMessage("build-github downloads not found.", ConsoleColor.Red);
return false;
}
BuildUploadInfo = new Tuple<string, string, string, string>(
canaryBinlink,
BuildUploadInfo = new Tuple<string, string, string>(
binLink,
canarySetuplink,
releaseBinlink,
releaseSetuplink
);
@@ -1246,11 +1144,11 @@ namespace CustomBuildTool
string BuildBuildId,
string BuildPostUrl,
string BuildPostKey,
string CanaryBinLink,
string BinLink,
BuildDeployInfo Bin,
string CanarySetupLink,
string ReleaseBinLink,
string ReleaseSetupLink,
BuildDeployInfo Release,
string ReleaseSetupLink,
BuildDeployInfo Canary
)
{
@@ -1262,9 +1160,8 @@ namespace CustomBuildTool
if (string.IsNullOrWhiteSpace(BuildBuildId) ||
string.IsNullOrWhiteSpace(BuildPostUrl) ||
string.IsNullOrWhiteSpace(BuildPostKey) ||
string.IsNullOrWhiteSpace(CanaryBinLink) ||
string.IsNullOrWhiteSpace(BinLink) ||
string.IsNullOrWhiteSpace(CanarySetupLink) ||
string.IsNullOrWhiteSpace(ReleaseBinLink) ||
string.IsNullOrWhiteSpace(ReleaseSetupLink))
{
Program.PrintColorMessage("BuildUpdateServerConfig invalid args.", ConsoleColor.Red);
@@ -1280,22 +1177,18 @@ namespace CustomBuildTool
BuildVersion = Build.BuildLongVersion,
BuildCommit = Build.BuildCommitHash,
BuildId = BuildBuildId,
BinUrl = CanaryBinLink,
BinLength = Canary.BinFileLength.ToString(),
BinHash = Canary.BinHash,
BinSig = Canary.BinSig,
SetupUrl = CanarySetupLink,
SetupLength = Canary.SetupFileLength.ToString(),
SetupHash = Canary.SetupHash,
SetupSig = Canary.SetupSig,
ReleaseBinUrl = ReleaseBinLink,
ReleaseBinLength = Release.BinFileLength.ToString(),
ReleaseBinHash = Release.BinHash,
ReleaseBinSig = Release.BinSig,
BinUrl = BinLink,
BinLength = Bin.FileLength.ToString(),
BinHash = Bin.Hash,
BinSig = Bin.Sig,
CanarySetupUrl = CanarySetupLink,
CanarySetupLength = Canary.FileLength.ToString(),
CanarySetupHash = Canary.Hash,
CanarySetupSig = Canary.Sig,
ReleaseSetupUrl = ReleaseSetupLink,
ReleaseSetupLength = Release.SetupFileLength.ToString(),
ReleaseSetupHash = Release.SetupHash,
ReleaseSetupSig = Release.SetupSig,
ReleaseSetupLength = Release.FileLength.ToString(),
ReleaseSetupHash = Release.Hash,
ReleaseSetupSig = Release.Sig,
};
byte[] buildPostString = JsonSerializer.SerializeToUtf8Bytes(buildUpdateRequest, BuildUpdateRequestContext.Default.BuildUpdateRequest);
+15 -20
View File
@@ -163,12 +163,8 @@ namespace CustomBuildTool
Environment.Exit(1);
if (!Build.CopyTextFiles(BuildFlags.Release))
Environment.Exit(1);
foreach (var (channel, _) in BuildConfig.Build_Channels)
{
if (!Build.BuildBinZip(channel))
Environment.Exit(1);
}
if (!Build.BuildBinZip())
Environment.Exit(1);
Build.ShowBuildStats();
}
@@ -211,11 +207,11 @@ namespace CustomBuildTool
Environment.Exit(1);
if (!Build.CopyTextFiles(BuildFlags.Release))
Environment.Exit(1);
if (!Build.BuildBinZip())
Environment.Exit(1);
foreach (var (channel, _) in BuildConfig.Build_Channels)
{
if (!Build.BuildBinZip(channel))
Environment.Exit(1);
if (!Build.BuildSetupExe(channel))
Environment.Exit(1);
}
@@ -273,11 +269,11 @@ namespace CustomBuildTool
Environment.Exit(1);
if (!Build.CopyTextFiles(BuildFlags.Release))
Environment.Exit(1);
if (!Build.BuildBinZip())
Environment.Exit(1);
foreach (var (channel, _) in BuildConfig.Build_Channels)
{
if (!Build.BuildBinZip(channel))
Environment.Exit(1);
if (!Build.BuildSetupExe(channel))
Environment.Exit(1);
}
@@ -361,15 +357,10 @@ namespace CustomBuildTool
if (!Build.BuildSolution("SystemInformer.sln", BuildFlags.Release) ||
!Build.BuildSolution("plugins\\Plugins.sln", BuildFlags.Release) ||
!Build.CopyDebugEngineFiles(BuildFlags.Release) ||
!Build.CopyTextFiles(BuildFlags.Release))
!Build.CopyTextFiles(BuildFlags.Release) ||
!Build.BuildBinZip())
Environment.Exit(1);
foreach (var (channel, _) in BuildConfig.Build_Channels)
{
if (!Build.BuildBinZip(channel))
Environment.Exit(1);
}
Build.ShowBuildStats();
return true;
}
@@ -399,12 +390,13 @@ namespace CustomBuildTool
if (!Build.ResignFiles() ||
!Build.CopyDebugEngineFiles(BuildFlags.Release) ||
!Build.CopyTextFiles(BuildFlags.Release))
!Build.CopyTextFiles(BuildFlags.Release) ||
!Build.BuildBinZip())
Environment.Exit(1);
foreach (var (channel, _) in BuildConfig.Build_Channels)
{
if (!Build.BuildBinZip(channel) || !Build.BuildSetupExe(channel))
if (!Build.BuildSetupExe(channel))
Environment.Exit(1);
}
@@ -450,9 +442,12 @@ namespace CustomBuildTool
ExecuteBuildSteps(BuildFlags.Release, Build.CopyDebugEngineFiles, Build.CopyWow64Files, Build.CopyTextFiles);
if (!!Build.BuildBinZip())
Environment.Exit(1);
foreach (var (channel, _) in BuildConfig.Build_Channels)
{
if (!Build.BuildBinZip(channel) || !Build.BuildSetupExe(channel))
if (!Build.BuildSetupExe(channel))
Environment.Exit(1);
}
+4 -9
View File
@@ -763,15 +763,10 @@ namespace CustomBuildTool
[JsonPropertyName("bin_hash")] public string BinHash { get; init; }
[JsonPropertyName("bin_sig")] public string BinSig { get; init; }
[JsonPropertyName("setup_url")] public string SetupUrl { get; init; }
[JsonPropertyName("setup_length")] public string SetupLength { get; init; }
[JsonPropertyName("setup_hash")] public string SetupHash { get; init; }
[JsonPropertyName("setup_sig")] public string SetupSig { get; init; }
[JsonPropertyName("release_bin_url")] public string ReleaseBinUrl { get; init; }
[JsonPropertyName("release_bin_length")] public string ReleaseBinLength { get; init; }
[JsonPropertyName("release_bin_hash")] public string ReleaseBinHash { get; init; }
[JsonPropertyName("release_bin_sig")] public string ReleaseBinSig { get; init; }
[JsonPropertyName("canary_setup_url")] public string CanarySetupUrl { get; init; }
[JsonPropertyName("canary_setup_length")] public string CanarySetupLength { get; init; }
[JsonPropertyName("canary_setup_hash")] public string CanarySetupHash { get; init; }
[JsonPropertyName("canary_setup_sig")] public string CanarySetupSig { get; init; }
[JsonPropertyName("release_setup_url")] public string ReleaseSetupUrl { get; init; }
[JsonPropertyName("release_setup_length")] public string ReleaseSetupLength { get; init; }
+4
View File
@@ -11,6 +11,10 @@
#include "setup.h"
#if defined(_DEBUG) && !defined(PH_RELEASE_CHANNEL_ID)
#define PH_RELEASE_CHANNEL_ID 2
#endif
#ifdef PH_RELEASE_CHANNEL_ID
#if PH_RELEASE_CHANNEL_ID == 0
#define SETUP_APP_PARAMETERS L"-channel release"
+1 -11
View File
@@ -51,17 +51,7 @@ END
//
// RCDATA
//
#ifdef PH_RELEASE_CHANNEL_ID
#if PH_RELEASE_CHANNEL_ID == 0
IDR_BIN_DATA RCDATA "../../build/output/systeminformer-build-release-bin.zip"
#elif PH_RELEASE_CHANNEL_ID == 1
IDR_BIN_DATA RCDATA "../../build/output/systeminformer-build-preview-bin.zip"
#elif PH_RELEASE_CHANNEL_ID == 2
IDR_BIN_DATA RCDATA "../../build/output/systeminformer-build-canary-bin.zip"
#elif PH_RELEASE_CHANNEL_ID == 3
IDR_BIN_DATA RCDATA "../../build/output/systeminformer-build-developer-bin.zip"
#endif
#endif
IDR_BIN_DATA RCDATA "../../build/output/systeminformer-build-bin.zip"
/////////////////////////////////////////////////////////////////////////////
//