structstd.Build.Dependency[src]

Fields

builder: *Build

Functions

Functionartifact[src]

pub fn artifact(d: *Dependency, name: []const u8) *Step.Compile

Parameters

name: []const u8

Source Code

Source code
pub fn artifact(d: *Dependency, name: []const u8) *Step.Compile {
    var found: ?*Step.Compile = null;
    for (d.builder.install_tls.step.dependencies.items) |dep_step| {
        const inst = dep_step.cast(Step.InstallArtifact) orelse continue;
        if (mem.eql(u8, inst.artifact.name, name)) {
            if (found != null) panic("artifact name '{s}' is ambiguous", .{name});
            found = inst.artifact;
        }
    }
    return found orelse {
        for (d.builder.install_tls.step.dependencies.items) |dep_step| {
            const inst = dep_step.cast(Step.InstallArtifact) orelse continue;
            log.info("available artifact: '{s}'", .{inst.artifact.name});
        }
        panic("unable to find artifact '{s}'", .{name});
    };
}

Functionmodule[src]

pub fn module(d: *Dependency, name: []const u8) *Module

Parameters

name: []const u8

Source Code

Source code
pub fn module(d: *Dependency, name: []const u8) *Module {
    return d.builder.modules.get(name) orelse {
        panic("unable to find module '{s}'", .{name});
    };
}

FunctionnamedWriteFiles[src]

pub fn namedWriteFiles(d: *Dependency, name: []const u8) *Step.WriteFile

Parameters

name: []const u8

Source Code

Source code
pub fn namedWriteFiles(d: *Dependency, name: []const u8) *Step.WriteFile {
    return d.builder.named_writefiles.get(name) orelse {
        panic("unable to find named writefiles '{s}'", .{name});
    };
}

FunctionnamedLazyPath[src]

pub fn namedLazyPath(d: *Dependency, name: []const u8) LazyPath

Parameters

name: []const u8

Source Code

Source code
pub fn namedLazyPath(d: *Dependency, name: []const u8) LazyPath {
    return d.builder.named_lazy_paths.get(name) orelse {
        panic("unable to find named lazypath '{s}'", .{name});
    };
}

Functionpath[src]

pub fn path(d: *Dependency, sub_path: []const u8) LazyPath

Parameters

sub_path: []const u8

Source Code

Source code
pub fn path(d: *Dependency, sub_path: []const u8) LazyPath {
    return .{
        .dependency = .{
            .dependency = d,
            .sub_path = sub_path,
        },
    };
}

Source Code

Source code
pub const Dependency = struct {
    builder: *Build,

    pub fn artifact(d: *Dependency, name: []const u8) *Step.Compile {
        var found: ?*Step.Compile = null;
        for (d.builder.install_tls.step.dependencies.items) |dep_step| {
            const inst = dep_step.cast(Step.InstallArtifact) orelse continue;
            if (mem.eql(u8, inst.artifact.name, name)) {
                if (found != null) panic("artifact name '{s}' is ambiguous", .{name});
                found = inst.artifact;
            }
        }
        return found orelse {
            for (d.builder.install_tls.step.dependencies.items) |dep_step| {
                const inst = dep_step.cast(Step.InstallArtifact) orelse continue;
                log.info("available artifact: '{s}'", .{inst.artifact.name});
            }
            panic("unable to find artifact '{s}'", .{name});
        };
    }

    pub fn module(d: *Dependency, name: []const u8) *Module {
        return d.builder.modules.get(name) orelse {
            panic("unable to find module '{s}'", .{name});
        };
    }

    pub fn namedWriteFiles(d: *Dependency, name: []const u8) *Step.WriteFile {
        return d.builder.named_writefiles.get(name) orelse {
            panic("unable to find named writefiles '{s}'", .{name});
        };
    }

    pub fn namedLazyPath(d: *Dependency, name: []const u8) LazyPath {
        return d.builder.named_lazy_paths.get(name) orelse {
            panic("unable to find named lazypath '{s}'", .{name});
        };
    }

    pub fn path(d: *Dependency, sub_path: []const u8) LazyPath {
        return .{
            .dependency = .{
                .dependency = d,
                .sub_path = sub_path,
            },
        };
    }
}