feat(app): family app icon, Release install and local dmg
Add a committed AppIcon asset catalog generated from scripts/generate-app-icon.swift, using the same indigo tile/grid/text-bar family as Vorleser and Schriftleser with a two-speech-bubble translation motif. Wire CFBundleIconName/ASSETCATALOG_COMPILER_APPICON_NAME and add make icon. Change make install to use the Release build and the same signature checks as the DMG. Add make dmg/scripts/make-dmg.sh: stage the Release app with an Applications link, create and verify a local unnotarised DMG, mount it, and re-check the signature. Verified: make verify green; make dmg produced dist/Sprachmittler-0.1.0-local.dmg with a valid signature; make install installed and launched /Applications/Sprachmittler.app.
No files matched your search
@@ -10,8 +10,15 @@
|
|||||||
<string>$(EXECUTABLE_NAME)</string>
|
<string>$(EXECUTABLE_NAME)</string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||||
|
<key>CFBundleIconName</key>
|
||||||
|
<string>AppIcon</string>
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
<string>6.0</string>
|
<string>6.0</string>
|
||||||
|
<key>CFBundleLocalizations</key>
|
||||||
|
<array>
|
||||||
|
<string>en</string>
|
||||||
|
<string>de</string>
|
||||||
|
</array>
|
||||||
<key>CFBundleName</key>
|
<key>CFBundleName</key>
|
||||||
<string>$(PRODUCT_NAME)</string>
|
<string>$(PRODUCT_NAME)</string>
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{ "filename" : "icon_16x16.png", "idiom" : "mac", "scale" : "1x", "size" : "16x16" },
|
||||||
|
{ "filename" : "icon_16x16@2x.png", "idiom" : "mac", "scale" : "2x", "size" : "16x16" },
|
||||||
|
{ "filename" : "icon_32x32.png", "idiom" : "mac", "scale" : "1x", "size" : "32x32" },
|
||||||
|
{ "filename" : "icon_32x32@2x.png", "idiom" : "mac", "scale" : "2x", "size" : "32x32" },
|
||||||
|
{ "filename" : "icon_128x128.png", "idiom" : "mac", "scale" : "1x", "size" : "128x128" },
|
||||||
|
{ "filename" : "icon_128x128@2x.png", "idiom" : "mac", "scale" : "2x", "size" : "128x128" },
|
||||||
|
{ "filename" : "icon_256x256.png", "idiom" : "mac", "scale" : "1x", "size" : "256x256" },
|
||||||
|
{ "filename" : "icon_256x256@2x.png", "idiom" : "mac", "scale" : "2x", "size" : "256x256" },
|
||||||
|
{ "filename" : "icon_512x512.png", "idiom" : "mac", "scale" : "1x", "size" : "512x512" },
|
||||||
|
{ "filename" : "icon_512x512@2x.png", "idiom" : "mac", "scale" : "2x", "size" : "512x512" }
|
||||||
|
],
|
||||||
|
"info" : { "author" : "xcode", "version" : 1 }
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 641 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 63 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 63 KiB |
|
After Width: | Height: | Size: 170 KiB |
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"info" : { "author" : "xcode", "version" : 1 }
|
||||||
|
}
|
||||||
@@ -4,9 +4,11 @@ PROJECT := Sprachmittler.xcodeproj
|
|||||||
SCHEME := Sprachmittler
|
SCHEME := Sprachmittler
|
||||||
DERIVED := .build/xcode
|
DERIVED := .build/xcode
|
||||||
APP_PATH := $(DERIVED)/Build/Products/Debug/Sprachmittler.app
|
APP_PATH := $(DERIVED)/Build/Products/Debug/Sprachmittler.app
|
||||||
|
RELEASE_APP := .build/xcode-release/Build/Products/Release/Sprachmittler.app
|
||||||
INSTALL_DIR ?= /Applications
|
INSTALL_DIR ?= /Applications
|
||||||
|
DMG_DIR ?= dist
|
||||||
|
|
||||||
.PHONY: bootstrap doctor generate build build-pkg build-app test live-test verify app install release fixtures smoke privacy-check format manifest clean
|
.PHONY: bootstrap doctor generate build build-pkg build-app test live-test verify app install release-build dmg release icon fixtures smoke privacy-check format manifest clean
|
||||||
|
|
||||||
bootstrap:
|
bootstrap:
|
||||||
@scripts/bootstrap.sh
|
@scripts/bootstrap.sh
|
||||||
@@ -17,6 +19,9 @@ doctor:
|
|||||||
generate:
|
generate:
|
||||||
xcodegen generate --spec project.yml
|
xcodegen generate --spec project.yml
|
||||||
|
|
||||||
|
icon:
|
||||||
|
swift scripts/generate-app-icon.swift
|
||||||
|
|
||||||
build: build-pkg build-app
|
build: build-pkg build-app
|
||||||
|
|
||||||
build-pkg:
|
build-pkg:
|
||||||
@@ -42,14 +47,26 @@ app: build-app
|
|||||||
release:
|
release:
|
||||||
@scripts/release.sh --dry-run
|
@scripts/release.sh --dry-run
|
||||||
|
|
||||||
install: build-app
|
release-build: generate
|
||||||
|
xcodebuild -project $(PROJECT) -scheme $(SCHEME) -configuration Release \
|
||||||
|
-derivedDataPath .build/xcode-release -destination 'platform=macOS,arch=arm64' -quiet build
|
||||||
|
|
||||||
|
# Build Release, replace $(INSTALL_DIR)/Sprachmittler.app and start it. Not `cp -r`: ditto keeps
|
||||||
|
# symlinks and attributes. Remove the old copy first, because ditto merges.
|
||||||
|
install: release-build
|
||||||
|
@test -d "$(RELEASE_APP)" || { echo "error: $(RELEASE_APP) not found"; exit 1; }
|
||||||
|
@test -d "$(INSTALL_DIR)" || { echo "error: $(INSTALL_DIR) does not exist"; exit 1; }
|
||||||
|
scripts/check-signature.sh "$(RELEASE_APP)" install
|
||||||
@pkill -x Sprachmittler 2>/dev/null || true
|
@pkill -x Sprachmittler 2>/dev/null || true
|
||||||
ditto "$(APP_PATH)" "$(INSTALL_DIR)/Sprachmittler.app"
|
rm -rf "$(INSTALL_DIR)/Sprachmittler.app"
|
||||||
codesign --force --sign - --options runtime \
|
ditto "$(RELEASE_APP)" "$(INSTALL_DIR)/Sprachmittler.app"
|
||||||
--entitlements App/Sprachmittler.entitlements "$(INSTALL_DIR)/Sprachmittler.app"
|
|
||||||
scripts/check-signature.sh "$(INSTALL_DIR)/Sprachmittler.app" install
|
scripts/check-signature.sh "$(INSTALL_DIR)/Sprachmittler.app" install
|
||||||
open "$(INSTALL_DIR)/Sprachmittler.app"
|
open "$(INSTALL_DIR)/Sprachmittler.app"
|
||||||
|
|
||||||
|
# Local, unnotarised DMG from the same Release build. Use scripts/release.sh for distribution.
|
||||||
|
dmg: release-build
|
||||||
|
@DMG_DIR="$(DMG_DIR)" scripts/make-dmg.sh
|
||||||
|
|
||||||
fixtures:
|
fixtures:
|
||||||
@scripts/capture-fixtures.sh
|
@scripts/capture-fixtures.sh
|
||||||
|
|
||||||
|
|||||||
@@ -38,8 +38,11 @@ make bootstrap # installs xcodegen, swif
|
|||||||
ollama pull hf.co/tencent/Hy-MT3-7B-GGUF:Q4_K_M # about 5.15 GB
|
ollama pull hf.co/tencent/Hy-MT3-7B-GGUF:Q4_K_M # about 5.15 GB
|
||||||
make smoke # translates one fixed synthetic sentence
|
make smoke # translates one fixed synthetic sentence
|
||||||
make doctor # checks OpenCode 2.x and the resolved V2 config
|
make doctor # checks OpenCode 2.x and the resolved V2 config
|
||||||
make verify # the scaffold should already build and test
|
make verify # format, lint, privacy, tests, Debug + Release builds
|
||||||
make app # builds and launches Sprachmittler.app
|
make app # builds and launches the Debug app
|
||||||
|
make install # builds Release, installs in /Applications and launches
|
||||||
|
make dmg # local unnotarised DMG from the Release build
|
||||||
|
make icon # regenerate the app icon assets
|
||||||
opencode # start OpenCode in the repo root
|
opencode # start OpenCode in the repo root
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -607,7 +607,7 @@ Never store source text, translations, pasteboard contents or app names in setti
|
|||||||
| Sandbox | **Off** (ADR-003): Accessibility replacement. Hardened Runtime **on**, no exceptions |
|
| Sandbox | **Off** (ADR-003): Accessibility replacement. Hardened Runtime **on**, no exceptions |
|
||||||
| Signing | Development: "Sign to Run Locally". Release: Developer ID + notarisation |
|
| Signing | Development: "Sign to Run Locally". Release: Developer ID + notarisation |
|
||||||
| ATS | `NSAllowsLocalNetworking = YES`; remote endpoints must be HTTPS |
|
| ATS | `NSAllowsLocalNetworking = YES`; remote endpoints must be HTTPS |
|
||||||
| Distribution | Signed, notarised DMG; Mac App Store not in v1 |
|
| Distribution | Signed, notarised DMG; local `make dmg` for testing; Mac App Store not in v1 |
|
||||||
|
|
||||||
`make install` copies the app to `/Applications` and ad-hoc signs it. macOS ties Accessibility permission to the app's signature and location; after a reinstall the user may have to remove and re-add the app in System Settings.
|
`make install` copies the app to `/Applications` and ad-hoc signs it. macOS ties Accessibility permission to the app's signature and location; after a reinstall the user may have to remove and re-add the app in System Settings.
|
||||||
|
|
||||||
|
|||||||
@@ -149,3 +149,4 @@ Legend: `[ ]` open · `[~]` in progress · `[x]` done · `[!]` blocked (explain)
|
|||||||
2026-11-26 · T8.4 · Added English/German `Localizable.strings` for the app shell and `docs/USER_GUIDE.md` (install, permissions, privacy, troubleshooting).
|
2026-11-26 · T8.4 · Added English/German `Localizable.strings` for the app shell and `docs/USER_GUIDE.md` (install, permissions, privacy, troubleshooting).
|
||||||
2026-11-26 · T8.5 · Added `scripts/release.sh` (archive unsigned, Developer ID sign, notarise/staple, DMG, `--dry-run`) and `make release`.
|
2026-11-26 · T8.5 · Added `scripts/release.sh` (archive unsigned, Developer ID sign, notarise/staple, DMG, `--dry-run`) and `make release`.
|
||||||
2026-11-26 · T8.6 · The compatibility matrix remains a manual 10-app pass; no untested cell is claimed.
|
2026-11-26 · T8.6 · The compatibility matrix remains a manual 10-app pass; no untested cell is claimed.
|
||||||
|
2026-11-26 · T8.5 · Added a sibling-family app icon (`make icon`), `CFBundleIconName`/asset catalog wiring, `make install` from the Release build, and `make dmg`/`scripts/make-dmg.sh` with a mounted-image signature check. Dry-run release and local DMG/install were verified.
|
||||||
@@ -53,6 +53,7 @@ targets:
|
|||||||
CODE_SIGN_IDENTITY: "-" # "Sign to Run Locally" for development
|
CODE_SIGN_IDENTITY: "-" # "Sign to Run Locally" for development
|
||||||
ENABLE_APP_SANDBOX: NO # ADR-003: Accessibility insertion needs it off
|
ENABLE_APP_SANDBOX: NO # ADR-003: Accessibility insertion needs it off
|
||||||
COMBINE_HIDPI_IMAGES: YES
|
COMBINE_HIDPI_IMAGES: YES
|
||||||
|
ASSETCATALOG_COMPILER_APPICON_NAME: AppIcon
|
||||||
dependencies:
|
dependencies:
|
||||||
- package: SprachmittlerKit
|
- package: SprachmittlerKit
|
||||||
product: SprachmittlerCore
|
product: SprachmittlerCore
|
||||||
|
|||||||
@@ -0,0 +1,357 @@
|
|||||||
|
#!/usr/bin/env swift
|
||||||
|
// Generates App/Resources/Assets.xcassets/AppIcon.appiconset from vector geometry.
|
||||||
|
//
|
||||||
|
// Run with `make icon` (or `swift scripts/generate-app-icon.swift`). PNGs are committed, so
|
||||||
|
// `make verify` does not depend on this script.
|
||||||
|
//
|
||||||
|
// Family geometry follows Vorleser and Schriftleser: 1024 canvas, 824 opaque indigo tile,
|
||||||
|
// transparent margin, soft shadow. The translation motif is two facing speech bubbles carrying
|
||||||
|
// text bars; small sizes simplify to one bubble for legibility.
|
||||||
|
|
||||||
|
import CoreGraphics
|
||||||
|
import Foundation
|
||||||
|
import ImageIO
|
||||||
|
import UniformTypeIdentifiers
|
||||||
|
|
||||||
|
private enum Design {
|
||||||
|
static let canvas: CGFloat = 1024
|
||||||
|
static let tileInset: CGFloat = 100
|
||||||
|
static let tileSize = canvas - tileInset * 2
|
||||||
|
static let tileRadius = tileSize * 0.2245
|
||||||
|
|
||||||
|
// Same indigo family tile as Vorleser and Schriftleser.
|
||||||
|
static let gradientTop = srgb(0x5B, 0x7C, 0xFA)
|
||||||
|
static let gradientBottom = srgb(0x2E, 0x3F, 0xC7)
|
||||||
|
static let glyph = srgb(0xFF, 0xFF, 0xFF)
|
||||||
|
static let bar = srgb(0x2F, 0x3E, 0xC4)
|
||||||
|
|
||||||
|
static func srgb(_ r: UInt8, _ g: UInt8, _ b: UInt8) -> CGColor {
|
||||||
|
CGColor(
|
||||||
|
colorSpace: CGColorSpace(name: CGColorSpace.sRGB)!,
|
||||||
|
components: [CGFloat(r) / 255, CGFloat(g) / 255, CGFloat(b) / 255, 1]
|
||||||
|
)!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private struct Bubble {
|
||||||
|
let rect: CGRect
|
||||||
|
let radius: CGFloat
|
||||||
|
let tail: [CGPoint]
|
||||||
|
let bars: [CGFloat]
|
||||||
|
let barHeight: CGFloat
|
||||||
|
let barGap: CGFloat
|
||||||
|
let fill: CGColor
|
||||||
|
let barColor: CGColor
|
||||||
|
}
|
||||||
|
|
||||||
|
private struct Layout {
|
||||||
|
let size: Int
|
||||||
|
let scale: CGFloat
|
||||||
|
let tile: CGRect
|
||||||
|
let tileRadius: CGFloat
|
||||||
|
let bubbles: [Bubble]
|
||||||
|
let shadow: (offset: CGSize, blur: CGFloat, opacity: CGFloat)?
|
||||||
|
|
||||||
|
init(size: Int) {
|
||||||
|
self.size = size
|
||||||
|
scale = CGFloat(size) / Design.canvas
|
||||||
|
tile = CGRect(x: Design.tileInset, y: Design.tileInset, width: Design.tileSize, height: Design.tileSize)
|
||||||
|
tileRadius = Design.tileRadius
|
||||||
|
|
||||||
|
let simplified = size <= 32
|
||||||
|
let barThickness = Design.canvas * (simplified ? 0.075 : 0.045)
|
||||||
|
let barGap = barThickness * (simplified ? 1.15 : 0.85)
|
||||||
|
let tailStroke = Design.canvas * (simplified ? 0.05 : 0.030)
|
||||||
|
|
||||||
|
if simplified {
|
||||||
|
let width = tile.width * 0.76
|
||||||
|
let height = tile.height * 0.56
|
||||||
|
let rect = CGRect(
|
||||||
|
x: tile.midX - width / 2,
|
||||||
|
y: tile.minY + tile.height * 0.52 - height / 2,
|
||||||
|
width: width,
|
||||||
|
height: height
|
||||||
|
)
|
||||||
|
let tail = [
|
||||||
|
CGPoint(x: rect.minX + width * 0.24, y: rect.minY + barThickness * 0.8),
|
||||||
|
CGPoint(x: rect.minX + width * 0.10, y: rect.minY - height * 0.13),
|
||||||
|
CGPoint(x: rect.minX + width * 0.44, y: rect.minY + barThickness * 0.8),
|
||||||
|
]
|
||||||
|
bubbles = [
|
||||||
|
Bubble(
|
||||||
|
rect: rect,
|
||||||
|
radius: height * 0.26,
|
||||||
|
tail: tail,
|
||||||
|
bars: [width * 0.62, width * 0.40],
|
||||||
|
barHeight: barThickness,
|
||||||
|
barGap: barGap,
|
||||||
|
fill: Design.glyph,
|
||||||
|
barColor: Design.bar
|
||||||
|
),
|
||||||
|
]
|
||||||
|
} else {
|
||||||
|
let backWidth = tile.width * 0.56
|
||||||
|
let backHeight = tile.height * 0.33
|
||||||
|
let backRect = CGRect(
|
||||||
|
x: tile.minX + tile.width * 0.06,
|
||||||
|
y: tile.minY + tile.height * 0.34,
|
||||||
|
width: backWidth,
|
||||||
|
height: backHeight
|
||||||
|
)
|
||||||
|
let backTail = [
|
||||||
|
CGPoint(x: backRect.minX + backWidth * 0.18, y: backRect.minY + tailStroke * 0.7),
|
||||||
|
CGPoint(x: backRect.minX + backWidth * 0.02, y: backRect.minY - backHeight * 0.16),
|
||||||
|
CGPoint(x: backRect.minX + backWidth * 0.40, y: backRect.minY + tailStroke * 0.7),
|
||||||
|
]
|
||||||
|
let back = Bubble(
|
||||||
|
rect: backRect,
|
||||||
|
radius: backHeight * 0.26,
|
||||||
|
tail: backTail,
|
||||||
|
bars: [backWidth * 0.62, backWidth * 0.45, backWidth * 0.30],
|
||||||
|
barHeight: barThickness,
|
||||||
|
barGap: barGap,
|
||||||
|
fill: Design.bar,
|
||||||
|
barColor: Design.glyph
|
||||||
|
)
|
||||||
|
|
||||||
|
let frontWidth = tile.width * 0.48
|
||||||
|
let frontHeight = tile.height * 0.30
|
||||||
|
let frontRect = CGRect(
|
||||||
|
x: tile.maxX - tile.width * 0.06 - frontWidth,
|
||||||
|
y: tile.minY + tile.height * 0.18,
|
||||||
|
width: frontWidth,
|
||||||
|
height: frontHeight
|
||||||
|
)
|
||||||
|
let frontTail = [
|
||||||
|
CGPoint(x: frontRect.maxX - frontWidth * 0.18, y: frontRect.minY + tailStroke * 0.7),
|
||||||
|
CGPoint(x: frontRect.maxX - frontWidth * 0.02, y: frontRect.minY - frontHeight * 0.16),
|
||||||
|
CGPoint(x: frontRect.maxX - frontWidth * 0.40, y: frontRect.minY + tailStroke * 0.7),
|
||||||
|
]
|
||||||
|
let front = Bubble(
|
||||||
|
rect: frontRect,
|
||||||
|
radius: frontHeight * 0.26,
|
||||||
|
tail: frontTail,
|
||||||
|
bars: [frontWidth * 0.62, frontWidth * 0.40],
|
||||||
|
barHeight: barThickness,
|
||||||
|
barGap: barGap,
|
||||||
|
fill: Design.glyph,
|
||||||
|
barColor: Design.bar
|
||||||
|
)
|
||||||
|
bubbles = [back, front]
|
||||||
|
}
|
||||||
|
|
||||||
|
shadow = size >= 128 ? (CGSize(width: 0, height: -8), 26, 0.32) : nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func roundedRect(_ rect: CGRect, _ radius: CGFloat) -> CGPath {
|
||||||
|
CGPath(roundedRect: rect, cornerWidth: radius, cornerHeight: radius, transform: nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
private func render(size: Int) -> CGImage? {
|
||||||
|
let layout = Layout(size: size)
|
||||||
|
let colorSpace = CGColorSpace(name: CGColorSpace.sRGB)!
|
||||||
|
guard let context = CGContext(
|
||||||
|
data: nil,
|
||||||
|
width: size,
|
||||||
|
height: size,
|
||||||
|
bitsPerComponent: 8,
|
||||||
|
bytesPerRow: 0,
|
||||||
|
space: colorSpace,
|
||||||
|
bitmapInfo: CGImageAlphaInfo.premultipliedLast.rawValue
|
||||||
|
) else { return nil }
|
||||||
|
|
||||||
|
context.setAllowsAntialiasing(true)
|
||||||
|
context.setShouldAntialias(true)
|
||||||
|
context.interpolationQuality = .high
|
||||||
|
context.clear(CGRect(x: 0, y: 0, width: size, height: size))
|
||||||
|
context.scaleBy(x: layout.scale, y: layout.scale)
|
||||||
|
|
||||||
|
let tilePath = roundedRect(layout.tile, layout.tileRadius)
|
||||||
|
context.saveGState()
|
||||||
|
if let shadow = layout.shadow {
|
||||||
|
context.setShadow(
|
||||||
|
offset: shadow.offset,
|
||||||
|
blur: shadow.blur,
|
||||||
|
color: CGColor(colorSpace: colorSpace, components: [0, 0, 0, shadow.opacity])
|
||||||
|
)
|
||||||
|
}
|
||||||
|
context.addPath(tilePath)
|
||||||
|
context.setFillColor(Design.gradientBottom)
|
||||||
|
context.fillPath()
|
||||||
|
context.restoreGState()
|
||||||
|
|
||||||
|
let gradient = CGGradient(
|
||||||
|
colorsSpace: colorSpace,
|
||||||
|
colors: [Design.gradientTop, Design.gradientBottom] as CFArray,
|
||||||
|
locations: [0, 1]
|
||||||
|
)!
|
||||||
|
context.saveGState()
|
||||||
|
context.addPath(tilePath)
|
||||||
|
context.clip()
|
||||||
|
context.drawLinearGradient(
|
||||||
|
gradient,
|
||||||
|
start: CGPoint(x: layout.tile.midX, y: layout.tile.maxY),
|
||||||
|
end: CGPoint(x: layout.tile.midX, y: layout.tile.minY),
|
||||||
|
options: []
|
||||||
|
)
|
||||||
|
context.restoreGState()
|
||||||
|
|
||||||
|
for bubble in layout.bubbles {
|
||||||
|
context.setFillColor(bubble.fill)
|
||||||
|
context.beginPath()
|
||||||
|
context.addLines(between: bubble.tail)
|
||||||
|
context.closePath()
|
||||||
|
context.fillPath()
|
||||||
|
context.addPath(roundedRect(bubble.rect, bubble.radius))
|
||||||
|
context.fillPath()
|
||||||
|
|
||||||
|
let totalHeight = CGFloat(bubble.bars.count) * bubble.barHeight
|
||||||
|
+ CGFloat(bubble.bars.count - 1) * bubble.barGap
|
||||||
|
var y = bubble.rect.midY + totalHeight / 2 - bubble.barHeight
|
||||||
|
let x = bubble.rect.minX + bubble.rect.width * 0.16
|
||||||
|
context.setFillColor(bubble.barColor)
|
||||||
|
for width in bubble.bars {
|
||||||
|
context.addPath(roundedRect(
|
||||||
|
CGRect(x: x, y: y, width: width, height: bubble.barHeight),
|
||||||
|
bubble.barHeight / 2
|
||||||
|
))
|
||||||
|
context.fillPath()
|
||||||
|
y -= bubble.barHeight + bubble.barGap
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return context.makeImage()
|
||||||
|
}
|
||||||
|
|
||||||
|
private let slots: [(name: String, pixels: Int)] = [
|
||||||
|
("icon_16x16.png", 16),
|
||||||
|
("icon_16x16@2x.png", 32),
|
||||||
|
("icon_32x32.png", 32),
|
||||||
|
("icon_32x32@2x.png", 64),
|
||||||
|
("icon_128x128.png", 128),
|
||||||
|
("icon_128x128@2x.png", 256),
|
||||||
|
("icon_256x256.png", 256),
|
||||||
|
("icon_256x256@2x.png", 512),
|
||||||
|
("icon_512x512.png", 512),
|
||||||
|
("icon_512x512@2x.png", 1024),
|
||||||
|
]
|
||||||
|
|
||||||
|
private let contents = """
|
||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{ "filename" : "icon_16x16.png", "idiom" : "mac", "scale" : "1x", "size" : "16x16" },
|
||||||
|
{ "filename" : "icon_16x16@2x.png", "idiom" : "mac", "scale" : "2x", "size" : "16x16" },
|
||||||
|
{ "filename" : "icon_32x32.png", "idiom" : "mac", "scale" : "1x", "size" : "32x32" },
|
||||||
|
{ "filename" : "icon_32x32@2x.png", "idiom" : "mac", "scale" : "2x", "size" : "32x32" },
|
||||||
|
{ "filename" : "icon_128x128.png", "idiom" : "mac", "scale" : "1x", "size" : "128x128" },
|
||||||
|
{ "filename" : "icon_128x128@2x.png", "idiom" : "mac", "scale" : "2x", "size" : "128x128" },
|
||||||
|
{ "filename" : "icon_256x256.png", "idiom" : "mac", "scale" : "1x", "size" : "256x256" },
|
||||||
|
{ "filename" : "icon_256x256@2x.png", "idiom" : "mac", "scale" : "2x", "size" : "256x256" },
|
||||||
|
{ "filename" : "icon_512x512.png", "idiom" : "mac", "scale" : "1x", "size" : "512x512" },
|
||||||
|
{ "filename" : "icon_512x512@2x.png", "idiom" : "mac", "scale" : "2x", "size" : "512x512" }
|
||||||
|
],
|
||||||
|
"info" : { "author" : "xcode", "version" : 1 }
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
private let assetCatalogContents = """
|
||||||
|
{
|
||||||
|
"info" : { "author" : "xcode", "version" : 1 }
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
private func writePNG(_ image: CGImage, to url: URL) throws {
|
||||||
|
guard let destination = CGImageDestinationCreateWithURL(
|
||||||
|
url as CFURL,
|
||||||
|
UTType.png.identifier as CFString,
|
||||||
|
1,
|
||||||
|
nil
|
||||||
|
) else {
|
||||||
|
throw NSError(domain: "icon", code: 1, userInfo: [NSLocalizedDescriptionKey: "cannot write \(url.path)"])
|
||||||
|
}
|
||||||
|
CGImageDestinationAddImage(destination, image, nil)
|
||||||
|
guard CGImageDestinationFinalize(destination) else {
|
||||||
|
throw NSError(domain: "icon", code: 2, userInfo: [NSLocalizedDescriptionKey: "cannot finish \(url.path)"])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func writePreview(to url: URL) throws {
|
||||||
|
let width = 1240
|
||||||
|
let height = 640
|
||||||
|
let colorSpace = CGColorSpace(name: CGColorSpace.sRGB)!
|
||||||
|
guard let context = CGContext(
|
||||||
|
data: nil,
|
||||||
|
width: width,
|
||||||
|
height: height,
|
||||||
|
bitsPerComponent: 8,
|
||||||
|
bytesPerRow: 0,
|
||||||
|
space: colorSpace,
|
||||||
|
bitmapInfo: CGImageAlphaInfo.premultipliedLast.rawValue
|
||||||
|
) else { return }
|
||||||
|
|
||||||
|
context.setFillColor(Design.srgb(0xEC, 0xEC, 0xEE))
|
||||||
|
context.fill(CGRect(x: 0, y: 0, width: width, height: height / 2))
|
||||||
|
context.setFillColor(Design.srgb(0x1C, 0x1C, 0x1E))
|
||||||
|
context.fill(CGRect(x: 0, y: height / 2, width: width, height: height / 2))
|
||||||
|
|
||||||
|
var x = 40
|
||||||
|
for size in [16, 32, 64, 128, 256] {
|
||||||
|
if let image = render(size: size) {
|
||||||
|
context.draw(image, in: CGRect(x: x, y: height / 2 + 40, width: size, height: size))
|
||||||
|
context.draw(image, in: CGRect(x: x, y: 40, width: size, height: size))
|
||||||
|
}
|
||||||
|
x += size + 50
|
||||||
|
}
|
||||||
|
|
||||||
|
x += 20
|
||||||
|
for size in [16, 32] {
|
||||||
|
guard let image = render(size: size) else { continue }
|
||||||
|
let scale = 8
|
||||||
|
let side = size * scale
|
||||||
|
context.saveGState()
|
||||||
|
context.interpolationQuality = .none
|
||||||
|
context.draw(image, in: CGRect(x: x, y: height / 2 - side / 2, width: side, height: side))
|
||||||
|
context.restoreGState()
|
||||||
|
x += side + 40
|
||||||
|
}
|
||||||
|
|
||||||
|
guard let image = context.makeImage() else { return }
|
||||||
|
try writePNG(image, to: url)
|
||||||
|
}
|
||||||
|
|
||||||
|
private let root = URL(fileURLWithPath: #filePath)
|
||||||
|
.deletingLastPathComponent()
|
||||||
|
.deletingLastPathComponent()
|
||||||
|
private let assetCatalog = root
|
||||||
|
.appendingPathComponent("App/Resources/Assets.xcassets", isDirectory: true)
|
||||||
|
private let iconSet = assetCatalog.appendingPathComponent("AppIcon.appiconset", isDirectory: true)
|
||||||
|
|
||||||
|
do {
|
||||||
|
try FileManager.default.createDirectory(at: iconSet, withIntermediateDirectories: true)
|
||||||
|
try assetCatalogContents.write(
|
||||||
|
to: assetCatalog.appendingPathComponent("Contents.json"),
|
||||||
|
atomically: true,
|
||||||
|
encoding: .utf8
|
||||||
|
)
|
||||||
|
try contents.write(to: iconSet.appendingPathComponent("Contents.json"), atomically: true, encoding: .utf8)
|
||||||
|
|
||||||
|
for slot in slots {
|
||||||
|
guard let image = render(size: slot.pixels) else {
|
||||||
|
throw NSError(domain: "icon", code: 3, userInfo: [NSLocalizedDescriptionKey: "render failed at \(slot.pixels)"])
|
||||||
|
}
|
||||||
|
try writePNG(image, to: iconSet.appendingPathComponent(slot.name))
|
||||||
|
}
|
||||||
|
|
||||||
|
let previewDirectory = root.appendingPathComponent(".build", isDirectory: true)
|
||||||
|
try FileManager.default.createDirectory(at: previewDirectory, withIntermediateDirectories: true)
|
||||||
|
try writePreview(to: previewDirectory.appendingPathComponent("icon-preview.png"))
|
||||||
|
|
||||||
|
print("wrote \(slots.count) icons to \(iconSet.path)")
|
||||||
|
print("preview: \(previewDirectory.appendingPathComponent("icon-preview.png").path)")
|
||||||
|
} catch {
|
||||||
|
FileHandle.standardError.write(Data("error: \(error.localizedDescription)\n".utf8))
|
||||||
|
exit(1)
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Build a local, unnotarised DMG from the Release build. For testing/internal sharing only; use
|
||||||
|
# scripts/release.sh for a Developer ID signed and notarised distribution image.
|
||||||
|
set -euo pipefail
|
||||||
|
cd "$(dirname "$0")/.."
|
||||||
|
|
||||||
|
app="Sprachmittler"
|
||||||
|
release_app=".build/xcode-release/Build/Products/Release/$app.app"
|
||||||
|
dist="${DMG_DIR:-dist}"
|
||||||
|
|
||||||
|
[[ "$(uname -s)" == "Darwin" && "$(uname -m)" == "arm64" ]] \
|
||||||
|
|| { echo "error: Sprachmittler requires an Apple Silicon Mac" >&2; exit 1; }
|
||||||
|
[[ -d "$release_app" ]] || { echo "error: $release_app not found — run 'make release-build'" >&2; exit 1; }
|
||||||
|
|
||||||
|
step() { printf '\n\033[1m▶ %s\033[0m\n' "$*"; }
|
||||||
|
|
||||||
|
check_app() {
|
||||||
|
local candidate="$1"
|
||||||
|
scripts/check-signature.sh "$candidate" install
|
||||||
|
}
|
||||||
|
|
||||||
|
step "Check Release build"
|
||||||
|
check_app "$release_app"
|
||||||
|
version=$(/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" "$release_app/Contents/Info.plist")
|
||||||
|
[[ -n "$version" ]] || { echo "error: cannot read CFBundleShortVersionString" >&2; exit 1; }
|
||||||
|
dmg="$dist/$app-$version-local.dmg"
|
||||||
|
|
||||||
|
stage=$(mktemp -d)
|
||||||
|
mountpoint=$(mktemp -d)
|
||||||
|
mounted=0
|
||||||
|
cleanup() {
|
||||||
|
if [[ $mounted -eq 1 ]]; then hdiutil detach "$mountpoint" -quiet || true; fi
|
||||||
|
rm -rf "$stage" "$mountpoint"
|
||||||
|
}
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
step "Stage $app $version"
|
||||||
|
ditto "$release_app" "$stage/$app.app"
|
||||||
|
ln -s /Applications "$stage/Applications"
|
||||||
|
|
||||||
|
step "Create $dmg"
|
||||||
|
mkdir -p "$dist"
|
||||||
|
rm -f "$dmg"
|
||||||
|
if diskutil image create from --help >/dev/null 2>&1; then
|
||||||
|
if ! output=$(diskutil image create from "$stage" "$dmg" --volumeName "$app" --format UDZO 2>&1); then
|
||||||
|
printf '%s\n' "$output" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
hdiutil create -volname "$app" -srcfolder "$stage" -ov -format UDZO "$dmg" >/dev/null
|
||||||
|
fi
|
||||||
|
hdiutil verify "$dmg" >/dev/null
|
||||||
|
|
||||||
|
step "Verify mounted image"
|
||||||
|
hdiutil attach "$dmg" -readonly -nobrowse -noautoopen -quiet -mountpoint "$mountpoint"
|
||||||
|
mounted=1
|
||||||
|
check_app "$mountpoint/$app.app"
|
||||||
|
[[ -L "$mountpoint/Applications" ]] \
|
||||||
|
|| { echo "error: Applications link missing from the image" >&2; exit 1; }
|
||||||
|
hdiutil detach "$mountpoint" -quiet
|
||||||
|
mounted=0
|
||||||
|
|
||||||
|
printf '\n\033[32m✔ %s\033[0m\n' "$dmg"
|
||||||
|
printf ' size %s\n' "$(du -h "$dmg" | cut -f1)"
|
||||||
|
printf ' sha256 %s\n' "$(shasum -a 256 "$dmg" | cut -d' ' -f1)"
|
||||||
|
cat <<'TXT'
|
||||||
|
|
||||||
|
Ad-hoc signed and not notarised: this image is for testing and internal sharing only.
|
||||||
|
On another Mac, open it via right-click ▸ Open (or System Settings ▸ Privacy & Security ▸ Open Anyway).
|
||||||
|
For distribution use scripts/release.sh with a Developer ID identity and a notarytool profile.
|
||||||
|
TXT
|
||||||