structstd.Build.GeneratedFile[src]

A file that is generated by a build step. This struct is an interface that is meant to be used with @fieldParentPtr to implement the actual path logic.

Fields

step: *Step

The step that generates the file

path: ?[]const u8 = null

The path to the generated file. Must be either absolute or relative to the build root. This value must be set in the fn make() of the step and must not be null afterwards.

Functions

FunctiongetPath[src]

pub fn getPath(gen: GeneratedFile) []const u8

Parameters

Source Code

Source code
pub fn getPath(gen: GeneratedFile) []const u8 {
    return gen.step.owner.pathFromRoot(gen.path orelse std.debug.panic(
        "getPath() was called on a GeneratedFile that wasn't built yet. Is there a missing Step dependency on step '{s}'?",
        .{gen.step.name},
    ));
}

Source Code

Source code
pub const GeneratedFile = struct {
    /// The step that generates the file
    step: *Step,

    /// The path to the generated file. Must be either absolute or relative to the build root.
    /// This value must be set in the `fn make()` of the `step` and must not be `null` afterwards.
    path: ?[]const u8 = null,

    pub fn getPath(gen: GeneratedFile) []const u8 {
        return gen.step.owner.pathFromRoot(gen.path orelse std.debug.panic(
            "getPath() was called on a GeneratedFile that wasn't built yet. Is there a missing Step dependency on step '{s}'?",
            .{gen.step.name},
        ));
    }
}