2023-06-11 20:26:45 +00:00
|
|
|
# configuration for https://github.com/sagiegurari/cargo-make
|
|
|
|
|
2020-12-06 15:27:26 +00:00
|
|
|
[config]
|
|
|
|
skip_core_tasks = true
|
|
|
|
|
2023-07-17 10:31:31 +00:00
|
|
|
[env]
|
|
|
|
# all features except the backend ones
|
|
|
|
ALL_FEATURES = "all-widgets,macros,serde"
|
2020-12-06 15:27:26 +00:00
|
|
|
|
2024-05-13 08:34:52 +00:00
|
|
|
[env.ALL_FEATURES_FLAG]
|
2023-09-05 23:39:34 +00:00
|
|
|
# Windows does not support building termion, so this avoids the build failure by providing two
|
|
|
|
# sets of flags, one for Windows and one for other platforms.
|
2024-05-13 08:34:52 +00:00
|
|
|
source = "${CARGO_MAKE_RUST_TARGET_OS}"
|
|
|
|
default_value = "--features=all-widgets,macros,serde,crossterm,termion,termwiz,underline-color,unstable"
|
|
|
|
mapping = { "windows" = "--features=all-widgets,macros,serde,crossterm,termwiz,underline-color,unstable" }
|
2023-09-05 23:39:34 +00:00
|
|
|
|
2023-07-17 10:31:31 +00:00
|
|
|
[tasks.default]
|
|
|
|
alias = "ci"
|
2023-06-26 07:31:30 +00:00
|
|
|
|
2023-07-17 10:31:31 +00:00
|
|
|
[tasks.ci]
|
2023-08-12 19:48:00 +00:00
|
|
|
description = "Run continuous integration tasks"
|
2024-08-03 17:26:04 +00:00
|
|
|
dependencies = ["lint", "clippy", "check", "test"]
|
2023-06-26 07:31:30 +00:00
|
|
|
|
2024-08-03 17:26:04 +00:00
|
|
|
[tasks.lint]
|
|
|
|
description = "Lint code style (formatting, typos, docs, markdown)"
|
|
|
|
dependencies = ["lint-format", "lint-typos", "lint-docs", "lint-markdown"]
|
2023-06-26 07:31:30 +00:00
|
|
|
|
2023-09-05 07:48:36 +00:00
|
|
|
[tasks.lint-format]
|
|
|
|
description = "Lint code formatting"
|
2023-06-26 07:31:30 +00:00
|
|
|
toolchain = "nightly"
|
|
|
|
command = "cargo"
|
|
|
|
args = ["fmt", "--all", "--check"]
|
|
|
|
|
2023-09-05 07:48:36 +00:00
|
|
|
[tasks.format]
|
|
|
|
description = "Fix code formatting"
|
|
|
|
toolchain = "nightly"
|
|
|
|
command = "cargo"
|
|
|
|
args = ["fmt", "--all"]
|
|
|
|
|
|
|
|
[tasks.lint-typos]
|
2023-08-12 19:48:00 +00:00
|
|
|
description = "Run typo checks"
|
2023-06-26 07:31:30 +00:00
|
|
|
install_crate = { crate_name = "typos-cli", binary = "typos", test_arg = "--version" }
|
|
|
|
command = "typos"
|
|
|
|
|
2023-09-05 07:48:36 +00:00
|
|
|
[tasks.lint-docs]
|
2023-09-02 02:59:07 +00:00
|
|
|
description = "Check documentation for errors and warnings"
|
|
|
|
toolchain = "nightly"
|
|
|
|
command = "cargo"
|
|
|
|
args = [
|
|
|
|
"rustdoc",
|
2023-09-05 23:39:34 +00:00
|
|
|
"--no-default-features",
|
|
|
|
"${ALL_FEATURES_FLAG}",
|
2023-09-02 02:59:07 +00:00
|
|
|
"--",
|
|
|
|
"-Zunstable-options",
|
|
|
|
"--check",
|
2023-09-05 07:48:36 +00:00
|
|
|
"-Dwarnings",
|
2023-09-02 02:59:07 +00:00
|
|
|
]
|
|
|
|
|
2024-08-03 17:26:04 +00:00
|
|
|
[tasks.lint-markdown]
|
|
|
|
description = "Check markdown files for errors and warnings"
|
|
|
|
command = "markdownlint-cli2"
|
|
|
|
args = ["**/*.md", "!target"]
|
|
|
|
|
2023-06-26 07:31:30 +00:00
|
|
|
[tasks.check]
|
2023-08-12 19:48:00 +00:00
|
|
|
description = "Check code for errors and warnings"
|
2020-12-06 15:27:26 +00:00
|
|
|
command = "cargo"
|
2023-07-17 10:31:31 +00:00
|
|
|
args = [
|
|
|
|
"check",
|
|
|
|
"--all-targets",
|
2023-09-05 07:48:36 +00:00
|
|
|
"--no-default-features",
|
2023-09-05 23:39:34 +00:00
|
|
|
"${ALL_FEATURES_FLAG}",
|
2023-06-26 07:31:30 +00:00
|
|
|
]
|
|
|
|
|
2023-07-17 10:31:31 +00:00
|
|
|
[tasks.build]
|
2023-08-12 19:48:00 +00:00
|
|
|
description = "Compile the project"
|
2020-12-06 15:27:26 +00:00
|
|
|
command = "cargo"
|
2023-07-17 10:31:31 +00:00
|
|
|
args = [
|
|
|
|
"build",
|
|
|
|
"--all-targets",
|
2023-09-05 07:48:36 +00:00
|
|
|
"--no-default-features",
|
2023-09-05 23:39:34 +00:00
|
|
|
"${ALL_FEATURES_FLAG}",
|
2023-06-26 07:31:30 +00:00
|
|
|
]
|
|
|
|
|
2023-07-17 10:31:31 +00:00
|
|
|
[tasks.clippy]
|
2023-08-12 19:48:00 +00:00
|
|
|
description = "Run Clippy for linting"
|
2020-12-06 15:27:26 +00:00
|
|
|
command = "cargo"
|
2023-07-17 10:31:31 +00:00
|
|
|
args = [
|
|
|
|
"clippy",
|
|
|
|
"--all-targets",
|
|
|
|
"--tests",
|
|
|
|
"--benches",
|
2023-09-05 07:48:36 +00:00
|
|
|
"--no-default-features",
|
2023-09-05 23:39:34 +00:00
|
|
|
"${ALL_FEATURES_FLAG}",
|
2023-07-17 10:31:31 +00:00
|
|
|
"--",
|
|
|
|
"-D",
|
|
|
|
"warnings",
|
2023-06-26 07:31:30 +00:00
|
|
|
]
|
|
|
|
|
2023-12-27 18:50:56 +00:00
|
|
|
[tasks.install-nextest]
|
|
|
|
description = "Install cargo-nextest"
|
|
|
|
install_crate = { crate_name = "cargo-nextest", binary = "cargo-nextest", test_arg = "--help" }
|
|
|
|
|
2023-07-17 10:31:31 +00:00
|
|
|
[tasks.test]
|
2023-08-12 19:48:00 +00:00
|
|
|
description = "Run tests"
|
2023-12-27 18:50:56 +00:00
|
|
|
run_task = { name = ["test-lib", "test-doc"] }
|
|
|
|
|
|
|
|
[tasks.test-lib]
|
|
|
|
description = "Run default tests"
|
|
|
|
dependencies = ["install-nextest"]
|
2023-07-17 10:31:31 +00:00
|
|
|
command = "cargo"
|
|
|
|
args = [
|
2023-12-27 18:50:56 +00:00
|
|
|
"nextest",
|
|
|
|
"run",
|
2023-07-17 10:31:31 +00:00
|
|
|
"--all-targets",
|
2023-09-05 07:48:36 +00:00
|
|
|
"--no-default-features",
|
2023-09-05 23:39:34 +00:00
|
|
|
"${ALL_FEATURES_FLAG}",
|
2023-07-17 10:31:31 +00:00
|
|
|
]
|
2023-06-26 07:31:30 +00:00
|
|
|
|
2023-07-17 10:31:31 +00:00
|
|
|
[tasks.test-doc]
|
2023-08-12 19:48:00 +00:00
|
|
|
description = "Run documentation tests"
|
2023-07-17 10:31:31 +00:00
|
|
|
command = "cargo"
|
2023-09-05 23:39:34 +00:00
|
|
|
args = ["test", "--doc", "--no-default-features", "${ALL_FEATURES_FLAG}"]
|
2023-05-12 15:58:01 +00:00
|
|
|
|
2023-06-26 07:31:30 +00:00
|
|
|
[tasks.test-backend]
|
2023-07-17 10:31:31 +00:00
|
|
|
# takes a command line parameter to specify the backend to test (e.g. "crossterm")
|
2023-08-12 19:48:00 +00:00
|
|
|
description = "Run backend-specific tests"
|
2023-12-27 18:50:56 +00:00
|
|
|
dependencies = ["install-nextest"]
|
2020-12-06 15:27:26 +00:00
|
|
|
command = "cargo"
|
|
|
|
args = [
|
2023-12-27 18:50:56 +00:00
|
|
|
"nextest",
|
|
|
|
"run",
|
2023-06-26 07:31:30 +00:00
|
|
|
"--all-targets",
|
2023-09-05 07:48:36 +00:00
|
|
|
"--no-default-features",
|
|
|
|
"--features",
|
|
|
|
"${ALL_FEATURES},${@}",
|
2021-11-11 14:56:37 +00:00
|
|
|
]
|
|
|
|
|
2023-07-17 10:31:31 +00:00
|
|
|
[tasks.coverage]
|
2023-08-12 19:48:00 +00:00
|
|
|
description = "Generate code coverage report"
|
2023-07-17 10:31:31 +00:00
|
|
|
command = "cargo"
|
|
|
|
args = [
|
|
|
|
"llvm-cov",
|
|
|
|
"--lcov",
|
2023-09-05 07:48:36 +00:00
|
|
|
"--output-path",
|
|
|
|
"target/lcov.info",
|
2023-07-17 10:31:31 +00:00
|
|
|
"--no-default-features",
|
2023-09-05 23:39:34 +00:00
|
|
|
"${ALL_FEATURES_FLAG}",
|
2023-07-17 10:31:31 +00:00
|
|
|
]
|
2020-12-06 15:27:26 +00:00
|
|
|
|
2020-12-13 14:29:31 +00:00
|
|
|
[tasks.run-example]
|
|
|
|
private = true
|
2021-11-11 14:56:37 +00:00
|
|
|
condition = { env_set = ["TUI_EXAMPLE_NAME"] }
|
2020-12-13 14:29:31 +00:00
|
|
|
command = "cargo"
|
2023-09-05 07:48:36 +00:00
|
|
|
args = [
|
|
|
|
"run",
|
|
|
|
"--release",
|
|
|
|
"--example",
|
|
|
|
"${TUI_EXAMPLE_NAME}",
|
|
|
|
"--features",
|
|
|
|
"all-widgets",
|
|
|
|
]
|
2020-12-13 14:29:31 +00:00
|
|
|
|
|
|
|
[tasks.build-examples]
|
2023-08-12 19:48:00 +00:00
|
|
|
description = "Compile project examples"
|
2020-12-13 14:29:31 +00:00
|
|
|
command = "cargo"
|
2023-07-17 15:59:56 +00:00
|
|
|
args = ["build", "--examples", "--release", "--features", "all-widgets"]
|
2020-12-13 14:29:31 +00:00
|
|
|
|
|
|
|
[tasks.run-examples]
|
2023-08-12 19:48:00 +00:00
|
|
|
description = "Run project examples"
|
2020-12-13 14:29:31 +00:00
|
|
|
dependencies = ["build-examples"]
|
2020-12-06 15:27:26 +00:00
|
|
|
script = '''
|
2020-12-13 14:29:31 +00:00
|
|
|
#!@duckscript
|
|
|
|
files = glob_array ./examples/*.rs
|
|
|
|
for file in ${files}
|
|
|
|
name = basename ${file}
|
|
|
|
name = substring ${name} -3
|
|
|
|
set_env TUI_EXAMPLE_NAME ${name}
|
2021-11-11 14:56:37 +00:00
|
|
|
cm_run_task run-example
|
2020-12-13 14:29:31 +00:00
|
|
|
end
|
2020-12-06 15:27:26 +00:00
|
|
|
'''
|