fork/eza
git clone https://git.julia.blue/fork/eza
a362025d
main
1# SPDX-FileCopyrightText: 2024 Christina Sørensen 2# SPDX-License-Identifier: EUPL-1.2 3_default : 4@ just -l 5 6all : build test 7all-release : build-release test-release 8 9[ group ( 'house-keeping' )] 10genDemo : 11fish_prompt ="> " fish_history ="eza_history" vhs < docs/tapes/demo.tape 12nsxiv -a docs/images/demo.gif 13 14#----------# 15# building # 16#----------# 17 18# compile the exa binary 19[ group ( 'building' )] 20@ build : 21cargo build 22 23# compile the exa binary (in release mode) 24[ group ( 'building' )] 25@ build-release : 26cargo build--release --verbose 27 28# produce an HTML chart of compilation timings 29[ group ( 'building' )] 30@ build-time : 31cargo +nightly clean 32cargo +nightly build-Z timings 33 34# check that the exa binary can compile 35[ group ( 'building' )] 36@ check : 37cargo check 38 39 40#---------------# 41# running tests # 42#---------------# 43 44# run unit tests 45[ group ( 'testing' )] 46@ test : 47cargo test--workspace -- --quiet 48 49# run unit tests (in release mode) 50[ group ( 'testing' )] 51@ test-release : 52cargo test--workspace --release --verbose 53 54#-----------------------# 55# code quality and misc # 56#-----------------------# 57 58# lint the code 59[ group ( 'house-keeping' )] 60@ clippy : 61touch src/main.rs 62cargo clippy 63 64# update dependency versions, and checks for outdated ones 65[ group ( 'house-keeping' )] 66@ update-deps : 67cargo update 68command -v cargo-outdated> /dev/null || (echo "cargo-outdated not installed" && exit 1) 69cargo outdated 70 71# list unused dependencies 72[ group ( 'house-keeping' )] 73@ unused-deps : 74command -v cargo-udeps> /dev/null || (echo "cargo-udeps not installed" && exit 1) 75cargo +nightly udeps 76 77# check that every combination of feature flags is successful 78[ group ( 'house-keeping' )] 79@ check-features : 80command -v cargo-hack> /dev/null || (echo "cargo-hack not installed" && exit 1) 81cargo hack check--feature-powerset 82 83# print versions of the necessary build tools 84[ group ( 'house-keeping' )] 85@ versions : 86rustc --version 87cargo --version 88 89 90#---------------# 91# documentation # 92#---------------# 93 94# build the man pages 95[ group ( 'documentation' )] 96@ man : 97mkdir -p " ${ CARGO_TARGET_DIR :-target} /man" 98version =$( awk 'BEGIN { FS = "\"" } ; /^version/ { print $2 ; exit }' Cargo.toml) ; \ 99for page in eza.1 eza_colors.5 eza_colors-explanation.5;do \ 100sed "s/\$version/v ${ version } /g" "man/ ${ page } .md" | pandoc --standalone -f markdown-t man> " ${ CARGO_TARGET_DIR :-target} /man/ ${ page } " ; \ 101done ; 102 103# build and preview the main man page (eza.1) 104[ group ( 'documentation' )] 105@ man-1-preview : man 106man " ${ CARGO_TARGET_DIR :-target} /man/eza.1" 107 108# build and preview the colour configuration man page (eza_colors.5) 109[ group ( 'documentation' )] 110@ man-5-preview : man 111man " ${ CARGO_TARGET_DIR :-target} /man/eza_colors.5" 112 113# build and preview the colour configuration man page (eza_colors.5) 114[ group ( 'documentation' )] 115@ man-5-explanations-preview : man 116man " ${ CARGO_TARGET_DIR :-target} /man/eza_colors-explanation.5" 117 118#---------------# 119# release # 120#---------------# 121 122# To override the version, pass it as an argument before the recipe: 123# e.g. just version=1.2.3 release 124# If version is not set, it will be determined by convco. 125version := "" 126new_version := if version == "" { "$(convco version --bump)" } else { version } 127 128# If you're not cafkafk and she isn't dead, don't run this! 129# 130# usage: release major, release minor, release patch 131[ group ( 'release' )] 132release : 133cargo bump" {{ new_version }} " 134git cliff-c .config/cliff.toml-t " {{ new_version }} " > CHANGELOG.md 135cargo check 136nix build-L ./#clippy 137git checkout-b "cafk-release-v {{ new_version }} " 138git commit-asm "chore: eza v {{ new_version }} changelogs, version bump" 139git push 140@ echo "waiting 10 seconds for github to catch up..." 141sleep 10 142gh pr create--draft --title "chore: release v {{ new_version }} " --body "This PR was auto-generated by our lovely just file" --reviewer cafkafk 143@ echo "Now go review that and come back and run gh-release" 144 145[ group ( 'release' )] 146@ gh-release : 147git tag-d "v {{ new_version }} " ||echo "tag not found, creating" ; 148git tag--sign -a "v {{ new_version }} " -m "auto generated by the justfile for eza v $( convco version) " 149just cross 150just mangen 151just completions 152mkdir -p ./target/"release-notes- $( convco version) " 153git cliff-c .config/cliff.toml-t "v $( convco version) " --current > ./target/"release-notes- $( convco version) /RELEASE.md" 154just checksum>> ./target/"release-notes- $( convco version) /RELEASE.md" 155 156git push origin"v {{ new_version }} " 157gh release create"v $( convco version) " --target " $( git rev-parse HEAD) " --title "eza v $( convco version) " -d -F ./target/"release-notes- $( convco version) /RELEASE.md" ./target/"bin- $( convco version) " /* ./target/"man- $( convco version) .tar.gz" ./target/"completions- $( convco version) .tar.gz" 158 159#----------------# 160# binaries # 161#----------------# 162 163# TODO: make static/no_static DRY 164# TODO: add name prefix/suffix arguments 165 166[ group ( 'binaries' )] 167tar BINARY TARGET : 168tar czvf ./target/"bin- $( convco version) " /{{ BINARY }} _{{ TARGET }} .tar.gz-C ./target/{{ TARGET }} /release/ ./{{ BINARY }} 169 170[ group ( 'binaries' )] 171zip BINARY TARGET : 172zip -j ./target/"bin- $( convco version) " /{{ BINARY }} _{{ TARGET }} .zip ./target/{{ TARGET }} /release/{{ BINARY }} 173 174[ group ( 'binaries' )] 175tar_static BINARY TARGET : 176tar czvf ./target/"bin- $( convco version) " /{{ BINARY }} _{{ TARGET }} _static.tar.gz-C ./target/{{ TARGET }} /release/ ./{{ BINARY }} 177 178[ group ( 'binaries' )] 179zip_static BINARY TARGET : 180zip -j ./target/"bin- $( convco version) " /{{ BINARY }} _{{ TARGET }} _static.zip ./target/{{ TARGET }} /release/{{ BINARY }} 181 182[ group ( 'binaries' )] 183tar_no_libgit BINARY TARGET : 184tar czvf ./target/"bin- $( convco version) " /{{ BINARY }} _{{ TARGET }} _no_libgit.tar.gz-C ./target/{{ TARGET }} /release/ ./{{ BINARY }} 185 186[ group ( 'binaries' )] 187zip_no_libgit BINARY TARGET : 188zip -j ./target/"bin- $( convco version) " /{{ BINARY }} _{{ TARGET }} _no_libgit.zip ./target/{{ TARGET }} /release/{{ BINARY }} 189 190[ group ( 'binaries' )] 191tar_static_no_libgit BINARY TARGET : 192tar czvf ./target/"bin- $( convco version) " /{{ BINARY }} _{{ TARGET }} _static_no_libgit.tar.gz-C ./target/{{ TARGET }} /release/ ./{{ BINARY }} 193 194[ group ( 'binaries' )] 195zip_static_no_libgit BINARY TARGET : 196zip -j ./target/"bin- $( convco version) " /{{ BINARY }} _{{ TARGET }} _static_no_libgit.zip ./target/{{ TARGET }} /release/{{ BINARY }} 197 198[ group ( 'binaries' )] 199binary BINARY TARGET : 200rustup target add{{ TARGET }} 201cross build--release --target {{ TARGET }} 202just tar{{ BINARY }} {{ TARGET }} 203just zip{{ BINARY }} {{ TARGET }} 204 205[ group ( 'binaries' )] 206binary_static BINARY TARGET : 207rustup target add{{ TARGET }} 208RUSTFLAGS ='-C target-feature=+crt-static' cross build--release --target {{ TARGET }} 209just tar_static{{ BINARY }} {{ TARGET }} 210just zip_static{{ BINARY }} {{ TARGET }} 211 212[ group ( 'binaries' )] 213binary_no_libgit BINARY TARGET : 214rustup target add{{ TARGET }} 215cross build--no-default-features --release --target {{ TARGET }} 216just tar_no_libgit{{ BINARY }} {{ TARGET }} 217just zip_no_libgit{{ BINARY }} {{ TARGET }} 218 219[ group ( 'binaries' )] 220binary_static_no_libgit BINARY TARGET : 221rustup target add{{ TARGET }} 222RUSTFLAGS ='-C target-feature=+crt-static' cross build--no-default-features --release --target {{ TARGET }} 223just tar_static_no_libgit{{ BINARY }} {{ TARGET }} 224just zip_static_no_libgit{{ BINARY }} {{ TARGET }} 225 226[ group ( 'binaries' )] 227checksum : 228@ echo "# Checksums" 229@ echo "## sha256sum" 230@ echo '```' 231@ sha256sum ./target/"bin- $( convco version) " /* 232@ echo '```' 233@ echo "## md5sum" 234@ echo '```' 235@ md5sum ./target/"bin- $( convco version) " /* 236@ echo '```' 237@ echo "## blake3sum" 238@ echo '```' 239@ b3sum ./target/"bin- $( convco version) " /* 240@ echo '```' 241 242alias c := cross 243 244# Generate release binaries for EZA 245# 246# usage: cross 247[ group ( 'binaries' )] 248@ cross : 249# Setup Output Directory 250mkdir -p ./target/"bin- $( convco version) " 251 252# Install Toolchains/Targets 253rustup toolchain install stable 254 255## Linux 256### x86 257just binary eza x86_64-unknown-linux-gnu 258# just binary_static eza x86_64-unknown-linux-gnu 259just binary eza x86_64-unknown-linux-musl 260# just binary_static eza x86_64-unknown-linux-musl 261 262### aarch 263just binary eza aarch64-unknown-linux-gnu 264just binary_no_libgit eza aarch64-unknown-linux-gnu 265# BUG: just binary_static eza aarch64-unknown-linux-gnu 266 267### arm 268just binary eza arm-unknown-linux-gnueabihf 269just binary_no_libgit eza arm-unknown-linux-gnueabihf 270# just binary_static eza arm-unknown-linux-gnueabihf 271 272## MacOS 273# TODO: just binary eza x86_64-apple-darwin 274 275## Windows 276### x86 277just binary eza.exe x86_64-pc-windows-gnu 278# just binary_static eza.exe x86_64-pc-windows-gnu 279# TODO: just binary eza.exe x86_64-pc-windows-gnullvm 280# TODO: just binary eza.exe x86_64-pc-windows-msvc 281 282# Generate Checksums 283# TODO: moved to gh-release just checksum 284 285[ group ( 'documentation' )] 286@ mangen : 287# Setup Output Directory 288mkdir -p ./target/"man- $( convco version) " 289pandoc --standalone -f markdown-t man man/eza.1.md> ./target/"man- $( convco version) " /eza.1 290pandoc --standalone -f markdown-t man man/eza_colors.5.md> ./target/"man- $( convco version) " /eza_colors.5 291pandoc --standalone -f markdown-t man man/eza_colors-explanation.5.md> ./target/"man- $( convco version) " /eza_colors-explanation.5 292tar czvf ./target/"man- $( convco version) " .tar.gz ./target/"man- $( convco version) " 293 294[ group ( 'documentation' )] 295[ group ( 'binaries' )] 296@ completions : 297# Setup Output Directory 298mkdir -p ./target/"completions- $( convco version) " 299cp completions/*/* ./target/"completions- $( convco version) " / 300tar czvf ./target/"completions- $( convco version) " .tar.gz ./target/"completions- $( convco version) " 301 302 303#---------------------# 304# Integration testing # 305#---------------------# 306 307alias gen := gen_test_dir 308 309test_dir := "tests/test_dir" 310 311[ group ( 'testing' )] 312gen_test_dir : 313bash devtools/dir-generator.sh{{ test_dir }} 314 315# Runs integration tests in nix sandbox 316# 317# Required nix, likely won't work on windows. 318[ group ( 'testing' )] 319@ itest : 320nix build-L ./#trycmd-local 321 322# Runs integration tests in nix sandbox, and dumps outputs. 323# 324# WARNING: this can cause loss of work 325[ group ( 'testing' )] 326@ idump : 327rm ./tests/gen/*_nix.stderr-f ||echo 328rm ./tests/gen/*_nix.stdout-f ||echo 329rm ./tests/gen/*_unix.stderr-f ||echo 330rm ./tests/gen/*_unix.stdout-f ||echo 331rm ./tests/ptests/ptest_*.stderr-f ||echo 332rm ./tests/ptests/ptest_*.stdout-f ||echo 333 334nix build-L ./#trydump 335 336find result/dump-type f \(-name "*.stdout" -o -name "*.stderr" \)-exec sh-c 'base=$(basename {}); if [ -e "tests/gen/${base%.*}.toml" ]; then cp {} tests/gen/; elif [ -e "tests/cmd/${base%.*}.toml" ]; then cp {} tests/cmd/; elif [ -e "tests/ptests/${base%.*}.toml" ]; then cp {} tests/ptests/; fi' \; 337 338[ group ( 'testing' )] 339@ itest-gen : 340nix build-L ./#trycmd 341 342# Fully re-generates the integration tests using powertest 343[ group ( 'testing' )] 344@ regen : 345which powertest >&-2 >&- || (echo -e "Powertest not installed. Please Clone the repo and run:\n\tcargo install --path . --locked" && exit 1) 346echo "WARNING: this will delete all tests in tests/ptest" 347sleep 5 348echo "Deleting tests/ptests" 349rm -rf tests/ptests 350echo "Generating tests/ptests" 351powertest 352nix build-L ./#trydump 353find result/dump-type f \(-name "*.stdout" -o -name "*.stderr" \)-exec sh-c 'base=$(basename {}); if [ -e "tests/ptests/${base%.*}.toml" ]; then cp {} tests/ptests/; fi' \; 354