-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathjustfile
108 lines (75 loc) · 2.5 KB
/
justfile
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
rootdir := ''
prefix := x"~/.local"
debug := '0'
name := 'configurator'
appid := 'io.github.cosmic_utils.' + name
cargo-target-dir := env('CARGO_TARGET_DIR', 'target')
bin-src := cargo-target-dir / if debug == '1' { 'debug' / name } else { 'release' / name }
base-dir := absolute_path(clean(rootdir / prefix))
share-dst := base-dir / 'share'
bin-dst := base-dir / 'bin' / name
desktop-dst := share-dst / 'applications' / appid + '.desktop'
icon-dst := share-dst / 'icons/hicolor/scalable/apps' / appid + '.svg'
env-dst := rootdir / 'etc/profile.d' / name + '.sh'
schema-dst := share-dst / 'configurator' / appid + '.json'
default: build-release
run:
cargo r --bin configurator
build-debug *args:
cargo build {{args}}
build-release *args:
cargo build --release {{args}}
install:
install -Dm0755 {{bin-src}} {{bin-dst}}
install -Dm0644 res/desktop_entry.desktop {{desktop-dst}}
install -Dm0644 res/app_icon.svg {{icon-dst}}
install -Dm0644 res/config_schema.json {{schema-dst}}
# call before pull request
pull: fmt prettier fix test
gen_schema:
cargo test --package configurator config::test::gen_schema -- --ignored
uninstall:
rm {{bin-dst}}
rm {{desktop-dst}}
rm {{icon-dst}}
rm {{schema-dst}}
# require to git clone https://github.com/json-schema-org/JSON-Schema-Test-Suite
test_suite:
cargo test test_all_suite -- --nocapture --ignored
################### Test
test:
cargo test --workspace --all-features
################### Format
fix:
cargo clippy --workspace --all-features --fix --allow-dirty --allow-staged
fmt:
cargo fmt --all
prettier:
# install on Debian: sudo snap install node --classic
# npx is the command to run npm package, node is the runtime
npx prettier -w .
# todo: add to CI when ubuntu-image get appstream version 1.0
metainfo-check:
appstreamcli validate --pedantic --explain --strict res/metainfo.xml
# flatpak
setupf:
rm -rf flatpak-builder-tools
git clone https://github.com/flatpak/flatpak-builder-tools
pip install aiohttp toml
sources_gen:
python3 flatpak-builder-tools/cargo/flatpak-cargo-generator.py ./Cargo.lock -o cargo-sources.json
uninstallf:
flatpak uninstall io.github.cosmic_utils.configurator -y || true
# deps: flatpak-builder git-lfs
build_and_install: uninstallf
flatpak-builder \
--force-clean \
--verbose \
--ccache \
--user --install \
--install-deps-from=flathub \
--repo=repo \
flatpak-out \
io.github.cosmic_utils.configurator.json
runf:
flatpak run io.github.cosmic_utils.configurator