ReviewOS

also looking at this

craft-native/craft

fix(build): three test artifacts reach Carbon and none of them linked it

#139
Merged chris wants to merge fix/tray-tests-link-carbon into main
1 file +23 -0
packages/zig/build.zigmodified+23-0
Changes to packages/zig/build.zig
@@ -342,6 +342,13 @@ pub fn build(b: *std.Build) void {
342342 // The storage module is Keychain: SecItemAdd and the kSec* constants
343343 // live in Security.framework.
344344 ios_surface_tests.root_module.linkFramework("Security", .{});
345 // And Carbon, for the same reason as the paragraph above rather than a
346 // new one: the desktop arm this drags in reaches `bridge_shortcuts.zig`,
347 // which imports `macos_hotkey.zig` and its `RegisterEventHotKey`
348 // externs. Nothing in the iOS surface names a hotkey — the dependency
349 // arrives through the reply path, which is precisely the code this gate
350 // exists to compile.
351 ios_surface_tests.root_module.linkFramework("Carbon", .{});
345352 ios_surface_tests.root_module.addCSourceFile(.{
346353 .file = b.path("vendor/sqlite/sqlite3.c"),
347354 .flags = &.{ "-DSQLITE_THREADSAFE=1", "-DSQLITE_ENABLE_FTS5", "-DSQLITE_ENABLE_JSON1" },
@@ -1353,6 +1360,14 @@ pub fn build(b: *std.Build) void {
13531360 system_tray_tests.root_module.linkFramework("Cocoa", .{});
13541361 system_tray_tests.root_module.linkFramework("WebKit", .{});
13551362 system_tray_tests.root_module.linkFramework("CoreMIDI", .{});
1363 // Carbon, because `tray.zig` reaches it: tray.zig imports
1364 // macos.zig, which imports bridge_shortcuts.zig, which imports
1365 // macos_hotkey.zig and its `RegisterEventHotKey` externs. Nothing
1366 // in tray.zig names a hotkey, so the dependency is four files away
1367 // and invisible from here — which is how both of these artifacts
1368 // came to list Cocoa, WebKit and CoreMIDI by hand and miss the one
1369 // framework they actually could not link without.
1370 system_tray_tests.root_module.linkFramework("Carbon", .{});
13561371 applySdkPaths(b, system_tray_tests.root_module, macos_sdk);
13571372 },
13581373 .linux => {
@@ -1378,6 +1393,14 @@ pub fn build(b: *std.Build) void {
13781393 system_tray_benchmark.root_module.linkFramework("Cocoa", .{});
13791394 system_tray_benchmark.root_module.linkFramework("WebKit", .{});
13801395 system_tray_benchmark.root_module.linkFramework("CoreMIDI", .{});
1396 // Carbon, because `tray.zig` reaches it: tray.zig imports
1397 // macos.zig, which imports bridge_shortcuts.zig, which imports
1398 // macos_hotkey.zig and its `RegisterEventHotKey` externs. Nothing
1399 // in tray.zig names a hotkey, so the dependency is four files away
1400 // and invisible from here — which is how both of these artifacts
1401 // came to list Cocoa, WebKit and CoreMIDI by hand and miss the one
1402 // framework they actually could not link without.
1403 system_tray_benchmark.root_module.linkFramework("Carbon", .{});
13811404 applySdkPaths(b, system_tray_benchmark.root_module, macos_sdk);
13821405 },
13831406 .linux => {