Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ concurrency:

jobs:
native:
uses: SimonCropp/PlatformHeads/.github/workflows/build-native.yml@0.13.0
uses: SimonCropp/PlatformHeads/.github/workflows/build-native.yml@0.14.0
permissions:
contents: write
pull-requests: write
Expand Down
39 changes: 20 additions & 19 deletions claude.md
Original file line number Diff line number Diff line change
Expand Up @@ -616,12 +616,12 @@ the comment there about not caching "nothing staged" asks for.
**Native shim (`native/`), used by the Mac and Linux heads only:**
- The build and packaging of the heads is PlatformHeads' (`D:\Code\PlatformHeads`,
github.com/SimonCropp/PlatformHeads), which BuildMonitor shares: it was worked out here and
copied there, and fixes made here did not reach the copy. Seven pins name a tag of it: the
copied there, and fixes made here did not reach the copy. Eight pins name a tag of it: the
`uses:` of `.github/workflows/build-native.yml`, the `GIT_TAG` in
`native/CMakeLists.txt`, `PlatformHeads`, `PlatformHeads.Core`, `PlatformHeads.Linux` (the
Linux tray's) and `PlatformHeads.WindowsForms` in `Directory.Packages.props`, which move
together, and the `PlatformHeads` package
in `native/swift/Package.swift`, all at 0.13.0. So is the native runtime under both heads' drawing: the C++
Linux tray's), `PlatformHeads.Mac` (the macOS tray's) and `PlatformHeads.WindowsForms` in
`Directory.Packages.props`, which move together, and the `PlatformHeads` package
in `native/swift/Package.swift`, all at 0.14.0. So is the native runtime under both heads' drawing: the C++
one `deview.cpp` calls as `ph::` (the window, GLFW's input as it happened, which frames are
built and drawn, the renderer, the fonts and fontconfig, and the label helpers) and the Swift
`PlatformHeadsMac` the AppKit head imports (`HeadWindow`, `EventPump`, `TerminateGuard`,
Expand Down Expand Up @@ -745,21 +745,22 @@ the comment there about not caching "nothing staged" asks for.
native library of its own, `diffengine_tray` (decision G), so a tray change never moves the
viewer's ABI version. It is a second product of `native/swift`, built by the same `build-native`
run, which collects it into the head's `runtimes` through PlatformHeads' `mac-libraries`, and
committed as the viewer's is. The ABI is `native/include/detray.h`, `DETRAY_VERSION` 2: the
menu goes over as one array of `DetrayItem`s, each with its parent by index, since a C struct
cannot hold a list of itself, and the Swift side (`Sources/Detray`) makes it a tree again. Its
managed half is in the core (`Detray`, `MacTray`), as ProcessEx's native calls are, so the
core's tests run it on the macOS job: `MacTrayTests` hands it a menu and reads back what it
rebuilt (`detray_describe`), with no status bar. The `unix` job builds it from source first, as
it does the viewer's, and the `native` job loads the committed one and checks it is universal.
AppKit is driven from the main thread only, so
the loop is `TrayLoop.RunPumped`, on the thread `Main` starts on, with the library's pump as
its wait; nothing in `Program.Inner` awaits before the loop returns. The app is an accessory,
with no Dock icon, App Nap is off (`NapGuard`), and a quit is `TerminateGuard`'s. A logout,
restart or shutdown runs `TraySessionEnd.For` from inside the pump (`detray_on_session_end`,
`MacTray.SessionEnding`, set before `detray_init` makes the guard) and is let through, since
refusing it cancelled the logout; any other quit is refused and reported (`detray_quitting`),
for the loop to end as Exit does. "Run at startup" is a
committed as the viewer's is. Its ABI and its binding are PlatformHeads': the library's target,
`Sources/Detray`, is one file that depends on `PlatformHeadsMacTray`, which SwiftPM links in,
so the library exports `platformheads_tray.h`, and the head calls it through `PlatformHeads.Mac`
(`MacTray` names the library to `StatusItemTray` and `StatusItemApp`). They were this repository's
own, `detray.h` with its binding in the core, until PlatformHeads 0.14.0 took them, so BuildMonitor's
tray could share them. `MacTrayTests`, in the core's tests, loads the committed library through
`PlatformHeads.Mac`, checks its version and reads back a menu it was handed, with no status bar.
The `unix` job builds it from source first, as it does the viewer's, and the `native` job loads
the committed one and checks it is universal. AppKit is driven from the main thread only, so
the loop is `TrayLoop.RunPumped`, on the thread `Main` starts on, with `StatusItemApp.Pump` as
its wait; nothing in `Program.Inner` awaits before the loop returns. `StatusItemApp.Start` makes
the app an accessory, with no Dock icon, App Nap off (`NapGuard`), and a quit `TerminateGuard`'s.
A logout, restart or shutdown runs `TraySessionEnd.For` from inside the pump
(`StatusItemApp.SessionEnding`) and is let through, since refusing it cancelled the logout; any
other quit is refused and reported (`StatusItemApp.Quitting`), for the loop to end as Exit does.
The `tray-install` job sends both kinds of quit. "Run at startup" is a
launch agent. Packed as `DiffEngineTray.osx-x64` and `.osx-arm64`
- The tray ships as .NET 10 RID specific tool packages (decision F), by
`src/DiffEngineTray.Core/TrayHead.targets`, which every head imports after naming its RIDs in
Expand Down
2 changes: 1 addition & 1 deletion native/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ include(FetchContent)
FetchContent_Declare(
platformheads
GIT_REPOSITORY https://github.com/SimonCropp/PlatformHeads.git
GIT_TAG 0.13.0
GIT_TAG 0.14.0
GIT_SHALLOW ON)
FetchContent_MakeAvailable(platformheads)
include(${platformheads_SOURCE_DIR}/cmake/PlatformHeads.cmake)
Expand Down
111 changes: 0 additions & 111 deletions native/include/detray.h

This file was deleted.

18 changes: 6 additions & 12 deletions native/swift/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ let package = Package(
platforms: [.macOS(.v12)],
products: [
.library(name: "diffengine_viewer", type: .dynamic, targets: ["Deview"]),
// The tray's status bar item, a library of its own so a change to either never moves the
// other's ABI version. build-native's mac-libraries collects it into the tray's head.
// The tray's status bar item, PlatformHeads' tray ABI in a library of its own, so the
// viewer's never carries it. build-native's mac-libraries collects it into the tray's head.
.library(name: "diffengine_tray", type: .dynamic, targets: ["Detray"])
],
dependencies: [
// What every AppKit head does underneath its drawing, shared with BuildMonitor. The sixth
// pin of PlatformHeads, moved with the other five.
.package(url: "https://github.com/SimonCropp/PlatformHeads", exact: "0.13.0")
// What every AppKit head does underneath its drawing, and the tray's ABI, shared with
// BuildMonitor. A pin of PlatformHeads, moved with the other seven.
.package(url: "https://github.com/SimonCropp/PlatformHeads", exact: "0.14.0")
],
targets: [
// Exists only to import the ABI. Swift does not guarantee struct layout, so the structs
Expand All @@ -33,15 +33,9 @@ let package = Package(
.linkedFramework("CoreGraphics"),
.linkedFramework("ImageIO")
]),
// The tray's ABI, for the reason CDeview exists.
.target(name: "CDetray"),
.target(
name: "Detray",
dependencies: [
"CDetray",
.product(name: "PlatformHeadsMac", package: "PlatformHeads")
],
linkerSettings: [
.linkedFramework("AppKit")
.product(name: "PlatformHeadsMacTray", package: "PlatformHeads")
])
])
3 changes: 0 additions & 3 deletions native/swift/Sources/CDetray/bridge.c

This file was deleted.

12 changes: 0 additions & 12 deletions native/swift/Sources/CDetray/include/detray_bridge.h

This file was deleted.

93 changes: 0 additions & 93 deletions native/swift/Sources/Detray/Exports.swift

This file was deleted.

5 changes: 5 additions & 0 deletions native/swift/Sources/Detray/Library.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// The tray's library is PlatformHeads' PlatformHeadsMacTray and nothing else: its C ABI,
// platformheads_tray.h, which SwiftPM links into this product and so exports from it, and which
// PlatformHeads.Mac's StatusItemTray and StatusItemApp call. This target exists only to be the
// product's own, since a product can name no target of another package.
import PlatformHeadsMacTray
28 changes: 0 additions & 28 deletions native/swift/Sources/Detray/MenuItems.swift

This file was deleted.

Loading
Loading