Put the signed bundle in the image it is distributed in - #290
Merged
Merged
Conversation
A .app is what AppKit needs; a .dmg is what a person downloads. cmd/dmg wraps the built bundle in one -- the application on the left, a shortcut to /Applications on the right, the reader's own icon on the volume, and a window sized to hold them -- through go-macos/appdmg, pure Go with CGO_ENABLED=0 and no hdiutil. A 100 MB bundle becomes a 55 MB image in about four seconds. The order matters and the doc comment says so: the image is a copy of the bundle as it stands, so a bundle signed afterwards is not the bundle inside it. Signed first, the copy inside the mounted image answers `codesign --verify` with "valid on disk" and "satisfies its Designated Requirement" -- checked, not assumed, because a copy that dropped extended attributes would have produced an application macOS refuses to open. The volume icon comes from internal/appicon through appbundle.ICNS, the same PNG the bundle's icon is made of. -background takes a picture when there is art for one; without it the window is given a size of its own, since nothing else would know one. Build tooling, so it joins cmd/bundle outside the coverage gate. It cross-builds on every target the matrix covers. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A
.appis what AppKit needs; a.dmgis what a person downloads. The reader could make the first and not the second.cmd/dmgputs the bundle in the image it is distributed in — the application on the left, a shortcut to/Applicationson the right, the reader's own icon on the volume, and a window sized to hold them — through go-macos/appdmg: pure Go,CGO_ENABLED=0, nohdiutil. A 100 MB bundle becomes a 55 MB image in about four seconds.Sign first, and this checks that it survived
The image is a copy of the bundle as it stands, so a bundle signed afterwards is not the bundle inside it. Signed first, the copy inside the mounted image answers:
Checked rather than assumed — a copy that dropped extended attributes would have produced an application macOS refuses to open.
Also verified on the mounted image: the volume root carries
kHasCustomIcon(GetFileInfo -a→…C…), and the Finder opens the window at 620 × 380 with the icons at (160, 200) and (460, 200) — the positions asked for.Details
internal/appiconthroughappbundle.ICNS, the same PNG the bundle's icon is made of.-backgroundtakes a picture when there is art for one. Without it the window is given a size of its own, since nothing else would know one — the Finder would otherwise open it at whatever size it used last.cmd/bundleoutside the coverage gate. It cross-builds on every target in the matrix (checked locally for linux/amd64, s390x, riscv64, windows/arm64, darwin/arm64, android/arm64)..gitignoregains/dmgand/bundle:go build ./cmd/dmgleaves a binary in the repo root, and that file already carries a note about three that were committed at ~97 MB each.🤖 Generated with Claude Code