70 lines
2 KiB
YAML
70 lines
2 KiB
YAML
version: '3'
|
|
|
|
vars:
|
|
APP_NAME: Capswitch
|
|
APP_DIR: build/Capswitch.app
|
|
RELEASE_BINARY: .build/release/Capswitch
|
|
|
|
tasks:
|
|
default:
|
|
cmds:
|
|
- task: verify
|
|
|
|
test:
|
|
desc: Run XCTest on macOS, or report the host limitation on Linux
|
|
cmds:
|
|
- |
|
|
if command -v swift >/dev/null 2>&1 && [ "$(uname -s)" = "Darwin" ]; then
|
|
swift test
|
|
else
|
|
echo "SKIP: Swift/XCTest requires macOS with Command Line Tools"
|
|
fi
|
|
|
|
build:
|
|
desc: Build the macOS executable with SwiftPM
|
|
cmds:
|
|
- |
|
|
if [ "$(uname -s)" != "Darwin" ]; then
|
|
echo "SKIP: macOS build requires Darwin with Command Line Tools"
|
|
exit 0
|
|
fi
|
|
swift build -c release
|
|
|
|
bundle:
|
|
desc: Assemble and ad-hoc sign the menu-bar .app
|
|
deps: [build]
|
|
cmds:
|
|
- |
|
|
if [ "$(uname -s)" != "Darwin" ]; then
|
|
echo "SKIP: macOS app bundle requires Darwin with Command Line Tools"
|
|
exit 0
|
|
fi
|
|
rm -rf "{{.APP_DIR}}"
|
|
mkdir -p "{{.APP_DIR}}/Contents/MacOS" "{{.APP_DIR}}/Contents/Resources"
|
|
cp "{{.RELEASE_BINARY}}" "{{.APP_DIR}}/Contents/MacOS/{{.APP_NAME}}"
|
|
cp Resources/Info.plist "{{.APP_DIR}}/Contents/Info.plist"
|
|
codesign --force --sign - "{{.APP_DIR}}"
|
|
|
|
lint:
|
|
desc: Run host-independent source and bundle checks
|
|
cmds:
|
|
- git diff --check
|
|
- test -f Package.swift
|
|
- test -f Resources/Info.plist
|
|
- test -f Sources/Capswitch/CapsGestureMachine.swift
|
|
- test -f Sources/CapswitchApp/MacOSInputController.swift
|
|
- grep -q "LSUIElement" Resources/Info.plist
|
|
- grep -q ".flagsChanged" Sources/CapswitchApp/MacOSInputController.swift
|
|
- grep -q "TISSelectInputSource" Sources/CapswitchApp/MacOSInputController.swift
|
|
- grep -q "switchToNextInputSource" Sources/Capswitch/CapsGestureMachine.swift
|
|
|
|
clean:
|
|
desc: Remove build outputs
|
|
cmds:
|
|
- rm -rf build .build
|
|
|
|
verify:
|
|
desc: Run all checks available on the current host
|
|
cmds:
|
|
- task: lint
|
|
- task: test
|