2020-05-27 06:13:08 +00:00
|
|
|
# spell-checker:ignore (cargo-make) duckscript
|
2020-01-28 02:05:50 +00:00
|
|
|
|
2019-12-29 03:46:32 +00:00
|
|
|
[config]
|
2020-01-28 02:05:50 +00:00
|
|
|
min_version = "0.26.2"
|
2019-12-29 03:46:32 +00:00
|
|
|
default_to_workspace = false
|
2020-05-02 17:36:27 +00:00
|
|
|
init_task = "_init_task"
|
2019-12-29 03:46:32 +00:00
|
|
|
|
|
|
|
[config.modify_core_tasks]
|
|
|
|
namespace = "core"
|
|
|
|
|
2020-04-07 17:10:23 +00:00
|
|
|
### initialization
|
|
|
|
|
2020-05-02 17:36:27 +00:00
|
|
|
### * note: the task executed from 'init_task' ignores dependencies; workaround is to run a secondary task via 'run_task'
|
|
|
|
|
|
|
|
[tasks._init_task]
|
|
|
|
# dependencies are unavailable
|
|
|
|
# * delegate (via 'run_task') to "real" initialization task ('_init') with full capabilities
|
2020-04-07 17:10:23 +00:00
|
|
|
private = true
|
2020-05-02 17:36:27 +00:00
|
|
|
run_task = "_init"
|
2020-04-07 17:10:23 +00:00
|
|
|
|
2020-05-02 17:36:27 +00:00
|
|
|
[tasks._init]
|
2020-01-28 02:05:50 +00:00
|
|
|
private = true
|
|
|
|
dependencies = [
|
|
|
|
"_init-vars",
|
|
|
|
]
|
|
|
|
|
|
|
|
[tasks._init-vars]
|
|
|
|
private = true
|
|
|
|
script_runner = "@duckscript"
|
|
|
|
script = [
|
|
|
|
'''
|
|
|
|
# reset build/test flags
|
|
|
|
set_env CARGO_MAKE_CARGO_BUILD_TEST_FLAGS ""
|
|
|
|
# determine features
|
|
|
|
env_features = get_env CARGO_FEATURES
|
|
|
|
if is_empty "${env_features}"
|
2020-05-11 02:14:58 +00:00
|
|
|
env_features = get_env FEATURES
|
2020-01-28 02:05:50 +00:00
|
|
|
end_if
|
|
|
|
if is_empty "${env_features}"
|
|
|
|
if eq "${CARGO_MAKE_RUST_TARGET_OS}" "macos"
|
|
|
|
features = set "unix"
|
|
|
|
else
|
|
|
|
if eq "${CARGO_MAKE_RUST_TARGET_OS}" "linux"
|
|
|
|
features = set "unix"
|
|
|
|
else
|
|
|
|
if eq "${CARGO_MAKE_RUST_TARGET_OS}" "windows"
|
|
|
|
features = set "windows"
|
|
|
|
end_if
|
|
|
|
end_if
|
|
|
|
end_if
|
|
|
|
end_if
|
|
|
|
if is_empty "${features}"
|
|
|
|
features = set "${env_features}"
|
|
|
|
else
|
|
|
|
if not is_empty "${env_features}"
|
|
|
|
features = set "${features},${env_features}"
|
|
|
|
end_if
|
|
|
|
end_if
|
|
|
|
# set build flags from features
|
|
|
|
if not is_empty "${features}"
|
|
|
|
set_env CARGO_MAKE_VAR_BUILD_TEST_FEATURES "${features}"
|
2020-05-11 02:14:58 +00:00
|
|
|
set_env CARGO_MAKE_CARGO_BUILD_TEST_FLAGS "--features ${features}"
|
2020-01-28 02:05:50 +00:00
|
|
|
end_if
|
|
|
|
# determine show-utils helper script
|
|
|
|
show_utils = set "util/show-utils.sh"
|
|
|
|
if eq "${CARGO_MAKE_RUST_TARGET_OS}" "windows"
|
|
|
|
show_utils = set "util/show-utils.BAT"
|
|
|
|
end_if
|
|
|
|
set_env CARGO_MAKE_VAR_SHOW_UTILS "${show_utils}"
|
2020-05-05 23:06:42 +00:00
|
|
|
# rebuild CARGO_MAKE_TASK_ARGS for various targets
|
2020-01-28 02:05:50 +00:00
|
|
|
args = set ${CARGO_MAKE_TASK_ARGS}
|
2020-05-05 23:06:42 +00:00
|
|
|
# * rebuild for 'features' target
|
|
|
|
args_features = replace ${args} ";" ","
|
|
|
|
set_env CARGO_MAKE_TASK_BUILD_FEATURES_ARGS "${args_features}"
|
|
|
|
# * rebuild for 'examples' target
|
|
|
|
args_examples = replace ${args} ";" " --example "
|
|
|
|
if is_empty "${args_examples}"
|
|
|
|
args_examples = set "--examples"
|
2020-01-28 02:05:50 +00:00
|
|
|
end_if
|
2020-05-05 23:06:42 +00:00
|
|
|
set_env CARGO_MAKE_TASK_BUILD_EXAMPLES_ARGS "${args_examples}"
|
|
|
|
# * rebuild for 'utils' target
|
2020-05-06 21:40:01 +00:00
|
|
|
args_utils_list = split "${args}" ";"
|
|
|
|
for arg in "${args_utils_list}"
|
|
|
|
if not is_empty "${arg}"
|
|
|
|
if not starts_with "${arg}" "uu_"
|
|
|
|
arg = set "uu_${arg}"
|
|
|
|
end_if
|
|
|
|
args_utils = set "${args_utils} -p${arg}"
|
|
|
|
end_if
|
|
|
|
end
|
|
|
|
args_utils = trim "${args_utils}"
|
2020-05-05 23:06:42 +00:00
|
|
|
set_env CARGO_MAKE_TASK_BUILD_UTILS_ARGS "${args_utils}"
|
2020-01-28 02:05:50 +00:00
|
|
|
'''
|
|
|
|
]
|
2019-12-29 03:46:32 +00:00
|
|
|
|
2020-04-07 17:10:23 +00:00
|
|
|
### tasks
|
|
|
|
|
2019-12-29 03:46:32 +00:00
|
|
|
[tasks.default]
|
2020-05-03 15:41:52 +00:00
|
|
|
description = "## *DEFAULT* Build (debug-mode) and test project"
|
2019-12-29 03:46:32 +00:00
|
|
|
category = "[project]"
|
|
|
|
dependencies = [
|
2020-01-28 02:05:50 +00:00
|
|
|
"action-build-debug",
|
2020-05-11 02:14:58 +00:00
|
|
|
"test-terse",
|
2019-12-29 03:46:32 +00:00
|
|
|
]
|
|
|
|
|
2020-05-03 15:41:52 +00:00
|
|
|
##
|
|
|
|
|
2019-12-29 03:46:32 +00:00
|
|
|
[tasks.build]
|
2020-05-03 15:41:52 +00:00
|
|
|
description = "## Build (release-mode) project"
|
2019-12-29 03:46:32 +00:00
|
|
|
category = "[project]"
|
|
|
|
dependencies = [
|
|
|
|
"core::pre-build",
|
2020-05-11 02:14:58 +00:00
|
|
|
"action-build-release",
|
|
|
|
"core::post-build",
|
2020-01-28 02:05:50 +00:00
|
|
|
]
|
|
|
|
|
2020-05-03 15:41:52 +00:00
|
|
|
[tasks.build-debug]
|
|
|
|
description = "## Build (debug-mode) project"
|
|
|
|
category = "[project]"
|
|
|
|
dependencies = [
|
|
|
|
"action-build-debug",
|
|
|
|
]
|
|
|
|
|
2020-05-05 23:06:42 +00:00
|
|
|
[tasks.build-examples]
|
2020-05-06 21:29:47 +00:00
|
|
|
description = "## Build (release-mode) project example(s); usage: `cargo make (build-examples | examples) [EXAMPLE]...`"
|
2020-05-05 23:06:42 +00:00
|
|
|
category = "[project]"
|
|
|
|
dependencies = [
|
|
|
|
"core::pre-build",
|
2020-05-11 02:14:58 +00:00
|
|
|
"action-build-examples",
|
|
|
|
"core::post-build",
|
2020-05-05 23:06:42 +00:00
|
|
|
]
|
|
|
|
|
2020-01-28 02:05:50 +00:00
|
|
|
[tasks.build-features]
|
2020-05-03 15:41:52 +00:00
|
|
|
description = "## Build (with features; release-mode) project; usage: `cargo make (build-features | features) FEATURE...`"
|
2020-01-28 02:05:50 +00:00
|
|
|
category = "[project]"
|
|
|
|
dependencies = [
|
|
|
|
"core::pre-build",
|
2020-05-11 02:14:58 +00:00
|
|
|
"action-build-features",
|
|
|
|
"core::post-build",
|
2019-12-29 03:46:32 +00:00
|
|
|
]
|
|
|
|
|
2020-05-06 21:30:29 +00:00
|
|
|
[tasks.build-release]
|
|
|
|
alias = "build"
|
|
|
|
|
2020-05-03 15:41:52 +00:00
|
|
|
[tasks.debug]
|
|
|
|
alias = "build-debug"
|
|
|
|
|
2020-05-05 23:06:42 +00:00
|
|
|
[tasks.example]
|
2020-05-06 21:29:47 +00:00
|
|
|
description = "hidden singular-form alias for 'examples'"
|
|
|
|
category = "[project]"
|
|
|
|
dependencies = [
|
|
|
|
"examples",
|
|
|
|
]
|
2020-05-05 23:06:42 +00:00
|
|
|
|
|
|
|
[tasks.examples]
|
|
|
|
alias = "build-examples"
|
|
|
|
|
2020-01-28 02:05:50 +00:00
|
|
|
[tasks.features]
|
|
|
|
alias = "build-features"
|
|
|
|
|
2019-12-29 03:46:32 +00:00
|
|
|
[tasks.format]
|
2020-05-24 18:08:18 +00:00
|
|
|
description = "## Format code files (with `cargo fmt`; includes tests)"
|
2019-12-29 03:46:32 +00:00
|
|
|
category = "[project]"
|
|
|
|
dependencies = [
|
2020-01-28 02:05:50 +00:00
|
|
|
"action-format",
|
2020-05-02 05:12:29 +00:00
|
|
|
"action-format-tests",
|
2019-12-29 03:46:32 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
[tasks.help]
|
2020-05-02 22:37:02 +00:00
|
|
|
description = "## Display help"
|
2019-12-29 03:46:32 +00:00
|
|
|
category = "[project]"
|
2020-05-02 22:37:02 +00:00
|
|
|
dependencies = [
|
|
|
|
"action-display-help",
|
|
|
|
]
|
2019-12-29 03:46:32 +00:00
|
|
|
|
2020-04-29 06:06:04 +00:00
|
|
|
[tasks.install]
|
2020-05-02 22:37:02 +00:00
|
|
|
description = "## Install project binary (to $HOME/.cargo/bin)"
|
2020-04-29 06:06:04 +00:00
|
|
|
category = "[project]"
|
|
|
|
command = "cargo"
|
|
|
|
args = ["install", "--path", "."]
|
|
|
|
|
2019-12-29 03:46:32 +00:00
|
|
|
[tasks.lint]
|
2020-05-02 22:37:02 +00:00
|
|
|
description = "## Display lint report"
|
2019-12-29 03:46:32 +00:00
|
|
|
category = "[project]"
|
|
|
|
dependencies = [
|
|
|
|
"action-clippy",
|
|
|
|
"action-fmt_report",
|
|
|
|
]
|
|
|
|
|
2020-01-28 02:05:50 +00:00
|
|
|
[tasks.release]
|
|
|
|
alias = "build"
|
|
|
|
|
2019-12-29 03:46:32 +00:00
|
|
|
[tasks.test]
|
2020-05-02 22:37:02 +00:00
|
|
|
description = "## Run project tests"
|
2019-12-29 03:46:32 +00:00
|
|
|
category = "[project]"
|
|
|
|
dependencies = [
|
|
|
|
"core::pre-test",
|
2020-05-11 02:14:58 +00:00
|
|
|
"core::test",
|
|
|
|
"core::post-test",
|
2019-12-29 03:46:32 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
[tasks.test-terse]
|
2020-05-02 22:37:02 +00:00
|
|
|
description = "## Run project tests (with terse/summary output)"
|
2019-12-29 03:46:32 +00:00
|
|
|
category = "[project]"
|
|
|
|
dependencies = [
|
|
|
|
"core::pre-test",
|
2020-05-11 02:14:58 +00:00
|
|
|
"action-test_quiet",
|
|
|
|
"core::post-test",
|
2019-12-29 03:46:32 +00:00
|
|
|
]
|
|
|
|
|
2020-04-29 06:06:04 +00:00
|
|
|
[tasks.uninstall]
|
2020-05-02 22:37:02 +00:00
|
|
|
description = "## Remove project binary (from $HOME/.cargo/bin)"
|
2020-04-29 06:06:04 +00:00
|
|
|
category = "[project]"
|
|
|
|
command = "cargo"
|
|
|
|
args = ["uninstall"]
|
|
|
|
|
2020-01-28 02:05:50 +00:00
|
|
|
[tasks.util]
|
2020-05-06 21:30:56 +00:00
|
|
|
description = "## Build (individual; release-mode) utilities; usage: `cargo make (util | uutil) [UTIL_NAME...]`"
|
2020-01-28 02:05:50 +00:00
|
|
|
category = "[project]"
|
|
|
|
dependencies = [
|
|
|
|
"core::pre-build",
|
|
|
|
"action-determine-utils",
|
2020-05-11 02:14:58 +00:00
|
|
|
"action-build-utils",
|
|
|
|
"core::post-build",
|
2020-01-28 02:05:50 +00:00
|
|
|
]
|
|
|
|
|
2020-05-06 21:30:56 +00:00
|
|
|
[tasks.utils]
|
|
|
|
description = "hidden plural-form alias for 'util'"
|
|
|
|
category = "[project]"
|
|
|
|
dependencies = [
|
|
|
|
"util",
|
|
|
|
]
|
|
|
|
|
2020-04-28 18:55:36 +00:00
|
|
|
[tasks.uutil]
|
|
|
|
alias = "utils"
|
|
|
|
|
|
|
|
[tasks.uutils]
|
2020-05-06 21:30:56 +00:00
|
|
|
description = "hidden plural-form alias for 'util'"
|
|
|
|
category = "[project]"
|
|
|
|
dependencies = [
|
|
|
|
"util",
|
|
|
|
]
|
2020-04-28 18:55:36 +00:00
|
|
|
|
2019-12-29 03:46:32 +00:00
|
|
|
### actions
|
|
|
|
|
2020-05-03 15:41:52 +00:00
|
|
|
[tasks.action-build-release]
|
2020-01-28 02:05:50 +00:00
|
|
|
description = "`cargo build --release`"
|
|
|
|
command = "cargo"
|
|
|
|
args = ["build", "--release", "@@split(CARGO_MAKE_CARGO_BUILD_TEST_FLAGS, )" ]
|
|
|
|
|
|
|
|
[tasks.action-build-debug]
|
|
|
|
description = "`cargo build`"
|
|
|
|
command = "cargo"
|
|
|
|
args = ["build", "@@split(CARGO_MAKE_CARGO_BUILD_TEST_FLAGS, )" ]
|
|
|
|
|
2020-05-05 23:06:42 +00:00
|
|
|
[tasks.action-build-examples]
|
|
|
|
description = "`cargo build (--examples|(--example EXAMPLE)...)`"
|
|
|
|
command = "cargo"
|
|
|
|
args = ["build", "--release", "@@split(CARGO_MAKE_CARGO_BUILD_TEST_FLAGS, )", "${CARGO_MAKE_TASK_BUILD_EXAMPLES_ARGS}" ]
|
|
|
|
|
2020-01-28 02:05:50 +00:00
|
|
|
[tasks.action-build-features]
|
|
|
|
description = "`cargo build --release --features FEATURES`"
|
|
|
|
command = "cargo"
|
|
|
|
args = ["build", "--release", "--no-default-features", "--features", "${CARGO_MAKE_TASK_BUILD_FEATURES_ARGS}" ]
|
|
|
|
|
|
|
|
[tasks.action-build-utils]
|
|
|
|
description = "Build individual utilities"
|
2020-05-24 18:08:18 +00:00
|
|
|
dependencies = [
|
|
|
|
"action-determine-utils",
|
|
|
|
]
|
2020-01-28 02:05:50 +00:00
|
|
|
command = "cargo"
|
|
|
|
# args = ["build", "@@remove-empty(CARGO_MAKE_TASK_BUILD_UTILS_ARGS)" ]
|
|
|
|
args = ["build", "--release", "@@split(CARGO_MAKE_TASK_BUILD_UTILS_ARGS, )" ]
|
|
|
|
|
2019-12-29 03:46:32 +00:00
|
|
|
[tasks.action-clippy]
|
|
|
|
description = "`cargo clippy` lint report"
|
|
|
|
command = "cargo"
|
|
|
|
args = ["clippy", "@@split(CARGO_MAKE_CARGO_BUILD_TEST_FLAGS, )"]
|
|
|
|
|
2020-01-28 02:05:50 +00:00
|
|
|
[tasks.action-determine-utils]
|
|
|
|
script_runner = "@duckscript"
|
|
|
|
script = [
|
|
|
|
'''
|
|
|
|
package_options = get_env CARGO_MAKE_TASK_BUILD_UTILS_ARGS
|
|
|
|
if is_empty "${package_options}"
|
|
|
|
show_utils = get_env CARGO_MAKE_VAR_SHOW_UTILS
|
2020-05-06 22:16:21 +00:00
|
|
|
features = get_env CARGO_MAKE_VAR_BUILD_TEST_FEATURES
|
|
|
|
if not is_empty "${features}"
|
|
|
|
result = exec "${show_utils}" --features "${features}"
|
|
|
|
else
|
|
|
|
result = exec "${show_utils}"
|
|
|
|
endif
|
2020-01-28 02:05:50 +00:00
|
|
|
set_env CARGO_MAKE_VAR_UTILS ${result.stdout}
|
|
|
|
utils = array %{result.stdout}
|
|
|
|
for util in ${utils}
|
2020-05-06 21:40:01 +00:00
|
|
|
if not is_empty "${util}"
|
|
|
|
if not starts_with "${util}" "uu_"
|
|
|
|
util = set "uu_${util}"
|
|
|
|
end_if
|
|
|
|
package_options = set "${package_options} -p${util}"
|
|
|
|
end_if
|
2020-01-28 02:05:50 +00:00
|
|
|
end
|
|
|
|
package_options = trim "${package_options}"
|
|
|
|
end_if
|
|
|
|
set_env CARGO_MAKE_TASK_BUILD_UTILS_ARGS "${package_options}"
|
|
|
|
'''
|
|
|
|
]
|
|
|
|
|
2020-05-02 05:12:29 +00:00
|
|
|
[tasks.action-determine-tests]
|
|
|
|
script_runner = "@duckscript"
|
|
|
|
script = [
|
|
|
|
'''
|
|
|
|
test_files = glob_array tests/**/*.rs
|
|
|
|
for file in ${test_files}
|
2020-05-24 18:08:18 +00:00
|
|
|
file = replace "${file}" "\\" "/"
|
|
|
|
if not is_empty ${file}
|
|
|
|
if is_empty "${tests}"
|
|
|
|
tests = set "${file}"
|
|
|
|
else
|
|
|
|
tests = set "${tests} ${file}"
|
|
|
|
end_if
|
2020-05-02 05:12:29 +00:00
|
|
|
end_if
|
|
|
|
end
|
|
|
|
set_env CARGO_MAKE_VAR_TESTS "${tests}"
|
|
|
|
'''
|
|
|
|
]
|
|
|
|
|
2019-12-29 03:46:32 +00:00
|
|
|
[tasks.action-format]
|
|
|
|
description = "`cargo fmt`"
|
|
|
|
command = "cargo"
|
|
|
|
args = ["fmt"]
|
|
|
|
|
2020-05-02 05:12:29 +00:00
|
|
|
[tasks.action-format-tests]
|
|
|
|
description = "`cargo fmt` tests"
|
2020-05-24 18:08:18 +00:00
|
|
|
dependencies = [
|
|
|
|
"action-determine-tests",
|
|
|
|
]
|
2019-12-29 03:46:32 +00:00
|
|
|
command = "cargo"
|
2020-05-02 05:12:29 +00:00
|
|
|
args = ["fmt", "--", "@@split(CARGO_MAKE_VAR_TESTS, )"]
|
|
|
|
|
|
|
|
[tasks.action-fmt]
|
|
|
|
alias = "action-format"
|
2019-12-29 03:46:32 +00:00
|
|
|
|
|
|
|
[tasks.action-fmt_report]
|
|
|
|
description = "`cargo fmt` lint report"
|
|
|
|
command = "cargo"
|
|
|
|
args = ["fmt", "--", "--check"]
|
|
|
|
|
2020-05-02 17:38:25 +00:00
|
|
|
[tasks.action-spellcheck-codespell]
|
|
|
|
description = "`codespell` spellcheck repository"
|
|
|
|
command = "codespell" # (from `pip install codespell`)
|
|
|
|
args = [".", "--skip=*/.git,./target,./tests/fixtures", "--ignore-words-list=mut,od"]
|
|
|
|
|
2019-12-29 03:46:32 +00:00
|
|
|
[tasks.action-test_quiet]
|
|
|
|
description = "Test (in `--quiet` mode)"
|
|
|
|
command = "cargo"
|
|
|
|
args = ["test", "--quiet", "@@split(CARGO_MAKE_CARGO_BUILD_TEST_FLAGS, )"]
|
2020-05-02 22:37:02 +00:00
|
|
|
|
|
|
|
[tasks.action-display-help]
|
|
|
|
script_runner = "@duckscript"
|
|
|
|
script = [
|
|
|
|
'''
|
|
|
|
echo ""
|
|
|
|
echo "usage: `cargo make TARGET [ARGS...]`"
|
|
|
|
echo ""
|
|
|
|
echo "TARGETs:"
|
|
|
|
echo ""
|
|
|
|
result = exec "cargo" make --list-all-steps
|
|
|
|
# set_env CARGO_MAKE_VAR_UTILS ${result.stdout}
|
|
|
|
# echo ${result.stdout}
|
|
|
|
lines = split ${result.stdout} "\n"
|
|
|
|
# echo ${lines}
|
|
|
|
for line in ${lines}
|
|
|
|
if not is_empty ${line}
|
|
|
|
if contains ${line} " - ##"
|
|
|
|
line_segments = split ${line} " - ##"
|
|
|
|
desc = array_pop ${line_segments}
|
|
|
|
desc = trim ${desc}
|
|
|
|
target = array_pop ${line_segments}
|
|
|
|
target = trim ${target}
|
|
|
|
l = length ${target}
|
2020-05-06 21:31:40 +00:00
|
|
|
r = range 0 18
|
2020-05-02 22:37:02 +00:00
|
|
|
spacing = set ""
|
|
|
|
for i in ${r}
|
|
|
|
if greater_than ${i} ${l}
|
|
|
|
spacing = set "${spacing} "
|
|
|
|
end_if
|
|
|
|
end
|
|
|
|
echo ${target}${spacing}${desc}
|
|
|
|
end_if
|
|
|
|
end_if
|
|
|
|
end
|
|
|
|
echo ""
|
|
|
|
'''
|
|
|
|
]
|