From b22fa2638bca470bbd8c5ea4768eb0eaaa3e8195 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 6 Nov 2026 19:14:11 -0300 Subject: Build: a word that prints this build into a +Build pane (SPC h b): the version line, the commit, the jj change and the build time (stamped as the commit is: release builds and the ~/.local install, else "not stamped"), the zig that built it, its mode, target, platform and grammars, whether the addons are compiled in, the wire's semantics hash and the dependencies; build.zig stamps the change (jj log -r git_head()) and the time (date -u) through one command helper beside gitCommit; a T1 case reads the pane Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/CHANGELOG.md | 4 ++++ src/Output.zig | 27 +++++++++++++++++++++++++++ src/builtins.zig | 13 ++++++++++++- src/config.zig | 6 ++++-- 4 files changed, 47 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/CHANGELOG.md b/src/CHANGELOG.md index a6922a07..b5568686 100644 --- a/src/CHANGELOG.md +++ b/src/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +- `Build` prints this build into a `+Build` pane: version, commit, jj change + and build time (stamped builds), the zig, mode, target, platform, grammars, + whether the addons are compiled in, and the dependencies. + - Addons speak ABI 3 (2.x ones are refused): a kind's state is stepped once by `tick`, which now also gives the tag's prefix, however many views show it; each view (a window, a terminal) is told to the kind by diff --git a/src/Output.zig b/src/Output.zig index 384bb500..c719f909 100644 --- a/src/Output.zig +++ b/src/Output.zig @@ -1029,6 +1029,33 @@ pub fn openMessages(p: *Pardes, id: usize) !void { /// The version banner plus the embedded CHANGELOG, so an installed binary can /// say what it is and what changed without a repository beside it. +/// The `Build` word's pane: what this binary is, one fact a line. +pub fn openBuild(p: *Pardes, id: usize) !void { + const builtin = @import("builtin"); + var out: std.Io.Writer.Allocating = .init(p.gpa); + errdefer out.deinit(); + const w = &out.writer; + try w.print("{s}\n", .{@import("upgrade.zig").version_line}); + try w.print("commit {s}\nchange {s}\nbuilt {s}\n", .{ + build_options.commit orelse "not stamped (a Debug build with -Dplatform or --prefix)", + build_options.change orelse "not stamped", + build_options.built orelse "not stamped", + }); + try w.print("zig {s}\nmode {s}\ntarget {s}-{s}-{s}\nplatform {s}\n", .{ + builtin.zig_version_string, @tagName(builtin.mode), + @tagName(builtin.cpu.arch), @tagName(builtin.os.tag), + @tagName(builtin.abi), @tagName(build_options.platform), + }); + try w.print("grammars {s}\naddons {s}\nsemantics {x:0>16}\n\ndependencies\n{s}", .{ + if (build_options.syntax_full_grammars) "full" else if (build_options.syntax_minimal_grammars) "minimal" else "none", + if (@import("builtin_addons").on) "compiled in" else "loaded from /lib/pardes/addons", + @import("wire.zig").semantics, + build_options.deps, + }); + const content = try out.toOwnedSlice(); + return openRead(p, id, .{ .cmd = .Build }, "", content); +} + pub fn openChangelog(p: *Pardes, id: usize) !void { var out: std.Io.Writer.Allocating = .init(p.gpa); errdefer out.deinit(); diff --git a/src/builtins.zig b/src/builtins.zig index 4712a67a..15319d6e 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -108,7 +108,6 @@ fn isEnabled(comptime T: type) bool { return !@hasDecl(T, "enabled") or T.enabled; } - /// Why `word`, a builtin some build has, is none in this one: `GUI-only` /// for the GUI's own (`gui_only`), else `not in this build`; null for a /// word that is one here, or in no build. @@ -1618,6 +1617,18 @@ pub const Messages = struct { } }; +/// This build: its version, commit, jj change and build time (a stamped +/// build's: a release or the ~/.local install), the zig that built it, its +/// optimize mode, target, platform, grammars, whether the addons are compiled +/// in, and its dependencies, printed into an output buffer. +pub const Build = struct { + pub const scope: Scope = .session; + pub const output: OutputTraits = .{ .name = config.build_buffer }; + pub fn run(c: Ctx) void { + panes.Output.openBuild(c.p, c.id) catch |err| c.p.reportError(c.id, "build", err); + } +}; + /// This build's version and what changed to reach it, printed into an output /// buffer the same way Config prints the live settings. pub const Changelog = struct { diff --git a/src/config.zig b/src/config.zig index 98dd1ae3..a2aed287 100644 --- a/src/config.zig +++ b/src/config.zig @@ -109,6 +109,7 @@ pub const leader_path = paths: { .LocationsConfig = null, .Tutor = "ht", .Changelog = "hc", + .Build = "hb", .Messages = "hm", .Newcol = "cn", .Delcol = "cd", @@ -496,6 +497,7 @@ pub const diff_buffer = "+Diff"; pub const hover_buffer = "+Hover"; pub const lsp_buffer = "+Lsp"; pub const changelog_buffer = "+Changelog"; +pub const build_buffer = "+Build"; pub const messages_buffer = "+Messages"; pub const scratch_buffer = "+New"; pub const errors_buffer = "+Errors"; @@ -1247,8 +1249,8 @@ pub const Runtime = struct { const values = [_][2][]const u8{ .{ "TaglineSize", "73" }, .{ "WindowOpacity", "85" }, .{ "MessageLinger", "1500" }, .{ "DumpDir", "~/dumps" }, - .{ "GripWidth", "200" }, .{ "InactiveDim", "35" }, .{ "CallstackDepth", "16" }, - .{ "Tab", "8" }, + .{ "GripWidth", "200" }, .{ "InactiveDim", "35" }, + .{ "CallstackDepth", "16" }, .{ "Tab", "8" }, }; for (values) |v| try std.testing.expect(apply(&state, find(v[0]).?, v[1])); try std.testing.expect(state.font.requested_name.set("Wanted Mono")); -- cgit v1.3