export LLVM_PROFILE_FILE := "cov/cargo-test-%p-%m.profraw"
grcov-binary := "--binary-path ./target/coverage/deps/"
grcov-ignore := "--ignore-not-existing --ignore '../*' --ignore \"/*\" --ignore 'target/*'"

[private]
default:
  @just -l

bacon:
  bacon -s

cov:
  CARGO_INCREMENTAL=0 RUSTFLAGS='-Cinstrument-coverage' \
    time cargo test -j4 --workspace --profile coverage
  rm -rf target/coverage/html || true
  time grcov . -s . {{grcov-binary}} {{grcov-ignore}} -t html -o target/coverage/html

cov-md:
  CARGO_INCREMENTAL=0 RUSTFLAGS='-Cinstrument-coverage' \
     time cargo test -j4 --workspace --profile coverage
  time grcov . -s . {{grcov-binary}} {{grcov-ignore}} -t markdown | sort

cov-md-ci:
  CARGO_INCREMENTAL=0 RUSTFLAGS='-Cinstrument-coverage' \
     time cargo test -j4 --workspace --profile coverage -- --skip test_tui_engine
  time grcov . -s . {{grcov-binary}} {{grcov-ignore}} -t markdown | sort

doc:
  CARGO_INCREMENTAL=0 RUSTFLAGS='-Cinstrument-coverage' RUSTDOCFLAGS='-Cinstrument-coverage' \
    cargo doc

example-tui-00:
  cargo run --example tui_00

example-tui-01:
  cargo run --example tui_01
