Skip to content

Commit 7f961cc

Browse files
committed
Switch from CLI_ARGS to wildcard tasks.
1 parent 7975d94 commit 7f961cc

File tree

3 files changed

+27
-49
lines changed

3 files changed

+27
-49
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,25 @@ To build all targets:
3333
task build:all
3434
```
3535

36-
To build a unified executable containing all unit tests:
36+
To build an executable containing all unit tests:
3737
```shell
38-
task build:unit-test
38+
task build:unit-test-all
3939
```
4040

41-
To build individual unit test executables for a subset of libraries:
41+
To build an executable containing a single library's unit tests:
4242
```shell
43-
task build:unit-test -- <lib_name0> <lib_name1> ...
43+
task build:unit-test-<lib_name>
4444
```
4545

4646
## Testing
4747
To build and run all unit tests:
4848
```shell
49-
task test
49+
task test:all
5050
```
5151

52-
To build and run unit tests for a subset of libraries:
52+
To build and run unit tests for a single library:
5353
```shell
54-
task test -- <lib_name0> <lib_name1> ...
54+
task test:run-<lib_name>
5555
```
5656

5757
## Linting

taskfiles/build.yaml

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,48 +8,34 @@ vars:
88

99
tasks:
1010
all:
11-
desc: "Builds ystdlib-cpp."
11+
desc: "Builds all of ystdlib-cpp."
1212
deps:
1313
- "init"
1414
cmds:
1515
- task: ":utils:cmake-build"
1616
vars:
1717
BUILD_DIR: "{{.G_BUILD_DIR}}"
1818

19-
target:
20-
desc: "Builds specified ystdlib-cpp targets."
21-
summary: |-
22-
Builds specified ystdlib-cpp targets.
23-
24-
Usage: task build:target -- <target0> <target1> ...
19+
target-*:
20+
desc: "Builds a CMake target."
21+
vars:
22+
TARGET: "{{index .MATCH 0}}"
2523
deps:
2624
- "init"
2725
cmds:
2826
- task: ":utils:cmake-build"
2927
vars:
3028
BUILD_DIR: "{{.G_BUILD_DIR}}"
3129
TARGETS:
32-
ref: >-
33-
trim .CLI_ARGS | splitList " "
30+
- "{{.TARGET}}"
3431

35-
unit-test:
36-
desc: "Builds ystdlib-cpp unit test targets."
37-
summary: |-
38-
Builds specified ystdlib-cpp unit test targets, or run the unified unit test target if no
39-
libraries are specified.
40-
41-
Usage: task build -- <lib_name0> <lib_name1> ...
32+
unit-test-*:
33+
desc: "Builds a unit test target."
4234
vars:
43-
TARGET_LIBS:
44-
ref: >-
45-
.CLI_ARGS | default "all" | splitList " "
35+
TEST_TARGET: >-
36+
{{printf "unit-test-%s" (index .MATCH 0)}}
4637
cmds:
47-
- task: "target"
48-
vars:
49-
CLI_ARGS: >-
50-
{{- range .TARGET_LIBS}}
51-
{{(printf "unit-test-%s" .)}}
52-
{{- end}}
38+
- task: "target-{{.TEST_TARGET}}"
5339

5440
clean:
5541
desc: "Removes all built artifacts."

taskfiles/test.yaml

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,15 @@
11
version: "3"
22

33
tasks:
4-
default:
5-
desc: "Runs ystdlib-cpp unit test targets."
6-
summary: |-
7-
Runs specified ystdlib-cpp unit test targets, or run the unified unit test target if no
8-
libraries are specified.
4+
all:
5+
desc: "Runs all unit tests."
6+
cmds:
7+
- task: "run-all"
98

10-
Usage: task test -- <lib_name0> <lib_name1> ...
9+
run-*:
10+
desc: "Runs a unit test target."
1111
vars:
12-
TARGET_LIBS:
13-
ref: >-
14-
.CLI_ARGS | default "all" | splitList " "
15-
dir: "{{.G_TEST_BIN_DIR}}"
12+
LIBRARY: "{{index .MATCH 0}}"
1613
deps:
17-
- task: ":build:unit-test"
18-
vars:
19-
CLI_ARGS: "{{.CLI_ARGS}}"
20-
cmd: |-
21-
{{- range .TARGET_LIBS}}
22-
./unit-test-{{.}}
23-
{{- end}}
14+
- task: ":build:unit-test-{{.LIBRARY}}"
15+
cmd: "{{.G_TEST_BIN_DIR}}/unit-test-{{.LIBRARY}}"

0 commit comments

Comments
 (0)