-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
242 lines (226 loc) · 5.43 KB
/
Taskfile.yml
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# https://taskfile.dev
---
version: '3'
vars:
RACE_FLAG: ''
tasks:
## prod build commands
build:
desc: Build for production
deps: [clean]
cmds:
- task: build:server
- task: build:task
- task: build:gtk
build:server:
desc: Build server for production
aliases:
- build:s
deps: [build:discover]
cmds:
- task: build:go
vars: {SUFFIX: server}
silent: true
build:task:
desc: Build task for production
aliases:
- build:t
cmds:
- task: build:go
vars: {SUFFIX: task}
silent: true
build:gtk:
desc: Build gtk for production
aliases:
- build:g
cmds:
- task: build:go
vars: {SUFFIX: gtk}
silent: true
build:discover:
internal: true
cmds:
- task: build:go
vars: {SUFFIX: discover}
build:go:
internal: true
cmds:
- >
go build -ldflags='-s -w' -gcflags=-l -trimpath
-o ./m3uetc-{{.SUFFIX}}{{exeExt}} ./cmd/m3uetc-{{.SUFFIX}}
## dev build commands
dev:
desc: Build for development
cmds:
- task: dev:server
- task: dev:task
- task: dev:gtk
dev:server:
desc: Build server for development
aliases:
- dev:s
deps: [dev:discover]
cmds:
- task: dev:go
vars: {SUFFIX: server, RACE_FLAG: "{{.RACE_FLAG}}"}
silent: true
dev:task:
desc: Build task for development
aliases:
- dev:t
cmds:
- task: dev:go
vars: {SUFFIX: task, RACE_FLAG: "{{.RACE_FLAG}}"}
silent: true
dev:gtk:
desc: Build gtk for development
aliases:
- dev:g
cmds:
- task: dev:go
vars: {SUFFIX: gtk, RACE_FLAG: "{{.RACE_FLAG}}"}
silent: true
dev:discover:
internal: true
cmds:
- task: dev:go
vars: {SUFFIX: discover}
dev:go:
internal: true
cmds:
- >
go build -v {{.RACE_FLAG}} -o ./m3uetc-{{.SUFFIX}}{{exeExt}}
./cmd/m3uetc-{{.SUFFIX}}
## race dev build commands
race:
cmds:
- task: race:server
- task: race:task
- task: race:gtk
race:server:
aliases:
- race:s
cmds:
- task: dev:server
vars: {RACE_FLAG: '-race'}
silent: true
race:task:
aliases:
- race:t
cmds:
- task: dev:task
vars: {RACE_FLAG: '-race'}
silent: true
race:gtk:
aliases:
- race:g
cmds:
- task: dev:gtk
vars: {RACE_FLAG: '-race'}
silent: true
## build packages
deb:build:
desc: Build deb package
deps: [clean]
cmds:
- task: build
- task: deb
deb:dev:
desc: Build deb package with dev flags
deps: [clean]
cmds:
- task: dev
- task: deb
deb:
internal: true
cmds:
- mkdir -p {{.DebPath}}/{DEBIAN,usr/local/{bin,libexec/{{.PkgName}},share/{applications,icons}}}
- cp ./m3uetc-server ./m3uetc-task ./m3uetc-gtk {{.DebPath}}/usr/local/bin
- cp ./m3uetc-discover {{.DebPath}}/usr/local/libexec/{{.PkgName}}/discover
- cp ./data/m3uetc-*.desktop {{.DebPath}}/usr/local/share/applications
- cp ./build/package/deb/control.tpl {{.DebPath}}/DEBIAN/control
- |
set -e
cd ./data/images
cp --parents scalable/m3u-etcetera.svg {{.DebPath}}/usr/local/share/icons
for f in */m3u-etcetera.png
do
cp --parents $f {{.DebPath}}/usr/local/share/icons
done
- cd {{.DebDir}} && dpkg-deb --build {{ .PkgName }}
- mv {{.DebDir}}/{{.PkgName}}.deb ./build
- rm -rf {{.DebDir}} > /dev/null 2>&1 || exit 0
vars:
PkgName: m3u-etcetera
DebDir:
sh: echo $(mktemp -d /tmp/m3uetc-build-deb-XXXXXX)
DebPath:
sh: echo {{.DebDir}}/{{.PkgName}}
changelog:
desc: Show the list of changes since the last tag
deps: [bumpy-exists]
cmds:
- git log $(git describe --tags --abbrev=0)..HEAD --oneline
## protobuf commands
proto:
desc: Process protobuf files
cmds:
- >
protoc --go_out=. --go_opt=paths=source_relative
--go-grpc_out=. --go-grpc_opt=paths=source_relative
api/m3uetcpb/*.proto
## utility commands
clean:
desc: Clean, remove output files
deps: [clean-server, clean-discover, clean-task, clean-gtk, clean-pkg]
silent: true
clean-server:
internal: true
cmds:
- rm m3uetc-server > /dev/null 2>&1
status:
- test ! -f ./m3uetc-server
silent: true
clean-discover:
internal: true
cmds:
- rm m3uetc-discover > /dev/null 2>&1
status:
- test ! -f ./m3uetc-discover
silent: true
clean-task:
internal: true
cmds:
- rm m3uetc-task > /dev/null 2>&1
status:
- test ! -f ./m3uetc-task
silent: true
clean-gtk:
internal: true
cmds:
- rm m3uetc-gtk > /dev/null 2>&1
status:
- test ! -f ./m3uetc-gtk
silent: true
clean-pkg:
internal: true
cmds:
- rm ./build/m3u-etcetera.deb > /dev/null 2>&1 || exit 0
silent: true
convert-icons:
cmds:
- |
set -e
cd ./cmd/m3uetc-gtk/images
cp scalable/m3u-etcetera.svg ./m3u-etcetera-logo.svg
convert 1024x1024/m3u-etcetera.png -resize 150x150 ./m3u-etcetera-logo.png
for s in 512x512 256x256 128x128 96x96 64x64 48x48 32x32 24x24 16x16
do
mkdir -p $s
convert 1024x1024/m3u-etcetera.png -resize $s $s/m3u-etcetera.png
done
bumpy-exists:
internal: true
cmds:
- which bumpy
silent: true