authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-12-28 19:53:42-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-12-28 19:53:42-08:00
log744e22b18afe0113ff79f0305eecaa3427b57db6
tree4d3c5e0578cca31eedbff95cd4e6ea5f55bc6442
parent8d4a9119b80fd263ce4c8b5745b88953914acdb9

build_runner: re-order the help menu

closes #30615

1 files changed, 50 insertions(+), 53 deletions(-)

lib/compiler/build_runner.zig+50-53
...@@ -1537,6 +1537,8 @@ fn printSteps(builder: *std.Build, w: *Writer) !void {...@@ -1537,6 +1537,8 @@ fn printSteps(builder: *std.Build, w: *Writer) !void {
1537}1537}
15381538
1539fn printUsage(b: *std.Build, w: *Writer) !void {1539fn printUsage(b: *std.Build, w: *Writer) !void {
1540 const arena = b.graph.arena;
1541
1540 try w.print(1542 try w.print(
1541 \\Usage: {s} build [steps] [options]1543 \\Usage: {s} build [steps] [options]
1542 \\1544 \\
...@@ -1544,6 +1546,54 @@ fn printUsage(b: *std.Build, w: *Writer) !void {...@@ -1544,6 +1546,54 @@ fn printUsage(b: *std.Build, w: *Writer) !void {
1544 \\1546 \\
1545 , .{b.graph.zig_exe});1547 , .{b.graph.zig_exe});
1546 try printSteps(b, w);1548 try printSteps(b, w);
1549 try w.writeAll(
1550 \\
1551 \\Project-Specific Options:
1552 \\
1553 );
1554
1555 if (b.available_options_list.items.len == 0) {
1556 try w.print(" (none)\n", .{});
1557 } else {
1558 for (b.available_options_list.items) |option| {
1559 const name = try fmt.allocPrint(arena, " -D{s}=[{t}]", .{ option.name, option.type_id });
1560 try w.print("{s:<30} {s}\n", .{ name, option.description });
1561 if (option.enum_options) |enum_options| {
1562 const padding = " " ** 33;
1563 try w.writeAll(padding ++ "Supported Values:\n");
1564 for (enum_options) |enum_option| {
1565 try w.print(padding ++ " {s}\n", .{enum_option});
1566 }
1567 }
1568 }
1569 }
1570
1571 try w.writeAll(
1572 \\
1573 \\System Integration Options:
1574 \\ --search-prefix [path] Add a path to look for binaries, libraries, headers
1575 \\ --sysroot [path] Set the system root directory (usually /)
1576 \\ --libc [file] Provide a file which specifies libc paths
1577 \\
1578 \\ --system [pkgdir] Disable package fetching; enable all integrations
1579 \\ -fsys=[name] Enable a system integration
1580 \\ -fno-sys=[name] Disable a system integration
1581 \\
1582 \\ Available System Integrations: Enabled:
1583 \\
1584 );
1585 if (b.graph.system_library_options.entries.len == 0) {
1586 try w.writeAll(" (none) -\n");
1587 } else {
1588 for (b.graph.system_library_options.keys(), b.graph.system_library_options.values()) |k, v| {
1589 const status = switch (v) {
1590 .declared_enabled => "yes",
1591 .declared_disabled => "no",
1592 .user_enabled, .user_disabled => unreachable, // already emitted error
1593 };
1594 try w.print(" {s:<43} {s}\n", .{ k, status });
1595 }
1596 }
15471597
1548 try w.writeAll(1598 try w.writeAll(
1549 \\1599 \\
...@@ -1611,59 +1661,6 @@ fn printUsage(b: *std.Build, w: *Writer) !void {...@@ -1611,59 +1661,6 @@ fn printUsage(b: *std.Build, w: *Writer) !void {
1611 \\ compilation time of Zig source code (implies '--webui')1661 \\ compilation time of Zig source code (implies '--webui')
1612 \\ -fincremental Enable incremental compilation1662 \\ -fincremental Enable incremental compilation
1613 \\ -fno-incremental Disable incremental compilation1663 \\ -fno-incremental Disable incremental compilation
1614 \\
1615 \\Project-Specific Options:
1616 \\
1617 );
1618
1619 const arena = b.graph.arena;
1620 if (b.available_options_list.items.len == 0) {
1621 try w.print(" (none)\n", .{});
1622 } else {
1623 for (b.available_options_list.items) |option| {
1624 const name = try fmt.allocPrint(arena, " -D{s}=[{s}]", .{
1625 option.name,
1626 @tagName(option.type_id),
1627 });
1628 try w.print("{s:<30} {s}\n", .{ name, option.description });
1629 if (option.enum_options) |enum_options| {
1630 const padding = " " ** 33;
1631 try w.writeAll(padding ++ "Supported Values:\n");
1632 for (enum_options) |enum_option| {
1633 try w.print(padding ++ " {s}\n", .{enum_option});
1634 }
1635 }
1636 }
1637 }
1638
1639 try w.writeAll(
1640 \\
1641 \\System Integration Options:
1642 \\ --search-prefix [path] Add a path to look for binaries, libraries, headers
1643 \\ --sysroot [path] Set the system root directory (usually /)
1644 \\ --libc [file] Provide a file which specifies libc paths
1645 \\
1646 \\ --system [pkgdir] Disable package fetching; enable all integrations
1647 \\ -fsys=[name] Enable a system integration
1648 \\ -fno-sys=[name] Disable a system integration
1649 \\
1650 \\ Available System Integrations: Enabled:
1651 \\
1652 );
1653 if (b.graph.system_library_options.entries.len == 0) {
1654 try w.writeAll(" (none) -\n");
1655 } else {
1656 for (b.graph.system_library_options.keys(), b.graph.system_library_options.values()) |k, v| {
1657 const status = switch (v) {
1658 .declared_enabled => "yes",
1659 .declared_disabled => "no",
1660 .user_enabled, .user_disabled => unreachable, // already emitted error
1661 };
1662 try w.print(" {s:<43} {s}\n", .{ k, status });
1663 }
1664 }
1665
1666 try w.writeAll(
1667 \\1664 \\
1668 \\Advanced Options:1665 \\Advanced Options:
1669 \\ -freference-trace[=num] How many lines of reference trace should be shown per compile error1666 \\ -freference-trace[=num] How many lines of reference trace should be shown per compile error