Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Struct

CheckFile

Public Struct

Fail the build step if a file does not match certain checks.

Fields

step: Step
file: std.Build.LazyPath
expected_matches: []const Configuration.Bytes
expected_exact: ?Configuration.Bytes
max_bytes: ?u32

Namespaces

Structs

Values

Functions

pub fn create(owner: *std.Build, file: std.Build.LazyPath, options: Options) *CheckFile
pub fn setName(check_file: *CheckFile, name: []const u8) void

File

Build/Step/CheckFile.zig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! Fail the build step if a file does not match certain checks.
const CheckFile = @This();

const std = @import("std");
const Io = std.Io;
const Step = std.Build.Step;
const fs = std.fs;
const mem = std.mem;
const Configuration = std.Build.Configuration;

step: Step,
file: std.Build.LazyPath,
expected_matches: []const Configuration.Bytes,
expected_exact: ?Configuration.Bytes,
max_bytes: ?u32,

pub const base_tag: Step.Tag = .check_file;

pub const Options = struct {
    expected_matches: []const []const u8 = &.{},
    expected_exact: ?[]const u8 = null,
    max_bytes: ?u32 = null,
};

pub fn create(owner: *std.Build, file: std.Build.LazyPath, options: Options) *CheckFile {
    const graph = owner.graph;
    const check_file = graph.create(CheckFile);
    check_file.* = .{
        .step = .init(.{
            .tag = base_tag,
            .name = "CheckFile",
            .owner = owner,
        }),
        .file = file.dupe(graph),
        .expected_matches = graph.addBytesList(options.expected_matches),
        .expected_exact = if (options.expected_exact) |b| graph.addBytes(b) else null,
        .max_bytes = options.max_bytes,
    };
    file.addStepDependencies(&check_file.step);
    return check_file;
}

pub fn setName(check_file: *CheckFile, name: []const u8) void {
    check_file.step.name = name;
}