set positional-arguments set dotenv-load := false help: @just --list --unsorted clean: cargo clean build: cargo build alias b := build release: cargo build --release install: cargo install --path . bootstrap: cargo install cargo-edit test *ARGS: # Because trybuild doesn't support passing environment directly, tests are dependent on state, namely the state of the MODEL_FOLDERS # var in the test runner's process environment. # To solve that dependence, we need to set --test-threads=1. # If trybuild was modified to allow passing env for a test run, then cargo test --features sqlite,uuid --tests -- --test-threads=1 cargo test --features postgres,uuid,chrono --tests -- --test-threads=1 check: cargo check alias c := check fix: cargo clippy --fix bench: cargo criterion --features bench # Bump version. level=major,minor,patch version level: git diff-index --exit-code HEAD > /dev/null || ! echo You have untracked changes. Commit your changes before bumping the version. cargo set-version --bump {{level}} cargo update # This bumps Cargo.lock VERSION=$(rg "version = \"([0-9.]+)\"" -or '$1' Cargo.toml | head -n1) && \ git commit -am "Bump version {{level}} to $VERSION" && \ git tag v$VERSION && \ git push origin v$VERSION git push publish: cargo publish patch: test just version patch just publish run *args: cargo run --features sqlite,runtime-tokio-rustls,uuid "$@" alias r := run # Development workflow for macros # 1. Write an example for what you want to run # 2. Run `just run` to run it. Encounter compile errors. # 3. Run `just expand-run` to expand, then compile it. This compilation step shows actual line numbers on expanded output. # 4. Fix the errors, and run `just rerun` to confirm the manual edits to the expanded code have fixed the issue. # 5. Edit the macro code, so that it achieves the same output as your manual edits to the expanded code. # 6. Dance a jig because you're now a macro wizard and developing macros with 1/100th the guesswork of before. expand-run: mkdir -p examples touch examples/expand.rs cp tests/postgres/complex.rs examples/expandable.rs printf '#![allow(unused)]\n' > examples/expand.rs printf '#![feature(fmt_internals)]\n' >> examples/expand.rs printf '#![feature(fmt_helpers_for_derive)]\n' >> examples/expand.rs printf '#![feature(print_internals)]\n' >> examples/expand.rs printf '#![feature(core_panic)]\n' >> examples/expand.rs cargo expand --example expandable --features sqlite,uuid >> examples/expand.rs sd '::alloc::' '::std::' examples/expand.rs -f sd '# ?\[ormlite.*' '' examples/expand.rs -f sd -s '#[rustc_box]' '' examples/expand.rs -f @just rerun alias er := expand-run rerun: cargo +nightly run --example expand --features sqlite,uuid alias rr := expand-run backtrace: RUSTFLAGS="-Z macro-backtrace" cargo run --example many-to-one --features sqlite,runtime-tokio-rustls,uuid