-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjustfile
143 lines (95 loc) · 2.99 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
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
# Not a UUID, I know. Blame Elgato.
UUID := "ca.michaelabon.logitech-litra-lights"
GO := "go"
GOFLAGS := ""
PLUGIN := UUID + ".sdPlugin"
DISTRIBUTION_TOOL := "$HOME/.bin/DistributionTool"
TARGET := "build/streamdeck-logitech-litra-lights"
set windows-shell := ["powershell.exe", "-c"]
## BUILD
[macos]
build:
CC=x86_64-w64-mingw32-gcc CGO_ENABLED=1 GOOS=windows GOARCH=amd64 {{ GO }} build -C go {{ GOFLAGS }} -o ../{{ PLUGIN }}/{{ TARGET }}.exe .
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 {{ GO }} build -C go {{ GOFLAGS }} -o ../{{ PLUGIN }}/{{ TARGET }} .
# WSL support
[linux]
build:
CC=x86_64-w64-mingw32-gcc CGO_ENABLED=1 GOOS=windows GOARCH=amd64 {{ GO }} build -C go {{ GOFLAGS }} -o ../{{ PLUGIN }}/{{ TARGET }}.exe .
touch {{ PLUGIN }}/{{ TARGET }} # Stream Deck complains about a missing Mac binary while on Windows. (Why??)
clean:
rm {{ PLUGIN }}/{{ TARGET }}
rm {{ PLUGIN }}/{{ TARGET }}.exe
rm {{ PLUGIN }}/logs/*
## INSTALL DEV DEPENDENCIES
[windows]
install: _install-submodules _install-go-tools
[macos]
install: _install-submodules _install-go-tools
brew install mingw-w64
[linux] ## WSL support
install: _install-go-tools
sudo apt install gcc-mingw-w64
_install-submodules:
git submodule update --init --recursive
cd ./go && go mod download
_install-go-tools:
go install github.com/daixiang0/gci@latest
go install mvdan.cc/gofumpt@latest
go install github.com/segmentio/golines@latest
## LINK
## You only need to do this one time.
## It connects your output directory to your Stream Deck
[macos]
link:
ln -s \
"{{ justfile_directory() }}/{{ PLUGIN }}" \
"$HOME/Library/Application Support/com.elgato.StreamDeck/Plugins"
[windows]
link:
mklink /D "%AppData%\Elgato\StreamDeck\Plugins\{{ PLUGIN }}" "{{ justfile_directory() }}/{{ PLUGIN }}"
[macos]
unlink:
unlink "$HOME/Library/Application Support/com.elgato.StreamDeck/Plugins/{{ PLUGIN }}"
## TEST
## Run unit tests
test:
go test -C go ./...
## LINT
## Ensure that all the files are formatted correctly.
[windows]
lint:
cd go && gci write .
gofumpt -w ./go
golines -w ./go
[macos, linux]
lint:
cd go && gci write .
gofumpt -w ./go
golines -w ./go
find ./go ./{{ PLUGIN }}/icons -type f -name '*.svg' -exec xmllint --pretty 2 --output '{}' '{}' \;
## DEBUG & RESTART
## Useful for local development
[macos]
debug:
open "http://localhost:23654/"
[windows]
debug:
start "" "http://localhost:23654/"
start:
npx streamdeck restart {{ UUID }}
restart: start
## PACKAGE
## Package the plugin for distribution to Elgato
package:
mkdir -p build
{{ DISTRIBUTION_TOOL }} -b -i {{ PLUGIN }} -o build/
## LOGS
[macos]
logs-streamdeck:
cd "$HOME/Library/Logs/ElgatoStreamDeck" && cat $(ls -ltr | awk '{print $9}')
[windows]
logs-streamdeck:
cd "%appdata%\Elgato\StreamDeck\logs\"
## VERSIONING
bump version:
yq --inplace --prettyPrint --output-format json '.Version = "{{ version }}"' {{ PLUGIN }}/manifest.json