From d196fc471026dfed35f7ef6b3f7bb0212fc84783 Mon Sep 17 00:00:00 2001 From: Jonathan Strong Date: Thu, 22 Sep 2022 21:39:44 -0400 Subject: [PATCH] mods --- justfile | 79 +++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 49 insertions(+), 30 deletions(-) diff --git a/justfile b/justfile index 967414e..2478b02 100644 --- a/justfile +++ b/justfile @@ -1,45 +1,64 @@ -export MAKEFLAGS := "-j8" +set dotenv-load := true +rustc-version := "nightly" + +#export RUSTFLAGS := "-C link-arg=-fuse-ld=lld -Ztime-passes" export RUSTFLAGS := "-C link-arg=-fuse-ld=lld -C target-cpu=native" -#export RUSTFLAGS := "-C linker-plugin-lto -C linker=/home/jstrong/src/clang-12/bin/clang-12 -C link-arg=-fuse-ld=lld -C target-cpu=native" -cargo +args='': - cargo {{args}} +cargo cmd +args='': + cd {{invocation_directory()}} && cargo +{{rustc-version}} {{cmd}} {{args}} + +# cargo check {{args}} +check +args='': && (cargo "check" args) + +# cargo test {{args}} +test +args='': && (cargo "test" args) -check +args='': - @just cargo check {{args}} +# cargo bench {{args}} +bench +args='': && (cargo "bench" args) -debug-build binary_name='binary-serialization' +args='': - @just cargo build --bin {{binary_name}} {{args}} +# cargo update {{args}} +update +args='': && (cargo "update" args) -release-build binary_name='polar' +args='': - @just cargo build --bin {{binary_name}} --release {{args}} +# cargo run {{args}} +run +args='': && (cargo "run" args) -example name +args='': - @just cargo build --example {{name}} {{args}} +# cargo doc --open {{args}} +doc +args='': && (cargo "doc" "--open" args) -test +args='': - @just cargo test {{args}} +# just rebuild docs, don't open browser page again +redoc +args='': && (cargo "doc" args) -doc +args='': - @just cargo doc --open {{args}} +# like doc, but include private items +doc-priv +args='': && (cargo "doc" "--open" "--document-private-items" args) -doc-priv +args='': - @just cargo doc --open --document-private-items {{args}} +# cargo build --bin {{binary-name}} {{args}} +debug-build binary-name +args='': && (cargo "build" "--bin" binary-name args) +# cargo build --bin {{binary-name}} --release {{args}} +release-build binary-name +args='': && (cargo "build" "--bin" binary-name "--release" args) + +# cargo build --example {{example-name}} {{args}} +example example-name +args='': && (cargo "build" "--example" example-name args) + +# display env variables that will be used for building show-build-env: - @ env | rg RUST - @ env | rg '^MAKEFLAGS' | sort + @ echo "invocation_dir() = {{invocation_directory()}}" + @ echo "rustc-version = {{rustc-version}}" + @ env | rg '(RUST|SCC)' -i --color never + +pre-release: && (cargo "check") (cargo "test") (cargo "clippy") (cargo "fmt") -bench +args='': - @just cargo bench {{args}} +cache-stats: + sccache -s -update +args='': - @just cargo update {{args}} +set-git-email email +dirs: + echo "setting git email to {{email}} for {{dirs}}" + for DIR in {{dirs}}; do \ + [ -d $DIR/.git ] && git -C $DIR config user.email "{{email}}" || echo "no $DIR/.git folder, skipping..."; \ + done -rebuild: - just cargo clean - just update - just test +show-git-email dir: + @[ -d {{dir}}/.git ] && echo "{{dir}},$(git -C {{dir}} config user.email)" || exit 0 -flush-disk-cache: - sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches' +show-git-emails: + fd -t d . --max-depth 1 -x just show-git-email {} | xsv sort -s 2,1 | xsv table