Function addRunArtifact [src]
Creates a Step.Run with an executable built with addExecutable.
Add command line arguments with methods of Step.Run.
Prototype
pub fn addRunArtifact(b: *Build, exe: *Step.Compile) *Step.Run
Parameters
b: *Build
exe: *Step.Compile
Source
pub fn addRunArtifact(b: *Build, exe: *Step.Compile) *Step.Run {
// It doesn't have to be native. We catch that if you actually try to run it.
// Consider that this is declarative; the run step may not be run unless a user
// option is supplied.
// Avoid the common case of the step name looking like "run test test".
const step_name = if (exe.kind.isTest() and mem.eql(u8, exe.name, "test"))
b.fmt("run {s}", .{@tagName(exe.kind)})
else
b.fmt("run {s} {s}", .{ @tagName(exe.kind), exe.name });
const run_step = Step.Run.create(b, step_name);
run_step.producer = exe;
if (exe.kind == .@"test") {
if (exe.exec_cmd_args) |exec_cmd_args| {
for (exec_cmd_args) |cmd_arg| {
if (cmd_arg) |arg| {
run_step.addArg(arg);
} else {
run_step.addArtifactArg(exe);
}
}
} else {
run_step.addArtifactArg(exe);
}
const test_server_mode = if (exe.test_runner) |r| r.mode == .server else true;
if (test_server_mode) run_step.enableTestRunnerMode();
} else {
run_step.addArtifactArg(exe);
}
return run_step;
}