Justfile improvements

This commit is contained in:
Benjamin Sago 2021-04-01 09:39:03 +01:00
parent c1435411c3
commit 5d13a65e4f
2 changed files with 59 additions and 24 deletions

View File

@ -1,74 +1,104 @@
all: build test xtests all: build test
all-release: build-release test-release xtests-release all-release: build-release test-release
# compiles the exa binary #----------#
# building #
#----------#
# compile the exa binary
@build: @build:
cargo build cargo build
# compiles the exa binary (in release mode) # compile the exa binary (in release mode)
@build-release: @build-release:
cargo build --release --verbose cargo build --release --verbose
# compiles the exa binary with every combination of feature flags # produce an HTML chart of compilation timings
@build-features: @build-time:
cargo hack build --feature-powerset cargo +nightly clean
cargo +nightly build -Z timings
# check that the exa binary can compile
@check:
cargo check
# runs unit tests #---------------#
# running tests #
#---------------#
# run unit tests
@test: @test:
cargo test --all -- --quiet cargo test --workspace -- --quiet
# runs unit tests (in release mode) # run unit tests (in release mode)
@test-release: @test-release:
cargo test --release --all --verbose cargo test --workspace --release --verbose
# runs unit tests with every combination of feature flags
@test-features:
cargo hack test --feature-powerset -- --quiet
# runs extended tests #------------------------#
# running extended tests #
#------------------------#
# run extended tests
@xtests: @xtests:
xtests/run.sh xtests/run.sh
# runs extended tests (using the release mode exa) # run extended tests (using the release mode exa)
@xtests-release: @xtests-release:
xtests/run.sh --release xtests/run.sh --release
# display the number of extended tests that get run
@count-xtests:
grep -F '[[cmd]]' -R xtests | wc -l
# lints the code
#-----------------------#
# code quality and misc #
#-----------------------#
# lint the code
@clippy: @clippy:
touch src/main.rs touch src/main.rs
cargo clippy cargo clippy
# updates dependency versions, and checks for outdated ones # update dependency versions, and checks for outdated ones
@update-deps: @update-deps:
cargo update cargo update
command -v cargo-outdated >/dev/null || (echo "cargo-outdated not installed" && exit 1) command -v cargo-outdated >/dev/null || (echo "cargo-outdated not installed" && exit 1)
cargo outdated cargo outdated
# lists unused dependencies # list unused dependencies
@unused-deps: @unused-deps:
command -v cargo-udeps >/dev/null || (echo "cargo-udeps not installed" && exit 1) command -v cargo-udeps >/dev/null || (echo "cargo-udeps not installed" && exit 1)
cargo +nightly udeps cargo +nightly udeps
# prints versions of the necessary build tools # check that every combination of feature flags is successful
@check-features:
command -v cargo-hack >/dev/null || (echo "cargo-hack not installed" && exit 1)
cargo hack check --feature-powerset
# print versions of the necessary build tools
@versions: @versions:
rustc --version rustc --version
cargo --version cargo --version
# builds the man pages #---------------#
# documentation #
#---------------#
# build the man pages
@man: @man:
mkdir -p "${CARGO_TARGET_DIR:-target}/man" mkdir -p "${CARGO_TARGET_DIR:-target}/man"
pandoc --standalone -f markdown -t man man/exa.1.md > "${CARGO_TARGET_DIR:-target}/man/exa.1" pandoc --standalone -f markdown -t man man/exa.1.md > "${CARGO_TARGET_DIR:-target}/man/exa.1"
pandoc --standalone -f markdown -t man man/exa_colors.5.md > "${CARGO_TARGET_DIR:-target}/man/exa_colors.5" pandoc --standalone -f markdown -t man man/exa_colors.5.md > "${CARGO_TARGET_DIR:-target}/man/exa_colors.5"
# builds and previews the main man page (exa.1) # build and preview the main man page (exa.1)
@man-1-preview: man @man-1-preview: man
man "${CARGO_TARGET_DIR:-target}/man/exa.1" man "${CARGO_TARGET_DIR:-target}/man/exa.1"
# builds and previews the colour configuration man page (exa_colors.5) # build and preview the colour configuration man page (exa_colors.5)
@man-5-preview: man @man-5-preview: man
man "${CARGO_TARGET_DIR:-target}/man/exa_colors.5" man "${CARGO_TARGET_DIR:-target}/man/exa_colors.5"

View File

@ -7,6 +7,11 @@ case "$1" in
*) exa_binary="$HOME/target/debug/exa" ;; *) exa_binary="$HOME/target/debug/exa" ;;
esac esac
if [ ! -e /vagrant ]; then
echo "The extended tests must be run on the Vagrant machine."
exit 1
fi
if [ ! -f "$exa_binary" ]; then if [ ! -f "$exa_binary" ]; then
echo "exa binary ($exa_binary) does not exist" echo "exa binary ($exa_binary) does not exist"
if [ "$1" != "--release" ]; then echo -e "create it first with \033[1;32mbuild-exa\033[0m or \033[1;32mb\033[0m"; fi if [ "$1" != "--release" ]; then echo -e "create it first with \033[1;32mbuild-exa\033[0m or \033[1;32mb\033[0m"; fi