Skip to content

Commit c19656b

Browse files
refactor(taskfiles)!: Rename and reorganize utils:cmake:install-remote-tar's parameters. (#55)
Co-authored-by: kirkrodrigues <[email protected]>
1 parent 1e219ed commit c19656b

File tree

1 file changed

+48
-54
lines changed

1 file changed

+48
-54
lines changed

exports/taskfiles/utils/cmake.yaml

Lines changed: 48 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -125,98 +125,92 @@ tasks:
125125
)" >> "{{.CMAKE_SETTINGS_DIR}}/{{.NAME}}.cmake"
126126
{{- end}}
127127
128-
# Downloads a CMake project tar file from `URL` and then generates, builds, and installs the
128+
# Downloads a CMake project tar file from `TAR_URL` and then generates, builds, and installs the
129129
# project. We purposely omit `sources` and `generates` as we defer to `cmake` to decide whether it
130130
# should perform any actions. However, the download and extraction will be skipped if unnecessary.
131131
#
132-
# General parameters
133-
# @param {string} NAME Project name (used in directory names).
134-
# @param {string} [SOURCE_DIR={{.WORK_DIR}}/{{.NAME}}-src] Directory in which to extract the tar
135-
# file.
136-
# @param {string} [WORK_DIR={{.TASK_DIR}}] Base directory to store the build, install, and src
137-
# directories inside.
138-
#
139-
# Download parameters
140-
# @param {string} FILE_SHA256 Content hash to verify the downloaded tar file against.
141-
# @param {string} URL
142-
#
143-
# CMake generate parameters
144-
# @param {string[]} [GEN_ARGS] Any additional arguments to pass to the CMake generate command.
132+
# Required parameters
133+
# @param {string} NAME CMake package name.
134+
# @param {string} TAR_SHA256 Content hash to verify the downloaded tar file against.
135+
# @param {string} TAR_URL URL of the tar file to download.
136+
# @param {string} WORK_DIR Directory in which to store the build, install, and source directories.
145137
#
146-
# CMake build parameters
147-
# @param {string[]} [BUILD_ARGS] Any additional arguments to pass to the CMake build command.
148-
# @param {string} [BUILD_DIR={{.WORK_DIR}}/{{.NAME}}-build] Directory in which to generate the
149-
# build system and perform the build.
150-
# @param {int} [JOBS] The maximum number of concurrent processes to use when building. If
138+
# CMake parameters
139+
# @param {string[]} [CMAKE_BUILD_ARGS] Any additional arguments to pass to the CMake build
140+
# command.
141+
# @param {string[]} [CMAKE_GEN_ARGS] Any additional arguments to pass to the CMake generate
142+
# command.
143+
# @param {string[]} [CMAKE_INSTALL_ARGS] Any additional arguments to pass to the CMake install
144+
# command.
145+
# @param {int} [CMAKE_JOBS] The maximum number of concurrent processes to use when building. If
151146
# omitted, the native build tool's default number is used. See `man cmake`.
152-
# @param {string[]} [TARGETS] A list of specific targets to build instead of the default target.
153-
#
154-
# CMake install parameters
155147
# @param {string} [CMAKE_SETTINGS_DIR={{.WORK_DIR}}/cmake-settings] The directory where the
156148
# project's CMake settings file should be stored.
157-
# @param {string[]} [INSTALL_ARGS] Any additional arguments to pass to the CMake install command.
149+
# @param {string[]} [CMAKE_TARGETS] A list of specific targets to build instead of the default
150+
# target.
151+
#
152+
# Directory parameters
153+
# @param {string} [BUILD_DIR={{.WORK_DIR}}/{{.NAME}}-build] Directory in which to generate the
154+
# build system and perform the build.
158155
# @param {string} [INSTALL_PREFIX={{.WORK_DIR}}/{{.NAME}}-install] Path prefix of where the
159156
# project should be installed.
157+
# @param {string} [SOURCE_DIR={{.WORK_DIR}}/{{.NAME}}-src] Directory in which to extract the tar
158+
# file.
160159
install-remote-tar:
161160
internal: true
162-
label: "{{.TASK}}:{{.NAME}}-{{.URL}}-{{.INSTALL_PREFIX}}"
161+
label: "{{.TASK}}:{{.NAME}}-{{.TAR_URL}}-{{.INSTALL_PREFIX}}"
163162
vars:
164-
# General parameters
165-
WORK_DIR: >-
166-
{{default .ROOT_DIR .WORK_DIR}}
167-
SOURCE_DIR: >-
168-
{{default (printf "%s/%s-src" .WORK_DIR .NAME) .SOURCE_DIR}}
169-
170-
# CMake generate parameters
171-
GEN_ARGS:
172-
ref: "default (list) .GEN_ARGS"
163+
# CMake parameters
164+
CMAKE_BUILD_ARGS:
165+
ref: "default (list) .CMAKE_BUILD_ARGS"
166+
CMAKE_GEN_ARGS:
167+
ref: "default (list) .CMAKE_GEN_ARGS"
168+
CMAKE_INSTALL_ARGS:
169+
ref: "default (list) .CMAKE_INSTALL_ARGS"
170+
CMAKE_JOBS: >-
171+
{{default "" .CMAKE_JOBS}}
172+
CMAKE_SETTINGS_DIR: >-
173+
{{default (printf "%s/cmake-settings" .WORK_DIR) .CMAKE_SETTINGS_DIR}}
174+
CMAKE_TARGETS:
175+
ref: "default (list) .CMAKE_TARGETS"
173176

174-
# CMake build parameters
175-
BUILD_ARGS:
176-
ref: "default (list) .BUILD_ARGS"
177+
# Directory parameters
177178
BUILD_DIR: >-
178179
{{default (printf "%s/%s-build" .WORK_DIR .NAME) .BUILD_DIR}}
179-
JOBS: >-
180-
{{default "" .JOBS}}
181-
TARGETS:
182-
ref: "default (list) .TARGETS"
183-
184-
# CMake install parameters
185-
CMAKE_SETTINGS_DIR: >-
186-
{{default (printf "%s/cmake-settings" .WORK_DIR) .CMAKE_SETTINGS_DIR}}
187-
INSTALL_ARGS:
188-
ref: "default (list) .INSTALL_ARGS"
189180
INSTALL_PREFIX: >-
190181
{{default (printf "%s/%s-install" .WORK_DIR .NAME) .INSTALL_PREFIX}}
182+
SOURCE_DIR: >-
183+
{{default (printf "%s/%s-src" .WORK_DIR .NAME) .SOURCE_DIR}}
184+
191185
requires:
192-
vars: ["FILE_SHA256", "NAME", "URL"]
186+
vars: ["NAME", "TAR_SHA256", "TAR_URL", "WORK_DIR"]
193187
deps:
194188
- task: "remote:download-and-extract-tar"
195189
vars:
196-
FILE_SHA256: "{{.FILE_SHA256}}"
190+
FILE_SHA256: "{{.TAR_SHA256}}"
197191
OUTPUT_DIR: "{{.SOURCE_DIR}}"
198-
URL: "{{.URL}}"
192+
URL: "{{.TAR_URL}}"
199193
cmds:
200194
- task: "generate"
201195
vars:
202196
BUILD_DIR: "{{.BUILD_DIR}}"
203197
EXTRA_ARGS:
204-
ref: ".GEN_ARGS"
198+
ref: ".CMAKE_GEN_ARGS"
205199
SOURCE_DIR: "{{.SOURCE_DIR}}"
206200
- task: "build"
207201
vars:
208202
BUILD_DIR: "{{.BUILD_DIR}}"
209203
EXTRA_ARGS:
210-
ref: ".BUILD_ARGS"
211-
JOBS: "{{.JOBS}}"
204+
ref: ".CMAKE_BUILD_ARGS"
205+
JOBS: "{{.CMAKE_JOBS}}"
212206
TARGETS:
213-
ref: ".TARGETS"
207+
ref: ".CMAKE_TARGETS"
214208
- task: "install"
215209
vars:
216210
BUILD_DIR: "{{.BUILD_DIR}}"
217211
CMAKE_SETTINGS_DIR: "{{.CMAKE_SETTINGS_DIR}}"
218212
EXTRA_ARGS:
219-
ref: ".INSTALL_ARGS"
213+
ref: ".CMAKE_INSTALL_ARGS"
220214
INSTALL_PREFIX: "{{.INSTALL_PREFIX}}"
221215
NAME: "{{.NAME}}"
222216

0 commit comments

Comments
 (0)