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

InstallDir

Public Struct

Fields

step: Step
options: Options

Namespaces

Structs

Values

Functions

pub fn create(owner: *std.Build, options: Options) *InstallDir

File

Build/Step/InstallDir.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
47
48
49
50
51
52
53
54
55
56
57
58
const InstallDir = @This();

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

step: Step,
options: Options,

pub const base_tag: Step.Tag = .install_dir;

pub const Options = struct {
    source_dir: LazyPath,
    install_dir: std.Build.InstallDir,
    install_subdir: []const u8,
    /// File paths which end in any of these suffixes will be excluded
    /// from being installed.
    exclude_extensions: []const []const u8 = &.{},
    /// Only file paths which end in any of these suffixes will be included
    /// in installation. `null` means all suffixes are valid for this option.
    /// `exclude_extensions` take precedence over `include_extensions`
    include_extensions: ?[]const []const u8 = null,
    /// File paths which end in any of these suffixes will result in
    /// empty files being installed. This is mainly intended for large
    /// test.zig files in order to prevent needless installation bloat.
    /// However if the files were not present at all, then
    /// `@import("test.zig")` would be a compile error.
    blank_extensions: []const []const u8 = &.{},

    fn dupe(opts: Options, graph: *const std.Build.Graph) Options {
        return .{
            .source_dir = opts.source_dir.dupe(graph),
            .install_dir = opts.install_dir.dupe(graph),
            .install_subdir = graph.dupeString(opts.install_subdir),
            .exclude_extensions = graph.dupeStrings(opts.exclude_extensions),
            .include_extensions = if (opts.include_extensions) |incs| graph.dupeStrings(incs) else null,
            .blank_extensions = graph.dupeStrings(opts.blank_extensions),
        };
    }
};

pub fn create(owner: *std.Build, options: Options) *InstallDir {
    const install_dir = owner.allocator.create(InstallDir) catch @panic("OOM");
    const graph = owner.graph;
    install_dir.* = .{
        .step = Step.init(.{
            .tag = base_tag,
            .name = owner.fmt("install {f}/", .{options.source_dir}),
            .owner = owner,
        }),
        .options = options.dupe(graph),
    };
    options.source_dir.addStepDependencies(&install_dir.step);
    return install_dir;
}