[arg("arch", pattern="x86|x86_64|armeabi-v7a|arm64-v8a")]
[arg("profile", pattern="release|debug")]
[script("bash")]
build profile arch:
    set -euo pipefail

    arch='{{arch}}'
    profile='{{profile}}'
    # ^ capitalizes the first letter
    task_name="assemble${arch^}${profile^}"

    ./gradlew "$task_name"

test:
    cargo test
    ./gradlew testDebugUnitTest

test-cov:
    cargo llvm-cov --no-report

ktlint-paths := "build.gradle.kts app/build.gradle.kts app/src/**/*.kt buildSrc/build.gradle.kts buildSrc/settings.gradle.kts buildSrc/src/**/*.kt"

alias fmt := format

[parallel]
format: format-rust format-kotlin

[private]
format-rust:
    -cargo fmt

[private]
format-kotlin:
    -ktlint --editorconfig=../.editorconfig -F {{ ktlint-paths }}

[parallel]
format-check: format-check-rust format-check-kotlin

[private]
format-check-rust:
    cargo fmt --check

[private]
format-check-kotlin:
    ktlint --editorconfig=../.editorconfig {{ ktlint-paths }}
