pub const LazyPath = union(@This().Tag) source_path: SourcePathrelative: Relativegenerated: GeneratedAn index into extra.
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577pub const LazyPath = union(@This().Tag) {
source_path: SourcePath,
relative: Relative,
generated: Generated,
pub const Tag = enum(u8) {
/// A source file path relative to build root.
source_path,
/// Relative to the directory indicated in flags.
relative,
/// Path is available only after it is populated by its owning step.
generated,
};
pub const Flags = packed struct(u32) {
tag: Tag,
_: u24 = 0,
};
/// An index into `extra`.
pub const Index = IndexType(@This());
/// An index into `extra`, or `null`.
pub const OptionalIndex = enum(u32) {
none = max_u32,
_,
pub fn unwrap(this: @This()) ?Index {
return switch (this) {
.none => null,
else => @fromBackingInt(@intCast(@backingInt(this))),
};
}
};
pub const SourcePath = struct {
flags: @This().Flags = .{},
owner: Package.Index,
sub_path: String,
pub const Flags = packed struct(u32) {
tag: Tag = .source_path,
_: u24 = 0,
};
};
pub const Generated = struct {
flags: @This().Flags = .{},
index: GeneratedFileIndex,
/// Applied after `up`.
sub_path: String = .empty,
pub const Flags = packed struct(u32) {
tag: Tag = .generated,
/// The number of parent directories to go up.
/// 0 means the generated file itself.
/// 1 means the directory of the generated file.
/// 2 means the parent of that directory, and so on.
up: u24 = 0,
};
};
pub const Relative = struct {
flags: @This().Flags,
sub_path: String,
pub const Flags = packed struct(u32) {
tag: Tag = .relative,
base: Base,
_: u16 = 0,
};
pub const Base = enum(u8) {
cwd,
local_cache,
global_cache,
/// Must not be used with Relative since package index is missing.
build_root,
zig_exe,
zig_lib,
install_prefix,
install_lib,
install_bin,
install_include,
};
};
}