version: '3'

silent: true

tasks:

  build:
    desc: Builds in debug mode
    cmds:
      - cmd: cargo +stable build

  check:
    desc: Performs checks in debug mode
    cmds:
      - cmd: cargo +stable check

  clean:
    desc: Cleans all targets
    cmds:
      - cmd: cargo +stable clean

  clippy:
    desc: Runs clippy for all targets
    cmds:
      - cmd: cargo +stable clippy --all-targets

  cov:
    desc: Generates code coverage report in text format
    cmds:
      - cmd: cargo +stable llvm-cov clean
      - cmd: cargo +stable llvm-cov --no-cfg-coverage

  cov-examples:
    desc: Generates code coverage report in text format from examples
    cmds:
      - cmd: cargo +stable llvm-cov clean
      - cmd: cargo +stable llvm-cov run --example sedi --no-report --no-cfg-coverage
      - cmd: cargo +stable llvm-cov report

  cov-examples:
    desc: Generates code coverage report in text format from examples
    cmds:
      - cmd: cargo +stable llvm-cov clean
      - cmd: cargo +stable llvm-cov run --example sedi --no-report
      - cmd: cargo +stable llvm-cov report

  cov-html:
    desc: Generates code coverage report in HTML format
    cmds:
      - cmd: cargo +stable llvm-cov clean
      - cmd: cargo +stable llvm-cov --no-cfg-coverage --html

  cov-html-open:
    desc: Generates code coverage report in HTML format and opens in browser
    cmds:
      - cmd: cargo +stable llvm-cov clean
      - cmd: cargo +stable llvm-cov --no-cfg-coverage --html --open

  cov-badge:
    desc: Generates the detailed code coverage badge
    cmds:
      - cmd: cargo +stable llvm-cov clean
      - cmd: cargo +stable llvm-cov --no-cfg-coverage --json --summary-only | coverio -l coverage -c --tag cov-badge

  doc:
    desc: Generates documentation
    cmds:
      - cmd: cargo +stable doc --no-deps

  doc-open:
    desc: Generates documentation and opens it in browser
    cmds:
      - cmd: cargo +stable doc --no-deps --open

  doc-priv:
    desc: Generates documentation with private items
    cmds:
      - cmd: cargo +stable doc --no-deps --document-private-items

  doc-priv-open:
    desc: Generates documentation with private items and opens it in browser
    cmds:
      - cmd: cargo +stable doc --no-deps --open --document-private-items

  fmt:
    desc: Runs the code formatter
    cmds:
      - cmd: cargo +nightly fmt

  readme:
    desc: Regenerates README.md file
    cmds:
      - cmd: magg readme
      - task: cov-badge

  test:
    desc: Runs tests in debug mode
    cmds:
      - cmd: cargo +stable test

  testn:
    desc: Runs tests in debug mode using nextest
    cmds:
      - cmd: cargo +stable nextest run --no-fail-fast
