######################
#
# public tasks:
# * checks-flow
#   * lint
#   * lint-release
#   * format
# * test-flow
#   * test
#   * doc-test
#   * website-test
#
# packages/yew also contains `clippy-feature-soundness` to ensure everything is fine
# Run `cargo make --list-all-steps` for more details.
#
######################
[config]
min_version = "0.32.4"
skip_core_tasks = true
default_to_workspace = false

[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
CARGO_MAKE_CLIPPY_ARGS = "-- --deny=warnings"
CARGO_MAKE_WORKSPACE_SKIP_MEMBERS = [
    "examples/*",
    "tools/*",
]

[config.modify_core_tasks]
private = true
namespace = "core"

# checks

[tasks.lint]
category = "Checks"
description = "Runs clippy"
command = "cargo"
args = ["clippy", "--", "--deny=warnings"]

# Needed, because we have some code differences between debug and release builds
[tasks.lint-release]
category = "Checks"
command = "cargo"
args = ["clippy", "--all-targets", "--release", "--", "--deny=warnings"]

[tasks.format]
category = "Checks"
toolchain = "nightly"
env = { CARGO_MAKE_RUST_CHANNEL = "nightly" }


[tasks.checks-flow]
category = "Checks"
description = "Runs clippy in debug and release mode and format all the code"
run_task = { name = ["lint", "lint-release", "format"], fork = true }

# Tests

[tasks.test]
command = "cargo"
args = ["test", "--all-targets"]
workspace = true

[tasks.doc-test]
command = "cargo"
args = ["test", "--doc", "--all-features"]
workspace = true

[tasks.website-test]
command = "cargo"
args = ["test", "-p", "website-test"]

[tasks.test-flow]
category = "Testing"
description = "Run all tests"
run_task = { name = ["test", "doc-test", "website-test"], fork = true, parallel = true }

# misc

[tasks.generate-change-log]
category = "Maintainer processes"
toolchain = "stable"
command = "cargo"
args = ["run", "-p", "changelog", "--release", "${@}"]

[tasks.default]
#run_task = { name = ["checks-flow", "test-flow"], fork = true }
dependencies = ["checks-flow", "test-flow"]
