-
-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathMakefile
More file actions
77 lines (62 loc) · 2.28 KB
/
Copy pathMakefile
File metadata and controls
77 lines (62 loc) · 2.28 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
ifeq ($(shell uname -m), arm64)
ARCH := _arm64
else
ARCH :=
endif
OS := $(shell uname -s)
# Updater artifacts (.tar.gz/.zip + .sig) require the signing key, so only
# enable them when TAURI_SIGNING_PRIVATE_KEY is set (release CI). Without it,
# plain bundles are built and local/fork-PR builds keep working.
TAURI_BUILD_ARGS :=
ifdef TAURI_SIGNING_PRIVATE_KEY
TAURI_BUILD_ARGS += --config '{"bundle":{"createUpdaterArtifacts":true}}'
endif
# When src-tauri/modules/ contains staged binaries (e.g. aw-awatcher, aw-sync
# prepared by the activitywatch bundle build), inject them via bundle.resources
# so deb/rpm/AppImage are self-contained. Standalone builds without that dir are
# unchanged. See ActivityWatch/aw-tauri#232.
ifeq ($(OS),Linux)
ifneq ($(wildcard src-tauri/modules/aw-*),)
TAURI_BUILD_ARGS += --config '{"bundle":{"resources":{"modules/":"modules/"}}}'
endif
endif
build: prebuild
# When TAURI_SIGNING_PRIVATE_KEY is present, the Makefile override above sets
# bundle.createUpdaterArtifacts=true. That flag is therefore absent from
# tauri.conf.json even though signed builds produce .sig files.
npm run tauri build -- $(TAURI_BUILD_ARGS)
dev: prebuild
npm run tauri dev
%/.git:
git submodule update --init --recursive
src-tauri/icons/icon.png: aw-webui/.git
mkdir -p src-tauri/icons
npm run tauri icon "./aw-webui/media/logo/logo.png"
aw-webui/dist: aw-webui/.git
cd aw-webui && make build
prebuild: aw-webui/dist node_modules src-tauri/icons/icon.png
precommit: format check
format:
cd src-tauri && cargo fmt
check:
cd src-tauri && cargo check && cargo clippy
package:
ifeq ($(OS),Linux)
rm -rf target/package/aw-tauri
mkdir -p target/package/aw-tauri
cp src-tauri/target/release/bundle/deb/*.deb target/package/aw-tauri/aw-tauri$(ARCH).deb
cp src-tauri/target/release/bundle/rpm/*.rpm target/package/aw-tauri/aw-tauri$(ARCH).rpm
cp src-tauri/target/release/bundle/appimage/*.AppImage target/package/aw-tauri/aw-tauri$(ARCH).AppImage
mkdir -p dist/aw-tauri
rm -rf dist/aw-tauri/*
cp target/package/aw-tauri/* dist/aw-tauri/
else
rm -rf target/package
mkdir -p target/package
cp src-tauri/target/release/aw-tauri target/package/aw-tauri
mkdir -p dist
find dist/ -maxdepth 1 -type f -delete 2>/dev/null || true
cp target/package/* dist/
endif
node_modules: package-lock.json
npm ci