Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
48 lines (40 loc) · 1.93 KB
/
Copy pathMakefile
File metadata and controls
48 lines (40 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# NoteObs — menu bar notes for macOS.
#
# `make verify` is the regression gate: NoteObs/Verification.swift runs its scenarios against real
# folders on disk. It lives in the app target because a Command Line Tools installation has no
# XCTest module, so `swift test` would build fine and run zero tests.
SWIFT ?= swift
BIN_DIR := $(shell $(SWIFT) build -c debug --show-bin-path)
.PHONY: verify build release-app icon clean
build:
$(SWIFT) build
## Runs every scenario in NoteObs/Verification.swift against real folders on disk.
verify:
$(SWIFT) build
$(BIN_DIR)/NoteObs --verify
VERSION := $(shell /usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' NoteObs/Info.plist)
DIST := dist
APP := $(DIST)/NoteObs.app
## Builds the release binary, runs the checks against it, and packs dist/NoteObs.app (signed ad hoc:
## there is no Developer ID here) together with a zip and a dmg of it.
release-app:
$(SWIFT) build -c release
"$$($(SWIFT) build -c release --show-bin-path)/NoteObs" --verify
rm -rf "$(APP)"
mkdir -p "$(APP)/Contents/MacOS" "$(APP)/Contents/Resources"
cp "$$($(SWIFT) build -c release --show-bin-path)/NoteObs" "$(APP)/Contents/MacOS/NoteObs"
cp NoteObs/Info.plist "$(APP)/Contents/Info.plist"
cp Assets/AppIcon.icns "$(APP)/Contents/Resources/AppIcon.icns"
printf 'APPL????' > "$(APP)/Contents/PkgInfo"
codesign --force --sign - --timestamp=none "$(APP)"
codesign --verify --strict "$(APP)"
rm -f "$(DIST)/NoteObs-$(VERSION)-macOS-Release.zip" "$(DIST)/NoteObs.dmg"
cd "$(DIST)" && ditto -c -k --keepParent NoteObs.app "NoteObs-$(VERSION)-macOS-Release.zip"
hdiutil create -quiet -volname NoteObs -srcfolder "$(APP)" -ov -format UDZO "$(DIST)/NoteObs.dmg"
## Redraws Assets/AppIcon.icns from Tools/make-icon.swift (the Big Dipper, one star per note).
icon:
rm -rf .build/AppIcon.iconset
$(SWIFT) Tools/make-icon.swift .build/AppIcon.iconset
iconutil -c icns .build/AppIcon.iconset -o Assets/AppIcon.icns
clean:
rm -rf .build