1
0
Эх сурвалжийг харах

refactor(just): DRY up justfile

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
Christina Sørensen 2 жил өмнө
parent
commit
be91b68b5a
1 өөрчлөгдсөн 23 нэмэгдсэн , 30 устгасан
  1. 23 30
      Justfile

+ 23 - 30
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"