@@ -3,6 +3,8 @@ version: '3'
3
3
output : ' group'
4
4
silent : true
5
5
6
+ # we are assuming that host os is always Linux
7
+
6
8
vars :
7
9
DEV_BUILD_DIR : ' build'
8
10
REL_BUILD_DIR : ' release'
@@ -22,20 +24,21 @@ tasks:
22
24
default :
23
25
desc : Builds development version for host OS
24
26
aliases : [debug]
27
+ platforms : [linux]
25
28
deps :
26
29
- task : copy-file
27
- vars : {SRC: '{{joinPath " scripts" " pre-commit"}} ', DST: '{{joinPath " .git" " hooks" " pre-commit"}} '}
30
+ vars : {SRC: 'scripts/ pre-commit', DST: '.git/ hooks/ pre-commit'}
28
31
- task : copy-file
29
- vars : {SRC: '{{joinPath " scripts" " pre-push"}} ', DST: '{{joinPath " .git" " hooks" " pre-push"}} '}
32
+ vars : {SRC: 'scripts/ pre-push', DST: '.git/ hooks/ pre-push'}
30
33
- task : copy-file
31
- vars : {SRC: '{{joinPath " kindlegen" (OS) " kindlegen"}}{{.SUFFIX}} ', DST: '{{joinPath .DEV_BUILD_DIR "kindlegen"}}{{.SUFFIX}} '}
34
+ vars : {SRC: 'kindlegen/linux/ kindlegen', DST: '{{.DEV_BUILD_DIR}}/kindlegen '}
32
35
- task : generate-project-version
33
36
- task : get-dictionaries
34
37
- task : get-sentences
35
38
- task : generate-enums
36
39
cmds :
37
40
- task : go-build
38
- vars : {FLAGS: 'debug', PACKAGE: './cmd/fb2c', TARGET: '{{joinPath .DEV_BUILD_DIR "fb2c"}}{{exeExt}} '}
41
+ vars : {FLAGS: 'debug', PACKAGE: './cmd/fb2c', TARGET: '{{.DEV_BUILD_DIR}}/fb2c '}
39
42
- task : lint
40
43
41
44
test :
44
47
When invoked as usual runs tests for all packages where it can find "*_test.go" files, for example: "task test".
45
48
You can specify what tests to run by using PACKAGES environment variable, for example: "PACKAGES='./hyphenator,./processor' task test".
46
49
You can pass any additional parameters supported by "go test", for example: "PACKAGES='./hyphenator' task test -- -run=TestHyphenatorSpecial".
50
+ platforms : [linux]
47
51
deps : [generate-project-version, get-dictionaries, get-sentences, generate-enums]
48
52
vars :
49
53
TEST_DIR : " {{.ROOT_DIR}}/{{.DEV_BUILD_DIR}}/tests_results"
68
72
When invoked as usual runs benchmarks for all packages where it can find "*_test.go" files, for example: "task bench".
69
73
You can specify what packages to benchmark by using PACKAGES environment variable, for example: "PACKAGES='./cache,./service' task bench".
70
74
You can pass any additional parameters supported by "go test", for example: "PACKAGES='./marshallers/segdiffs' task bench -- -bench=BenchmarkBinary -benchmem".
75
+ platforms : [linux]
71
76
deps : [generate-project-version, get-dictionaries, get-sentences, generate-enums]
72
77
vars :
73
78
TEST_DIR : " {{.ROOT_DIR}}/{{.DEV_BUILD_DIR}}/tests_results"
91
96
Runs escape analisys on specified package.
92
97
You could specify anything in the project, for example "task escape -- ./marshallers/segdiffs".
93
98
If no package is specified assumes "./cmd/goliath".
99
+ platforms : [linux]
94
100
deps : [generate-project-version, get-dictionaries, get-sentences, generate-enums]
95
101
cmds :
96
102
- echo "{{.TATN}}Building binary with escape analisys enabled{{.TOFF}}"
@@ -99,6 +105,7 @@ tasks:
99
105
100
106
release :
101
107
desc : Cross-builds release for all supported platforms
108
+ platforms : [linux]
102
109
deps : [generate-project-version, get-dictionaries, get-sentences]
103
110
cmds :
104
111
- mkdir -p '{{.REL_BUILD_DIR}}'
@@ -117,18 +124,18 @@ tasks:
117
124
label : release-for-platform-windows-{{.GOOS}}-{{.GOARCH}}
118
125
vars :
119
126
BUILD_DIR : ' {{.REL_BUILD_DIR}}_{{.GOOS}}_{{.GOARCH}}'
120
- REL_NAME : ' {{joinPath .REL_BUILD_DIR "fb2c"}} -{{.GOOS}}-{{.GOARCH}}'
127
+ REL_NAME : ' {{.REL_BUILD_DIR}}/fb2c -{{.GOOS}}-{{.GOARCH}}'
121
128
cmds :
122
129
- mkdir -p {{.BUILD_DIR}}
123
130
- defer : rm -rf {{.BUILD_DIR}}
124
131
- task : copy-file
125
- vars : {SRC: '{{joinPath "kindlegen" .GOOS "kindlegen"}} {{.SUFFIX}}', DST: '{{joinPath .BUILD_DIR "fb2converter" "kindlegen"}} {{.SUFFIX}}'}
132
+ vars : {SRC: 'kindlegen/{{ .GOOS}}/kindlegen {{.SUFFIX}}', DST: '{{.BUILD_DIR}}/fb2converter/kindlegen {{.SUFFIX}}'}
126
133
- task : go-build
127
- vars : {GOOS: '{{.GOOS}}', GOARCH: '{{.GOARCH}}', FLAGS: 'release', PACKAGE: './cmd/fb2c', TARGET: '{{joinPath .BUILD_DIR "fb2converter" "fb2c"}} {{.SUFFIX}}'}
134
+ vars : {GOOS: '{{.GOOS}}', GOARCH: '{{.GOARCH}}', FLAGS: 'release', PACKAGE: './cmd/fb2c', TARGET: '{{.BUILD_DIR}}/fb2converter/fb2c {{.SUFFIX}}'}
128
135
- task : go-build
129
- vars : {GOOS: '{{.GOOS}}', GOARCH: '{{.GOARCH}}', FLAGS: 'release', PACKAGE: './cmd/fb2epub', TARGET: '{{joinPath .BUILD_DIR "fb2epub" "fb2epub"}} {{.SUFFIX}}'}
136
+ vars : {GOOS: '{{.GOOS}}', GOARCH: '{{.GOARCH}}', FLAGS: 'release', PACKAGE: './cmd/fb2epub', TARGET: '{{.BUILD_DIR}}/fb2epub/fb2epub {{.SUFFIX}}'}
130
137
- task : go-build
131
- vars : {GOOS: '{{.GOOS}}', GOARCH: '{{.GOARCH}}', FLAGS: 'release', PACKAGE: './cmd/fb2mobi', TARGET: '{{joinPath .BUILD_DIR "fb2mobi" "fb2mobi"}} {{.SUFFIX}}'}
138
+ vars : {GOOS: '{{.GOOS}}', GOARCH: '{{.GOARCH}}', FLAGS: 'release', PACKAGE: './cmd/fb2mobi', TARGET: '{{.BUILD_DIR}}/fb2mobi/fb2mobi {{.SUFFIX}}'}
132
139
- echo "{{.TATN}}Archiving release \"{{.REL_NAME}}.zip\"{{.TOFF}}"
133
140
- 7z a -r -bd -bso0 -tzip {{.REL_NAME}} ./{{.BUILD_DIR}}/*
134
141
status :
@@ -142,14 +149,14 @@ tasks:
142
149
label : release-for-platform-linux-{{.GOOS}}-{{.GOARCH}}
143
150
vars :
144
151
BUILD_DIR : ' {{.REL_BUILD_DIR}}_{{.GOOS}}_{{.GOARCH}}'
145
- REL_NAME : ' {{joinPath .REL_BUILD_DIR "fb2c"}} -{{.GOOS}}-{{.GOARCH}}'
152
+ REL_NAME : ' {{.REL_BUILD_DIR}}/fb2c -{{.GOOS}}-{{.GOARCH}}'
146
153
cmds :
147
154
- mkdir -p {{.BUILD_DIR}}
148
155
- defer : rm -rf {{.BUILD_DIR}}
149
156
- task : copy-file
150
- vars : {SRC: '{{joinPath "kindlegen" .GOOS "kindlegen"}}{{.SUFFIX}} ', DST: '{{joinPath .BUILD_DIR "kindlegen"}}{{.SUFFIX}} '}
157
+ vars : {SRC: 'kindlegen/{{ .GOOS}}/kindlegen ', DST: '{{.BUILD_DIR}}/kindlegen '}
151
158
- task : go-build
152
- vars : {GOOS: '{{.GOOS}}', GOARCH: '{{.GOARCH}}', FLAGS: 'release', PACKAGE: './cmd/fb2c', TARGET: '{{joinPath .BUILD_DIR "fb2c"}}{{.SUFFIX}} '}
159
+ vars : {GOOS: '{{.GOOS}}', GOARCH: '{{.GOARCH}}', FLAGS: 'release', PACKAGE: './cmd/fb2c', TARGET: '{{.BUILD_DIR}}/fb2c '}
153
160
- echo "{{.TATN}}Archiving release \"{{.REL_NAME}}.zip\"{{.TOFF}}"
154
161
- 7z a -r -bd -bso0 -tzip {{.REL_NAME}} ./{{.BUILD_DIR}}/*
155
162
status :
@@ -163,14 +170,14 @@ tasks:
163
170
label : release-for-platform-darwin-{{.GOOS}}-{{.GOARCH}}
164
171
vars :
165
172
BUILD_DIR : ' {{.REL_BUILD_DIR}}_{{.GOOS}}_{{.GOARCH}}'
166
- REL_NAME : ' {{joinPath .REL_BUILD_DIR "fb2c"}} -{{.GOOS}}-{{.GOARCH}}'
173
+ REL_NAME : ' {{.REL_BUILD_DIR}}/fb2c -{{.GOOS}}-{{.GOARCH}}'
167
174
cmds :
168
175
- mkdir -p {{.BUILD_DIR}}
169
176
- defer : rm -rf {{.BUILD_DIR}}
170
177
- task : copy-file
171
- vars : {SRC: '{{joinPath "kindlegen" .GOOS "kindlegen"}} {{.SUFFIX}}', DST: '{{joinPath .BUILD_DIR "kindlegen"}} {{.SUFFIX}}'}
178
+ vars : {SRC: 'kindlegen/{{ .GOOS}}/kindlegen {{.SUFFIX}}', DST: '{{.BUILD_DIR}}/kindlegen {{.SUFFIX}}'}
172
179
- task : go-build
173
- vars : {GOOS: '{{.GOOS}}', GOARCH: '{{.GOARCH}}', FLAGS: 'release', PACKAGE: './cmd/fb2c', TARGET: '{{joinPath .BUILD_DIR "fb2c"}} {{.SUFFIX}}'}
180
+ vars : {GOOS: '{{.GOOS}}', GOARCH: '{{.GOARCH}}', FLAGS: 'release', PACKAGE: './cmd/fb2c', TARGET: '{{.BUILD_DIR}}/fb2c {{.SUFFIX}}'}
174
181
- echo "{{.TATN}}Archiving release \"{{.REL_NAME}}.zip\"{{.TOFF}}"
175
182
- 7z a -r -bd -bso0 -tzip {{.REL_NAME}} ./{{.BUILD_DIR}}/*
176
183
status :
@@ -180,9 +187,7 @@ tasks:
180
187
internal : true
181
188
desc : Generates fmt.Stringer interfaces for specified enum types
182
189
vars :
183
- STRINGER : ' {{joinPath .DEV_BUILD_DIR "stringer"}}{{exeExt}}'
184
- INPUT : ' processor/enums.go'
185
- OUTPUT : ' processor/enums_string.go'
190
+ STRINGER : ' {{.DEV_BUILD_DIR}}/stringer'
186
191
cmds :
187
192
- task : go-build-tool
188
193
vars : {PACKAGE: 'golang.org/x/tools/cmd/stringer', TARGET: '{{.STRINGER}}'}
@@ -193,23 +198,39 @@ tasks:
193
198
-output processor/enums_string.go \
194
199
processor/enums.go
195
200
sources :
196
- - ' {{.INPUT}} '
201
+ - processor/enums.go
197
202
generates :
198
- - ' {{.OUTPUT}} '
203
+ - processor/enums_string.go
199
204
200
205
lint :
201
- desc : Lints whole project
206
+ desc : Lints the whole project
207
+ platforms : [linux]
202
208
vars :
203
- LINTER : ' {{joinPath .DEV_BUILD_DIR "staticcheck"}}{{exeExt}} '
209
+ LINTER : ' {{.DEV_BUILD_DIR}}/staticcheck '
204
210
cmds :
205
- - task : go- build-tool
206
- vars : {PACKAGE: 'honnef.co/go/tools/cmd/staticcheck', TARGET : '{{.LINTER}}'}
211
+ - task : build-linter
212
+ vars : {LINTER : '{{.LINTER}}'}
207
213
- echo "{{.TATN}}Linting project{{.TOFF}}"
208
214
- ./{{.LINTER}} -f stylish -tests=false ./...
209
- sources :
210
- - ' ./**/*.go'
211
- - ' ./go.sum'
212
- - ' ./go.mod'
215
+ sources :
216
+ - ./**/*.go
217
+ - ./go.sum
218
+ - ./go.mod
219
+
220
+ build-linter :
221
+ internal : true
222
+ desc : Builds linter for the project
223
+ requires :
224
+ vars : [LINTER]
225
+ cmds :
226
+ - task : go-build-tool
227
+ vars : {PACKAGE: 'honnef.co/go/tools/cmd/staticcheck', TARGET: '{{.LINTER}}'}
228
+ sources :
229
+ - tools/tools.go
230
+ - go.mod
231
+ - go.sum
232
+ generates :
233
+ - ' {{.LINTER}}'
213
234
214
235
go-build :
215
236
internal : true
@@ -232,7 +253,7 @@ tasks:
232
253
- echo "{{.TATN}}Building \"{{base .TARGET}}\" binary for \"$GOOS:$GOARCH\" from \"{{.PACKAGE}}\"{{.TOFF}}"
233
254
- go build {{.GOARGS}} -o '{{.TARGET}}' '{{.PACKAGE}}'
234
255
sources :
235
- - ' ./**/*.go'
256
+ - ./**/*.go
236
257
generates :
237
258
- ' {{.TARGET}}'
238
259
@@ -257,8 +278,8 @@ tasks:
257
278
run : when_changed
258
279
vars :
259
280
VER : ' {{if .REF_VER}}{{regexFind "[0-9]+\\.[0-9]+\\.?[0-9]*[-a-zA-Z0-9+]*" .REF_VER}}{{else}}0.0.0-dev{{end}}'
260
- DIR : ' {{ joinPath .ROOT_DIR "misc" }} '
261
- FILE : ' {{ joinPath .ROOT_DIR " misc" " version.go" }} '
281
+ DIR : ' {{.ROOT_DIR}}/misc '
282
+ FILE : ' {{.ROOT_DIR}}/ misc/ version.go'
262
283
GIT_HASH :
263
284
sh : git rev-list -1 HEAD || true
264
285
GIT_STATUS :
@@ -280,16 +301,16 @@ tasks:
280
301
EOF
281
302
- gofmt -w {{.FILE}}
282
303
sources :
283
- - ' {{joinPath " .git" " index"}} '
304
+ - .git/ index
284
305
generates :
285
- - " {{.FILE}}"
306
+ - ' {{.FILE}}'
286
307
287
308
get-dictionaries :
288
309
internal : true
289
310
run : once
290
311
desc : Get dictionary rules for all supported languages
291
312
vars :
292
- DIR : ' {{joinPath " static" " dictionaries"}} '
313
+ DIR : ' static/ dictionaries'
293
314
dir : ' {{.DIR}}'
294
315
cmds :
295
316
- rm -f *.txt
@@ -305,7 +326,7 @@ tasks:
305
326
run : once
306
327
desc : Get NLTK training data
307
328
vars :
308
- DIR : ' {{joinPath " static" " sentences"}} '
329
+ DIR : ' static/ sentences'
309
330
dir : ' {{.DIR}}'
310
331
cmds :
311
332
- rm -f *.json
@@ -320,36 +341,20 @@ tasks:
320
341
-not -name 'korean.json.gz' \
321
342
-not -name 'hungarian.json.gz' | grep -q .
322
343
323
- copy-file :
324
- internal : true
325
- desc : Copies source file to destination
326
- requires :
327
- vars : [SRC, DST]
328
- label : copy-file-{{.SRC}}-{{.DST}}
329
- cmds :
330
- - echo "{{.TATN}}Copying \"{{.SRC}}\" to \"{{.DST}}\"{{.TOFF}}"
331
- - mkdir -p {{dir .DST}}
332
- - cp '{{.SRC}}' '{{.DST}}'
333
- sources :
334
- - ' {{.SRC}}'
335
- generates :
336
- - ' {{.DST}}'
337
- status :
338
- - test -f '{{.DST}}'
339
- method : timestamp
340
-
341
344
go-tidy :
342
345
desc : Tidy Go modules for the project.
346
+ platforms : [linux]
343
347
aliases : [tidy]
344
348
vars :
345
349
GO_VER : ' {{default "" (regexFind "[0-9]+\\.[0-9]+\\.?[0-9]*[-a-zA-Z0-9+]*" (env "CUR_PROJECT_TYPE"))}}'
346
350
cmds :
347
- - GOOS=linux go mod tidy{{if .GO_VER}} -go={{.GO_VER}}{{end}} {{.CLI_ARGS}}
348
- - GOOS=darwin go mod tidy{{if .GO_VER}} -go={{.GO_VER}}{{end}} {{.CLI_ARGS}}
349
- - GOOS=windows go mod tidy{{if .GO_VER}} -go={{.GO_VER}}{{end}} {{.CLI_ARGS}}
351
+ - GOOS=linux go mod tidy{{if .GO_VER}} -go={{.GO_VER}}{{end}} {{.CLI_ARGS}}
352
+ - GOOS=darwin go mod tidy{{if .GO_VER}} -go={{.GO_VER}}{{end}} {{.CLI_ARGS}}
353
+ - GOOS=windows go mod tidy{{if .GO_VER}} -go={{.GO_VER}}{{end}} {{.CLI_ARGS}}
350
354
351
355
go-vendor :
352
356
desc : Creates vendor directory for release build
357
+ platforms : [linux]
353
358
aliases : [vendor]
354
359
cmds :
355
360
- GOOS=linux go mod vendor
@@ -358,6 +363,7 @@ tasks:
358
363
359
364
clean :
360
365
desc : Cleans all build release aritfacts
366
+ platforms : [linux]
361
367
cmds :
362
368
- |
363
369
find 'static/sentences' -type f \
@@ -376,3 +382,21 @@ tasks:
376
382
- rm -fv .task/checksum/*
377
383
- rm -fv .task/timestamp/*
378
384
- rm -fv misc/version.go
385
+
386
+ copy-file :
387
+ internal : true
388
+ desc : Copies source file to destination
389
+ requires :
390
+ vars : [SRC, DST]
391
+ label : copy-file-{{.SRC}}-{{.DST}}
392
+ cmds :
393
+ - echo "{{.TATN}}Copying \"{{.SRC}}\" to \"{{.DST}}\"{{.TOFF}}"
394
+ - mkdir -p {{dir .DST}}
395
+ - cp '{{.SRC}}' '{{.DST}}'
396
+ sources :
397
+ - ' {{.SRC}}'
398
+ generates :
399
+ - ' {{.DST}}'
400
+ status :
401
+ - test -f '{{.DST}}'
402
+ method : timestamp
0 commit comments