fork/eza
git clone https://git.julia.blue/fork/eza
89e6ab15
v0.15.0
1all : build test 2all-release : build-release test-release 3 4 5#----------# 6# building # 7#----------# 8 9# compile the exa binary 10@ build : 11cargo build 12 13# compile the exa binary (in release mode) 14@ build-release : 15cargo build--release --verbose 16 17# produce an HTML chart of compilation timings 18@ build-time : 19cargo +nightly clean 20cargo +nightly build-Z timings 21 22# check that the exa binary can compile 23@ check : 24cargo check 25 26 27#---------------# 28# running tests # 29#---------------# 30 31# run unit tests 32@ test : 33cargo test--workspace -- --quiet 34 35# run unit tests (in release mode) 36@ test-release : 37cargo test--workspace --release --verbose 38 39#-----------------------# 40# code quality and misc # 41#-----------------------# 42 43# lint the code 44@ clippy : 45touch src/main.rs 46cargo clippy 47 48# update dependency versions, and checks for outdated ones 49@ update-deps : 50cargo update 51command -v cargo-outdated> /dev/null || (echo "cargo-outdated not installed" && exit 1) 52cargo outdated 53 54# list unused dependencies 55@ unused-deps : 56command -v cargo-udeps> /dev/null || (echo "cargo-udeps not installed" && exit 1) 57cargo +nightly udeps 58 59# check that every combination of feature flags is successful 60@ check-features : 61command -v cargo-hack> /dev/null || (echo "cargo-hack not installed" && exit 1) 62cargo hack check--feature-powerset 63 64# print versions of the necessary build tools 65@ versions : 66rustc --version 67cargo --version 68 69 70#---------------# 71# documentation # 72#---------------# 73 74# build the man pages 75@ man : 76mkdir -p " ${ CARGO_TARGET_DIR :-target} /man" 77version =$( awk 'BEGIN { FS = "\"" } ; /^version/ { print $2 ; exit }' Cargo.toml) ; \ 78for page in eza.1 eza_colors.5 eza_colors-explanation.5;do \ 79sed "s/\$version/v ${ version } /g" "man/ ${ page } .md" | pandoc --standalone -f markdown-t man> " ${ CARGO_TARGET_DIR :-target} /man/ ${ page } " ; \ 80done ; 81 82# build and preview the main man page (eza.1) 83@ man-1-preview : man 84man " ${ CARGO_TARGET_DIR :-target} /man/eza.1" 85 86# build and preview the colour configuration man page (eza_colors.5) 87@ man-5-preview : man 88man " ${ CARGO_TARGET_DIR :-target} /man/eza_colors.5" 89 90# build and preview the colour configuration man page (eza_colors.5) 91@ man-5-explanations-preview : man 92man " ${ CARGO_TARGET_DIR :-target} /man/eza_colors-explanation.5" 93 94#---------------# 95# release # 96#---------------# 97 98new_version := "$(convco version --bump)" 99 100# If you're not cafkafk and she isn't dead, don't run this! 101# 102# usage: release major, release minor, release patch 103release : 104cargo bump" {{ new_version }} " 105git cliff-t " {{ new_version }} " > CHANGELOG.md 106cargo check 107nix build-L ./#clippy 108git checkout-b "cafk-release-v {{ new_version }} " 109git commit-asm "chore: release eza v {{ new_version }} " 110git push 111@ echo "waiting 10 seconds for github to catch up..." 112sleep 10 113gh pr create--draft --title "chore: release v {{ new_version }} " --body "This PR was auto-generated by our lovely just file" --reviewer cafkafk 114@ echo "Now go review that and come back and run gh-release" 115 116@ gh-release : 117git tag-d "v {{ new_version }} " ||echo "tag not found, creating" ; 118git tag-a "v {{ new_version }} " -m "auto generated by the justfile for eza v $( convco version) " 119just cross 120mkdir -p ./target/"release-notes- $( convco version) " 121git cliff-t "v $( convco version) " --current > ./target/"release-notes- $( convco version) /RELEASE.md" 122just checksum>> ./target/"release-notes- $( convco version) /RELEASE.md" 123 124gh 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) " /* 125 126#----------------# 127# binaries # 128#----------------# 129 130tar BINARY TARGET : 131tar czvf ./target/"bin- $( convco version) " /{{ BINARY }} _{{ TARGET }} .tar.gz-C ./target/{{ TARGET }} /release/ ./{{ BINARY }} 132 133zip BINARY TARGET : 134zip -j ./target/"bin- $( convco version) " /{{ BINARY }} _{{ TARGET }} .zip ./target/{{ TARGET }} /release/{{ BINARY }} 135 136tar_static BINARY TARGET : 137tar czvf ./target/"bin- $( convco version) " /{{ BINARY }} _{{ TARGET }} _static.tar.gz-C ./target/{{ TARGET }} /release/ ./{{ BINARY }} 138 139zip_static BINARY TARGET : 140zip -j ./target/"bin- $( convco version) " /{{ BINARY }} _{{ TARGET }} _static.zip ./target/{{ TARGET }} /release/{{ BINARY }} 141 142binary BINARY TARGET : 143rustup target add{{ TARGET }} 144cross build--release --target {{ TARGET }} 145just tar{{ BINARY }} {{ TARGET }} 146just zip{{ BINARY }} {{ TARGET }} 147 148binary_static BINARY TARGET : 149rustup target add{{ TARGET }} 150RUSTFLAGS ='-C target-feature=+crt-static' cross build--release --target {{ TARGET }} 151just tar_static{{ BINARY }} {{ TARGET }} 152just zip_static{{ BINARY }} {{ TARGET }} 153 154checksum : 155@ echo "# Checksums" 156@ echo "## sha256sum" 157@ echo '```' 158@ sha256sum ./target/"bin- $( convco version) " /* 159@ echo '```' 160@ echo "## md5sum" 161@ echo '```' 162@ md5sum ./target/"bin- $( convco version) " /* 163@ echo '```' 164 165alias c := cross 166 167# Generate release binaries for EZA 168# 169# usage: cross 170@ cross : 171# Setup Output Directory 172mkdir -p ./target/"bin- $( convco version) " 173 174# Install Toolchains/Targets 175rustup toolchain install stable 176 177## Linux 178### x86 179just binary eza x86_64-unknown-linux-gnu 180# just binary_static eza x86_64-unknown-linux-gnu 181just binary eza x86_64-unknown-linux-musl 182# just binary_static eza x86_64-unknown-linux-musl 183 184### aarch 185just binary eza aarch64-unknown-linux-gnu 186# BUG: just binary_static eza aarch64-unknown-linux-gnu 187 188### arm 189just binary eza arm-unknown-linux-gnueabihf 190# just binary_static eza arm-unknown-linux-gnueabihf 191 192## MacOS 193# TODO: just binary eza x86_64-apple-darwin 194 195## Windows 196### x86 197just binary eza.exe x86_64-pc-windows-gnu 198# just binary_static eza.exe x86_64-pc-windows-gnu 199# TODO: just binary eza.exe x86_64-pc-windows-gnullvm 200# TODO: just binary eza.exe x86_64-pc-windows-msvc 201 202# Generate Checksums 203# TODO: moved to gh-release just checksum 204 205#---------------------# 206# Integration testing # 207#---------------------# 208 209alias gen := gen_test_dir 210 211test_dir := "tests/test_dir" 212 213gen_test_dir : 214#!/usr/bin/env bash 215rm {{ test_dir }} -r ; 216mkdir -p {{ test_dir }} 217cd {{ test_dir }} ; 218 219# BEGIN grid 220mkdir -p grid 221cd grid 222 223mkdir $( seq -w 001 1000) ; 224seq 0001 1000| split -l 1-a 3-d - file_ 225 226# Set time to unix epoch 227touch --date=@0 *; 228 229cd .. 230 231# END grid 232 233# BEGIN git 234 235mkdir -p git 236cd git 237 238mkdir $( seq -w 001 10) ; 239for f in ./* 240do 241cd $ f 242git init 243seq 01 10| split -l 1-a 3-d - file_ 244cd .. 245done 246 247cd .. 248 249# END git 250 251# BEGIN test_root 252 253sudo mkdir root 254sudo chmod 777 root 255sudo mkdir root/empty 256 257# END test_root 258 259# BEGIN mknod 260 261mkdir -p specials 262 263sudo mknod specials/block-device b 3 60 264sudo mknod specials/char-device c 14 40 265sudo mknod specials/named-pipe p 266 267# END test_root 268 269eza -l --grid ; 270 271# Runs integration tests in nix sandbox 272# 273# Required nix, likely won't work on windows. 274@ itest : 275nix build-L ./#trycmd-local 276 277# Runs integration tests in nix sandbox, and dumps outputs. 278# 279# WARNING: this can cause loss of work 280@ idump : 281rm ./tests/cmd/*nix.stderr-f ||echo 282rm ./tests/cmd/*nix.stdout-f ||echo 283nix build-L ./#trydump 284cp ./result/dump/*nix.* ./tests/cmd/