forked from vakovalskii/copyosity
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
157 lines (118 loc) · 5.47 KB
/
Copy pathMakefile
File metadata and controls
157 lines (118 loc) · 5.47 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
APP_DIR ?= $(CURDIR)
SHELL := /bin/bash
export PATH := $(HOME)/.cargo/bin:$(PATH)
NPM := env -u npm_config_devdir npm
OLLAMA_MODEL ?= qwen3:4b-instruct-2507-q4_K_M
OLLAMA_DEBUG ?= 1
TAURI_DIR := $(APP_DIR)/src-tauri
RUST_RUN = bash "$(APP_DIR)/scripts/run-rust.sh"
.PHONY: help dev build install preview-readme \
check check-frontend check-backend \
lint lint-frontend lint-backend \
fix fix-frontend fix-backend \
verify-tray verify-tray-startup verify-tray-dev \
_verify-rust-env _compile-backend _test-backend \
clean-cache clean-cache-aggressive clean-all \
build-macos build-macos-intel build-macos-arm \
release-macos release-macos-intel release-macos-arm notarize-wait notarize-info
# --- Public command contract ---
help:
@echo "Development:"
@echo " make dev Run the Tauri development app"
@echo " make build Build the Tauri app"
@echo " make install Install npm dependencies"
@echo " make preview-readme GitHub-style README preview (grip, http://localhost:6419)"
@echo ""
@echo "Validation:"
@echo " make fix Auto-fix frontend and backend issues"
@echo " make lint Verify lint and formatting without changes"
@echo " make check Run type checks, compilation, lint, and tests"
@echo " make fix-frontend Auto-fix frontend issues only"
@echo " make lint-frontend Verify frontend lint and formatting"
@echo " make check-frontend Run frontend type checks, lint, and formatting"
@echo " make fix-backend Auto-fix Rust formatting and Clippy issues"
@echo " make lint-backend Verify Rust lint and formatting"
@echo " make check-backend Run Rust compile checks, lint, and tests"
@echo ""
@echo "macOS smoke (local, requires Accessibility):"
@echo " make verify-tray Tray menu blink check (debug binary + tauri dev)"
@echo " make verify-tray-startup Tray menu on cargo-built binary"
@echo " make verify-tray-dev Tray menu under tauri dev + Vite"
@echo ""
@echo "Recommended cycles:"
@echo " Frontend-only: make fix-frontend && make check-frontend"
@echo " Backend-only: make fix-backend && make check-backend"
@echo " Full-stack: make fix && make check"
# --- App lifecycle ---
dev:
cd $(APP_DIR) && COPYOSITY_OLLAMA_MODEL='$(OLLAMA_MODEL)' COPYOSITY_DEBUG_OLLAMA='$(OLLAMA_DEBUG)' $(NPM) run tauri dev
build:
cd $(APP_DIR) && COPYOSITY_OLLAMA_MODEL='$(OLLAMA_MODEL)' COPYOSITY_DEBUG_OLLAMA='$(OLLAMA_DEBUG)' $(NPM) run tauri build
install:
cd $(APP_DIR) && $(NPM) install
preview-readme:
cd $(APP_DIR) && grip README.md
# --- Validation workflows ---
check: check-frontend check-backend
check-frontend:
cd $(APP_DIR) && $(NPM) run check
check-backend: _verify-rust-env _compile-backend lint-backend _test-backend
lint: lint-frontend lint-backend
lint-frontend:
cd $(APP_DIR) && $(NPM) run lint
lint-backend:
$(RUST_RUN) 'cargo clippy --all-targets -- -D warnings && cargo fmt --check'
fix: fix-frontend fix-backend
fix-frontend:
cd $(APP_DIR) && $(NPM) run fix
fix-backend:
$(RUST_RUN) 'cargo fmt && cargo clippy --fix --allow-dirty --allow-staged --all-targets -- -D warnings && cargo fmt'
# --- Backend internals ---
_verify-rust-env:
bash "$(APP_DIR)/scripts/check-rust-env.sh"
_compile-backend:
$(RUST_RUN) 'cargo check'
_test-backend:
$(RUST_RUN) 'cargo test'
# --- macOS tray smoke (not part of make check; needs GUI + Accessibility) ---
verify-tray: verify-tray-startup verify-tray-dev
verify-tray-startup:
bash "$(APP_DIR)/scripts/verify-tray-startup.sh"
verify-tray-dev:
bash "$(APP_DIR)/scripts/verify-tray-dev.sh"
# --- Cache cleanup ---
clean-cache:
@echo "[clean-cache] release builds, incremental cache, frontend output (debug deps kept)"
cd $(TAURI_DIR) && cargo clean --release
find $(TAURI_DIR)/target -type d -name incremental -exec rm -rf {} + 2>/dev/null || true
rm -rf $(APP_DIR)/dist $(APP_DIR)/.svelte-kit $(APP_DIR)/build $(TAURI_DIR)/bundle
@echo "[clean-cache] done"
clean-cache-aggressive: clean-cache
@echo "[clean-cache-aggressive] build-script cache + copyosity crate artifacts (third-party deps kept)"
find $(TAURI_DIR)/target -type d -path '*/debug/build' -exec rm -rf {} + 2>/dev/null || true
cd $(TAURI_DIR) && cargo clean -p copyosity
@echo "[clean-cache-aggressive] done"
clean-all:
@echo "[clean-all] target, node_modules, frontend cache, bundles"
cd $(TAURI_DIR) && cargo clean
rm -rf $(APP_DIR)/node_modules $(APP_DIR)/dist $(APP_DIR)/.svelte-kit $(APP_DIR)/build
rm -rf $(TAURI_DIR)/bundle $(APP_DIR)/.tauri
rm -f $(APP_DIR)/*.dmg
@echo "[clean-all] done — run 'make install' before dev/build if node_modules was removed"
# --- macOS release builds ---
build-macos:
cd $(APP_DIR) && MACOS_ARCH=auto ./scripts/build-macos.sh
build-macos-intel:
cd $(APP_DIR) && MACOS_ARCH=x86_64 ./scripts/build-macos.sh
build-macos-arm:
cd $(APP_DIR) && MACOS_ARCH=aarch64 ./scripts/build-macos.sh
release-macos:
cd $(APP_DIR) && MACOS_ARCH=auto KEYCHAIN_PROFILE='AC_PASSWORD' WAIT_FOR_NOTARIZATION=0 ./scripts/release-macos.sh
release-macos-intel:
cd $(APP_DIR) && MACOS_ARCH=x86_64 KEYCHAIN_PROFILE='AC_PASSWORD' WAIT_FOR_NOTARIZATION=0 ./scripts/release-macos.sh
release-macos-arm:
cd $(APP_DIR) && MACOS_ARCH=aarch64 KEYCHAIN_PROFILE='AC_PASSWORD' WAIT_FOR_NOTARIZATION=0 ./scripts/release-macos.sh
notarize-info:
cd $(APP_DIR) && xcrun notarytool info "$$(cat .last_notarization_id)" --keychain-profile AC_PASSWORD
notarize-wait:
cd $(APP_DIR) && xcrun notarytool wait "$$(cat .last_notarization_id)" --keychain-profile AC_PASSWORD