From 32b2f88ff0a0a4fff651eef3b9d0048e074a9d67 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 9 Feb 2024 12:23:39 -0800 Subject: [PATCH 01/10] update zig --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index a3b92f93a..a67d918ef 100644 --- a/flake.lock +++ b/flake.lock @@ -194,11 +194,11 @@ ] }, "locked": { - "lastModified": 1707148508, - "narHash": "sha256-fAQN2Y8wZn8JQWQvA5dfDEorxZLLWTNSdZp39YFAWXk=", + "lastModified": 1707480505, + "narHash": "sha256-YXq7nqNetcJ5cpJcoatu6YwG6Vh+u1wSL+hlwZq3vKQ=", "owner": "mitchellh", "repo": "zig-overlay", - "rev": "3e47b1a260a5521e51888b8e71cd04b8e8928cb3", + "rev": "1fc0b4325748f33767cb939ceb2abc744b61360b", "type": "github" }, "original": { From 28c078ec37c9ccfdd648e9f5a44c7f667af34dec Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 9 Feb 2024 12:26:08 -0800 Subject: [PATCH 02/10] update req version in build.zig --- build.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.zig b/build.zig index 0669f27cc..f77f513ba 100644 --- a/build.zig +++ b/build.zig @@ -24,7 +24,7 @@ const Command = @import("src/Command.zig"); // but we liberally update it. In the future, we'll be more careful about // using released versions so that package managers can integrate better. comptime { - const required_zig = "0.12.0-dev.2075+f5978181e"; + const required_zig = "0.12.0-dev.2587+a1b607acb"; const current_zig = builtin.zig_version; const min_zig = std.SemanticVersion.parse(required_zig) catch unreachable; if (current_zig.order(min_zig) == .lt) { From e32b4849d10aeacd7583e83cc831cbef7b62a5a4 Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Fri, 9 Feb 2024 23:58:43 +0100 Subject: [PATCH 03/10] fix for latest breaking libstd changes to Options --- src/main_ghostty.zig | 99 ++++++++++++++++++++++---------------------- 1 file changed, 50 insertions(+), 49 deletions(-) diff --git a/src/main_ghostty.zig b/src/main_ghostty.zig index 05f6a39ed..fadd4fd28 100644 --- a/src/main_ghostty.zig +++ b/src/main_ghostty.zig @@ -109,58 +109,59 @@ pub fn main() !MainReturn { try app_runtime.run(); } -pub const std_options = struct { +// The function std.log will call. +pub fn logFn( + comptime level: std.log.Level, + comptime scope: @TypeOf(.EnumLiteral), + comptime format: []const u8, + args: anytype, +) void { + // Stuff we can do before the lock + const level_txt = comptime level.asText(); + const prefix = if (scope == .default) ": " else "(" ++ @tagName(scope) ++ "): "; + + // Lock so we are thread-safe + std.debug.getStderrMutex().lock(); + defer std.debug.getStderrMutex().unlock(); + + // On Mac, we use unified logging. To view this: + // + // sudo log stream --level debug --predicate 'subsystem=="com.mitchellh.ghostty"' + // + if (builtin.target.isDarwin()) { + // Convert our levels to Mac levels + const mac_level: macos.os.LogType = switch (level) { + .debug => .debug, + .info => .info, + .warn => .err, + .err => .fault, + }; + + // Initialize a logger. This is slow to do on every operation + // but we shouldn't be logging too much. + const logger = macos.os.Log.create("com.mitchellh.ghostty", @tagName(scope)); + defer logger.release(); + logger.log(std.heap.c_allocator, mac_level, format, args); + } + + switch (state.logging) { + .disabled => {}, + + .stderr => { + // Always try default to send to stderr + const stderr = std.io.getStdErr().writer(); + nosuspend stderr.print(level_txt ++ prefix ++ format ++ "\n", args) catch return; + }, + } +} + +pub const std_options: std.Options = .{ // Our log level is always at least info in every build mode. - pub const log_level: std.log.Level = switch (builtin.mode) { + .log_level = switch (builtin.mode) { .Debug => .debug, else => .info, - }; - - // The function std.log will call. - pub fn logFn( - comptime level: std.log.Level, - comptime scope: @TypeOf(.EnumLiteral), - comptime format: []const u8, - args: anytype, - ) void { - // Stuff we can do before the lock - const level_txt = comptime level.asText(); - const prefix = if (scope == .default) ": " else "(" ++ @tagName(scope) ++ "): "; - - // Lock so we are thread-safe - std.debug.getStderrMutex().lock(); - defer std.debug.getStderrMutex().unlock(); - - // On Mac, we use unified logging. To view this: - // - // sudo log stream --level debug --predicate 'subsystem=="com.mitchellh.ghostty"' - // - if (builtin.target.isDarwin()) { - // Convert our levels to Mac levels - const mac_level: macos.os.LogType = switch (level) { - .debug => .debug, - .info => .info, - .warn => .err, - .err => .fault, - }; - - // Initialize a logger. This is slow to do on every operation - // but we shouldn't be logging too much. - const logger = macos.os.Log.create("com.mitchellh.ghostty", @tagName(scope)); - defer logger.release(); - logger.log(std.heap.c_allocator, mac_level, format, args); - } - - switch (state.logging) { - .disabled => {}, - - .stderr => { - // Always try default to send to stderr - const stderr = std.io.getStdErr().writer(); - nosuspend stderr.print(level_txt ++ prefix ++ format ++ "\n", args) catch return; - }, - } - } + }, + .logFn = logFn, }; /// This represents the global process state. There should only From 66a91638d3208d41a8c049e9a5d3161a0e2c6d5c Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 10 Feb 2024 16:43:51 -0800 Subject: [PATCH 04/10] update zig --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index a67d918ef..8456c702d 100644 --- a/flake.lock +++ b/flake.lock @@ -194,11 +194,11 @@ ] }, "locked": { - "lastModified": 1707480505, - "narHash": "sha256-YXq7nqNetcJ5cpJcoatu6YwG6Vh+u1wSL+hlwZq3vKQ=", + "lastModified": 1707611073, + "narHash": "sha256-sMsxVKXP5TLcaVMNlRZ7KlDsYGwDdJAMtY0DKmb+7fQ=", "owner": "mitchellh", "repo": "zig-overlay", - "rev": "1fc0b4325748f33767cb939ceb2abc744b61360b", + "rev": "aa4edff6f53e64443ca77e8d9ffe866f29e5b3d4", "type": "github" }, "original": { From de228d99dda0ba9f25bf0725b0a706a65b0c50a5 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 10 Feb 2024 16:45:00 -0800 Subject: [PATCH 05/10] logfn doesn't need to be pub --- src/main_ghostty.zig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main_ghostty.zig b/src/main_ghostty.zig index fadd4fd28..8b9203e26 100644 --- a/src/main_ghostty.zig +++ b/src/main_ghostty.zig @@ -110,7 +110,7 @@ pub fn main() !MainReturn { } // The function std.log will call. -pub fn logFn( +fn logFn( comptime level: std.log.Level, comptime scope: @TypeOf(.EnumLiteral), comptime format: []const u8, @@ -161,6 +161,7 @@ pub const std_options: std.Options = .{ .Debug => .debug, else => .info, }, + .logFn = logFn, }; From be61e0025fed19f2dc608b9fee1f5a3cb5adb386 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 10 Feb 2024 16:46:09 -0800 Subject: [PATCH 06/10] update min zig version --- build.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.zig b/build.zig index f77f513ba..b514cbdce 100644 --- a/build.zig +++ b/build.zig @@ -24,7 +24,7 @@ const Command = @import("src/Command.zig"); // but we liberally update it. In the future, we'll be more careful about // using released versions so that package managers can integrate better. comptime { - const required_zig = "0.12.0-dev.2587+a1b607acb"; + const required_zig = "0.12.0-dev.2701+d18f52197"; const current_zig = builtin.zig_version; const min_zig = std.SemanticVersion.parse(required_zig) catch unreachable; if (current_zig.order(min_zig) == .lt) { From 8456e9d7f721a34e6a4ae10e4872fcf9849d6208 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 10 Feb 2024 16:58:45 -0800 Subject: [PATCH 07/10] command: io_mode removed for windows --- src/Command.zig | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Command.zig b/src/Command.zig index af3979b3e..c5419814c 100644 --- a/src/Command.zig +++ b/src/Command.zig @@ -178,7 +178,6 @@ fn startWindows(self: *Command, arena: Allocator) !void { .access_mask = windows.GENERIC_READ | windows.SYNCHRONIZE, .share_access = windows.FILE_SHARE_READ, .creation = windows.OPEN_EXISTING, - .io_mode = .blocking, }, ) else null; defer if (null_fd) |fd| std.os.close(fd); From 18fdef31609c99e1bf5e39f3befc31e9c5a7dae3 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 10 Feb 2024 17:02:14 -0800 Subject: [PATCH 08/10] ci: prettier/alejandra do not push to cachix --- .github/workflows/test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8f27ff04d..b7a93b83f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -220,6 +220,8 @@ jobs: with: name: ghostty authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + skipPush: true + useDaemon: false # sometimes fails on short jobs - name: prettier check run: nix develop -c prettier --check . @@ -234,5 +236,7 @@ jobs: with: name: ghostty authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + skipPush: true + useDaemon: false # sometimes fails on short jobs - name: alejandra check run: nix develop -c alejandra --check . From 7f3ee039ffab567da10b687cc12903e226d33fac Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 10 Feb 2024 17:04:47 -0800 Subject: [PATCH 09/10] ci: nix job should also not push to cachix --- .github/workflows/nix.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index ce461fdbd..f732ae8b3 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -14,5 +14,6 @@ jobs: with: name: ghostty authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + useDaemon: false # sometimes fails on short jobs - name: Check Zig cache hash run: nix develop -c ./nix/build-support/check-zig-cache-hash.sh From 2f84472f66893df784e4146d4bec78b4f9f559e1 Mon Sep 17 00:00:00 2001 From: Chris Marchesi Date: Sat, 10 Feb 2024 17:21:34 -0800 Subject: [PATCH 10/10] nix: update nixpkgs-zig-0-12 This updates the nixpkgs-zig-0-12 to be in line with the current overlay Zig (0.12.0-dev.2701+d18f52197). --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 8456c702d..a7f368ff4 100644 --- a/flake.lock +++ b/flake.lock @@ -147,11 +147,11 @@ }, "nixpkgs-zig-0-12": { "locked": { - "lastModified": 1707156663, - "narHash": "sha256-T0Ah65Sj/HnbEkKmOCaQGSIoNDZDh3K299A0nvXceCk=", + "lastModified": 1707614255, + "narHash": "sha256-26jDBuCgewZb+ifR3Ow6cZS/6Mz09pwC4ukKWtOjFZk=", "owner": "vancluever", "repo": "nixpkgs", - "rev": "dfe11015af91c9317604d792715f166d9fce7831", + "rev": "85b992eb1a8d3a3742ddb21eba7f79b0e4f2e78b", "type": "github" }, "original": {