Browse Source

mods

master
Jonathan Strong 4 months ago
parent
commit
d196fc4710
1 changed files with 49 additions and 30 deletions
  1. +49
    -30
      justfile

+ 49
- 30
justfile View File

@@ -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

Loading…
Cancel
Save