1const FindProgram = @This();
2
3const std = @import("std");
4const Step = std.Build.Step;
5const Configuration = std.Build.Configuration;
6
7step: Step,
8found_path: Configuration.GeneratedFileIndex,
9names: Configuration.StringList,
10
11pub const base_tag: Step.Tag = .find_program;
12
13pub const Options = struct {
14 names: []const []const u8,
15};
16
17pub fn create(owner: *std.Build, options: Options) *FindProgram {
18 const graph = owner.graph;
19 const wc = &graph.wip_configuration;
20 const fp = graph.create(FindProgram);
21 fp.* = .{
22 .step = .init(.{
23 .tag = base_tag,
24 .name = owner.fmt("find program {s} ({d} candidates)", .{ options.names[0], options.names.len }),
25 .owner = owner,
26 }),
27 .found_path = graph.addGeneratedFile(&fp.step),
28 .names = wc.addStringList(options.names) catch @panic("OOM"),
29 };
30 return fp;
31}