如果文件未通过某些检查,则使构建步骤失败。
字段
step: Step
file: std.Build.LazyPath
expected_matches: []const Configuration.Bytes
expected_exact: ?Configuration.Bytes
max_bytes: ?u32
std.Build.Step.CheckFile.base_tag
常量
Step.Tag
std.Build.Step.CheckFile.CheckFile
别名
std.Build.Step.CheckFile.Configuration
别名
std.Build.Step.CheckFile.create
函数
pub fn create(owner: *std.Build, file: std.Build.LazyPath, options: Options) *CheckFile
参数
std.Build.Step.CheckFile.fs
别名
别名目标 std.fs
std.Build.Step.CheckFile.Io
别名
别名目标 std.Io
std.Build.Step.CheckFile.mem
别名
别名目标 std.mem
std.Build.Step.CheckFile.Options
容器
字段
expected_matches: []const []const u8 = &.{}
expected_exact: ?[]const u8 = null
max_bytes: ?u32 = null
std.Build.Step.CheckFile.setName
函数
pub fn setName(check_file: *CheckFile, name: []const u8) void
参数
check_file: *CheckFile
name: []const u8
std.Build.Step.CheckFile.std
别名
别名目标 std
std.Build.Step.CheckFile.Step
别名
别名目标 std.Build.Step
源码
std/Build/Step/CheckFile.zig
//! 如果文件未通过某些检查,则使构建步骤失败。
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 = check_file.step.owner.graph.dupeString(name);
}