Add server install verification steps
This commit is contained in:
@@ -71,12 +71,8 @@ pub fn build(b: *std.Build) void {
|
||||
.root_module = profileModule(b, target, optimize, profile),
|
||||
});
|
||||
b.installArtifact(profile_exe);
|
||||
const run_profile = b.addRunArtifact(profile_exe);
|
||||
run_profile.step.dependOn(b.getInstallStep());
|
||||
if (b.args) |args| run_profile.addArgs(args);
|
||||
const step_name = if (std.mem.eql(u8, profile.exe_name, "mim-min")) "run-min" else if (std.mem.eql(u8, profile.exe_name, "mim-code")) "run-code" else "run-full";
|
||||
const run_profile_step = b.step(step_name, "Run profile variant");
|
||||
run_profile_step.dependOn(&run_profile.step);
|
||||
addRunProfileStep(b, profile, profile_exe);
|
||||
addServerInstallSteps(b, profile, profile_exe);
|
||||
}
|
||||
|
||||
const run_cmd = b.addRunArtifact(exe);
|
||||
@@ -95,6 +91,31 @@ pub fn build(b: *std.Build) void {
|
||||
test_step.dependOn(&test_cmd.step);
|
||||
}
|
||||
|
||||
fn addRunProfileStep(b: *std.Build, profile: Profile, exe: *std.Build.Step.Compile) void {
|
||||
const run_profile = b.addRunArtifact(exe);
|
||||
run_profile.step.dependOn(b.getInstallStep());
|
||||
if (b.args) |args| run_profile.addArgs(args);
|
||||
const step_name = if (std.mem.eql(u8, profile.exe_name, "mim-min")) "run-min" else if (std.mem.eql(u8, profile.exe_name, "mim-code")) "run-code" else "run-full";
|
||||
const run_profile_step = b.step(step_name, "Run profile variant");
|
||||
run_profile_step.dependOn(&run_profile.step);
|
||||
}
|
||||
|
||||
fn addServerInstallSteps(b: *std.Build, profile: Profile, exe: *std.Build.Step.Compile) void {
|
||||
const suffix = if (std.mem.eql(u8, profile.exe_name, "mim-min")) "min" else if (std.mem.eql(u8, profile.exe_name, "mim-code")) "code" else "full";
|
||||
const install_name = b.fmt("install-{s}", .{suffix});
|
||||
const verify_name = b.fmt("verify-install-{s}", .{suffix});
|
||||
|
||||
const install_file = b.addInstallBinFile(exe.getEmittedBin(), "mim");
|
||||
const install_step = b.step(install_name, "Install selected profile binary as bin/mim");
|
||||
install_step.dependOn(&install_file.step);
|
||||
|
||||
const installed_path = b.getInstallPath(.bin, "mim");
|
||||
const verify_cmd = b.addSystemCommand(&.{ installed_path, "--version" });
|
||||
verify_cmd.step.dependOn(&install_file.step);
|
||||
const verify_step = b.step(verify_name, "Verify installed selected profile binary");
|
||||
verify_step.dependOn(&verify_cmd.step);
|
||||
}
|
||||
|
||||
fn profileModule(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode, profile: Profile) *std.Build.Module {
|
||||
const options = b.addOptions();
|
||||
options.addOption([]const u8, "active_profile", profile.name);
|
||||
|
||||
Reference in New Issue
Block a user