From be91b68b5a545dab641e248d307c65e6248573b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christina=20S=C3=B8rensen?= Date: Fri, 15 Sep 2023 09:42:13 +0200 Subject: [PATCH] refactor(just): DRY up justfile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christina Sørensen --- Justfile | 53 +++++++++++++++++++++++------------------------------ 1 file changed, 23 insertions(+), 30 deletions(-) diff --git a/Justfile b/Justfile index 877aa186..b9ba0c0b 100644 --- a/Justfile +++ b/Justfile @@ -109,53 +109,46 @@ all-release: build-release test-release sleep 10 gh pr create --draft --title "chore: release $(grep '^version' Cargo.toml | head -n 1 | grep -E '([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?' -o)" --body "This PR was auto-generated by our lovely just file" --reviewer cafkafk +tar BINARY TARGET: + tar czvf ./target/"bin-$(convco version)"/{{BINARY}}_{{TARGET}}.tar.gz -C ./target/{{TARGET}}/release/ ./{{BINARY}} + +zip BINARY TARGET: + zip -j ./target/"bin-$(convco version)"/{{BINARY}}_{{TARGET}}.zip ./target/{{TARGET}}/release/{{BINARY}} + +binary BINARY TARGET: + rustup target add {{TARGET}} + cross build --release --target {{TARGET}} + just tar {{BINARY}} {{TARGET}} + just zip {{BINARY}} {{TARGET}} + +alias c := cross + # If you're not cafkafk and she isn't dead, you probably don't need to run # this! # # usage: cross @cross: + # Setup Output Directory + mkdir -p ./target/"bin-$(convco version)" + # Install Toolchains/Targets rustup toolchain install stable ## Linux ### x86 - rustup target add x86_64-unknown-linux-gnu - rustup target add x86_64-unknown-linux-musl + just binary eza x86_64-unknown-linux-gnu + just binary eza x86_64-unknown-linux-musl ### aarch - rustup target add aarch64-unknown-linux-gnu + just binary eza aarch64-unknown-linux-gnu ### arm - rustup target add arm-unknown-linux-gnueabihf + just binary eza arm-unknown-linux-gnueabihf ## Windows ### x86 - rustup target add x86_64-pc-windows-gnu - rustup target add x86_64-pc-windows-msvc - - # Setup Output Directory - mkdir -p ./target/"bin-$(convco version)" - - # Build - ## Linux - ### x86 - cross build --target x86_64-unknown-linux-gnu --release - tar czvf ./target/"bin-$(convco version)"/eza_x86_64-unknown-linux-gnu.tar.gz -C ./target/x86_64-unknown-linux-gnu/release/ ./eza - - cross build --release --target=x86_64-unknown-linux-musl - tar czvf ./target/"bin-$(convco version)"/eza_x86_64-unknown-linux-musl.tar.gz -C ./target/x86_64-unknown-linux-musl/release/ ./eza - - cross build --target aarch64-unknown-linux-gnu --release - tar czvf ./target/"bin-$(convco version)"/eza_aarch64-unknown-linux-gnu.tar.gz -C ./target/aarch64-unknown-linux-gnu/release/ ./eza - - cross build --target arm-unknown-linux-gnueabihf --release - tar czvf ./target/"bin-$(convco version)"/arm-unknown-linux-gnueabihf.tar.gz -C ./target/arm-unknown-linux-gnueabihf/release/ ./eza - - ## Windows - cross build --target x86_64-pc-windows-gnu --release - zip -j ./target/"bin-$(convco version)"/x86_64-pc-windows-gnu.zip ./target/x86_64-pc-windows-gnu/release/eza.exe - cross build --target x86_64-pc-windows-msvc --release - zip -j ./target/"bin-$(convco version)"/x86_64-pc-windows-msvc.zip ./target/x86_64-pc-windows-gnu/release/eza.exe + just binary eza.exe x86_64-pc-windows-gnu + just binary eza.exe x86_64-pc-windows-msvc # Generate Checksums echo "# Checksums"