|
1 | 1 | version: "3" |
2 | 2 |
|
| 3 | +includes: |
| 4 | + deps: |
| 5 | + internal: true |
| 6 | + taskfile: "deps.yaml" |
| 7 | + utils: |
| 8 | + internal: true |
| 9 | + taskfile: "../tools/yscope-dev-utils/exports/taskfiles/utils/utils.yaml" |
| 10 | + |
3 | 11 | vars: |
4 | | - G_CMAKE_CACHE: "{{.G_BUILD_DIR}}/CMakeCache.txt" |
5 | | - G_COMPILE_COMMANDS_DB: "{{.G_BUILD_DIR}}/compile_commands.json" |
| 12 | + G_EXAMPLES_BUILD_DIR: "{{.G_BUILD_DIR}}/examples" |
| 13 | + G_YSTDLIB_BUILD_DIR: "{{.G_BUILD_DIR}}/ystdlib" |
6 | 14 |
|
7 | 15 | tasks: |
8 | | - all: |
9 | | - desc: "Builds all of ystdlib." |
| 16 | + build-*-*: |
| 17 | + desc: "build-<target>-<build type>: Builds the specified build target with build type." |
| 18 | + vars: |
| 19 | + BUILD_TYPE: "{{index .MATCH 1}}" |
| 20 | + TARGET: "{{index .MATCH 0}}" |
10 | 21 | deps: |
11 | | - - "init" |
| 22 | + - task: ":validate-args" |
| 23 | + vars: |
| 24 | + BUILD_TYPE: "{{.BUILD_TYPE}}" |
| 25 | + TARGET: "{{.TEST_TARGET}}" |
12 | 26 | cmds: |
13 | | - - task: ":utils:cmake:build" |
| 27 | + - task: "build" |
14 | 28 | vars: |
15 | | - BUILD_DIR: "{{.G_BUILD_DIR}}" |
| 29 | + BUILD_TYPE: "{{.BUILD_TYPE}}" |
| 30 | + TARGET: "{{.TARGET}}" |
16 | 31 |
|
17 | | - target-*: |
18 | | - desc: "Builds a CMake target." |
| 32 | + clean-*: |
| 33 | + desc: "clean-<build type>: Clean the build type." |
19 | 34 | vars: |
20 | | - TARGET: "{{index .MATCH 0}}" |
| 35 | + BUILD_TYPE: "{{index .MATCH 0}}" |
21 | 36 | deps: |
22 | | - - "init" |
| 37 | + - task: ":validate-build-type" |
| 38 | + vars: |
| 39 | + BUILD_TYPE: "{{.BUILD_TYPE}}" |
23 | 40 | cmds: |
24 | | - - task: ":utils:cmake:build" |
| 41 | + - task: "utils:cmake:clean" |
25 | 42 | vars: |
26 | | - BUILD_DIR: "{{.G_BUILD_DIR}}" |
27 | | - TARGETS: |
28 | | - - "{{.TARGET}}" |
| 43 | + BUILD_DIR: "{{.G_YSTDLIB_DIR}}/{{.BUILD_TYPE}}" |
29 | 44 |
|
30 | | - unit-test-*: |
31 | | - desc: "Builds the specified unit test target." |
| 45 | + examples-*: |
| 46 | + desc: "examples-<build type>: Builds the examples with build type." |
32 | 47 | vars: |
33 | | - TARGET_SUFFIX: >- |
34 | | - {{index .MATCH 0}} |
35 | | - TARGET_NAME: >- |
36 | | - {{printf "unit-test-%s" .TARGET_SUFFIX}} |
37 | | - preconditions: |
38 | | - - sh: >- |
39 | | - {{has .TARGET_SUFFIX .G_TEST_TARGET_SUFFIXES}} |
40 | | - msg: |- |
41 | | - {{.TARGET_NAME}} is not a valid unit test target! |
42 | | - List of unit test targets: |
43 | | - {{- range .G_TEST_TARGET_SUFFIXES }} |
44 | | - unit-test-{{.}} |
45 | | - {{- end}} |
| 48 | + BUILD_TYPE: "{{index .MATCH 0}}" |
| 49 | + deps: |
| 50 | + - task: ":validate-build-type" |
| 51 | + vars: |
| 52 | + BUILD_TYPE: "{{.BUILD_TYPE}}" |
46 | 53 | cmds: |
47 | | - - task: "target-{{.TARGET_NAME}}" |
| 54 | + - task: "examples" |
| 55 | + vars: |
| 56 | + BUILD_TYPE: "{{.BUILD_TYPE}}" |
48 | 57 |
|
49 | | - clean: |
50 | | - desc: "Removes all built artifacts." |
| 58 | + install-*-*: |
| 59 | + desc: >- |
| 60 | + install-<target>-<build type> INSTALL_PREFIX="<prefix path>": Install the specified build |
| 61 | + target with build type to the prefix path." |
| 62 | + vars: |
| 63 | + BUILD_TYPE: "{{index .MATCH 1}}" |
| 64 | + TARGET: "{{index .MATCH 0}}" |
| 65 | + requires: |
| 66 | + vars: ["INSTALL_PREFIX"] |
51 | 67 | deps: |
52 | | - - task: ":utils:cmake:clean" |
| 68 | + - task: ":validate-args" |
| 69 | + vars: |
| 70 | + BUILD_TYPE: "{{.BUILD_TYPE}}" |
| 71 | + TARGET: "{{.TEST_TARGET}}" |
| 72 | + cmds: |
| 73 | + - task: "install" |
53 | 74 | vars: |
54 | | - BUILD_DIR: "{{.G_BUILD_DIR}}" |
| 75 | + BUILD_TYPE: "{{.BUILD_TYPE}}" |
| 76 | + INSTALL_PREFIX: "{{.INSTALL_PREFIX}}" |
| 77 | + TARGET: "{{.TARGET}}" |
55 | 78 |
|
56 | | - init: |
| 79 | + build: |
57 | 80 | internal: true |
| 81 | + requires: |
| 82 | + vars: ["BUILD_TYPE", "TARGET"] |
58 | 83 | deps: |
59 | | - - ":deps:install-all" |
60 | | - run: "once" |
| 84 | + - "deps:all" |
61 | 85 | cmds: |
62 | | - - task: ":utils:cmake:generate" |
| 86 | + - task: "utils:cmake:generate" |
63 | 87 | vars: |
64 | | - BUILD_DIR: "{{.G_BUILD_DIR}}" |
| 88 | + BUILD_DIR: "{{.G_YSTDLIB_BUILD_DIR}}/{{.BUILD_TYPE}}" |
| 89 | + EXTRA_ARGS: |
| 90 | + - "-DCMAKE_BUILD_TYPE={{.BUILD_TYPE}}" |
65 | 91 | SOURCE_DIR: "{{.ROOT_DIR}}" |
| 92 | + - task: "utils:cmake:build" |
| 93 | + vars: |
| 94 | + BUILD_DIR: "{{.G_YSTDLIB_BUILD_DIR}}/{{.BUILD_TYPE}}" |
| 95 | + TARGETS: |
| 96 | + - "{{.TARGET}}" |
| 97 | + |
| 98 | + examples: |
| 99 | + internal: true |
| 100 | + requires: |
| 101 | + vars: ["BUILD_TYPE"] |
| 102 | + vars: |
| 103 | + INSTALL_PREFIX: "{{.G_EXAMPLES_BUILD_DIR}}/deps/ystdlib/{{.BUILD_TYPE}}" |
| 104 | + deps: |
| 105 | + - task: "build" |
| 106 | + vars: |
| 107 | + BUILD_TYPE: "{{.BUILD_TYPE}}" |
| 108 | + TARGET: "{{.TARGET}}" |
| 109 | + cmds: |
| 110 | + - task: "install" |
| 111 | + vars: |
| 112 | + BUILD_TYPE: "{{.BUILD_TYPE}}" |
| 113 | + INSTALL_PREFIX: "{{.INSTALL_PREFIX}}" |
| 114 | + TARGET: "{{.TARGET}}" |
| 115 | + - task: "utils:cmake:generate" |
| 116 | + vars: |
| 117 | + BUILD_DIR: "{{.G_EXAMPLES_BUILD_DIR}}/{{.BUILD_TYPE}}" |
| 118 | + EXTRA_ARGS: |
| 119 | + - "-DCMAKE_BUILD_TYPE={{.BUILD_TYPE}}" |
| 120 | + - "-Dystdlib_ROOT={{.INSTALL_PREFIX}}" |
| 121 | + SOURCE_DIR: "{{.ROOT_DIR}}/examples" |
| 122 | + - task: "utils:cmake:build" |
| 123 | + vars: |
| 124 | + BUILD_DIR: "{{.G_EXAMPLES_BUILD_DIR}}/{{.BUILD_TYPE}}" |
| 125 | + |
| 126 | + install: |
| 127 | + internal: true |
| 128 | + requires: |
| 129 | + vars: ["BUILD_TYPE", "INSTALL_PREFIX", "TARGET"] |
| 130 | + deps: |
| 131 | + - task: "build" |
| 132 | + vars: |
| 133 | + BUILD_TYPE: "{{.BUILD_TYPE}}" |
| 134 | + TARGET: "{{.TARGET}}" |
| 135 | + cmds: |
| 136 | + - task: "utils:cmake:install" |
| 137 | + vars: |
| 138 | + BUILD_DIR: "{{.G_YSTDLIB_BUILD_DIR}}/{{.BUILD_TYPE}}" |
| 139 | + INSTALL_PREFIX: "{{.INSTALL_PREFIX}}" |
0 commit comments