paw-gui/justfile
2025-04-14 19:17:53 +08:00

59 lines
2.8 KiB
Makefile
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

set dotenv-required
set dotenv-path := ".env"
# 显示所有指令
default:
@just --list
# 构建系统服务、系统服务安装器、系统服务卸载器,存放到 src-tauri/sidecar 目录下
build-system-service:
for name in paw-system-service paw-install-service paw-uninstall-service; do \
echo "Building $name with manifest {{system_service_manifest}}" \
&& cargo build --release --bin $name --manifest-path "{{system_service_manifest}}" \
&& cp "{{cargo_target_path}}/$name" "src-tauri/sidecar/${name}-{{target_triple}}{{bin_ext}}"; \
done
# 构建 proxy-cli存放到 src-tauri/sidecar 目录下
build-proxy-cli:
echo "Building proxy-cli with version {{proxy_version}}" \
&& cd "{{proxy_path}}" \
&& go build -trimpath -ldflags "-extldflags -s -w -X proxy-service/internal/services.Version={{proxy_version}}" -o "{{rust_path}}/sidecar/paw-core-{{target_triple}}{{bin_ext}}" cmd/client/main.go \
&& echo "Finished building proxy-cli, output to {{rust_path}}/sidecar/paw-core-{{target_triple}}{{bin_ext}}"
# 格式化代码并且使用clippy检查代码错误
lint:
cargo fmt --manifest-path "{{system_service_manifest}}" --all
cargo clippy --manifest-path "{{system_service_manifest}}" --all-targets --all-features -- -D warnings
cargo fmt --manifest-path "{{tauri_manifest}}" --all
cargo clippy --manifest-path "{{tauri_manifest}}" --all-targets --all-features -- -D warnings
# 安装前端依赖
install-frontend-dep:
pnpm i
# 构建Paw-GUI输出到 src-tauri/target/release/bundle 目录下
build: build-proxy-cli build-system-service install-frontend-dep
pnpm tauri build
# 启动Paw-GUI开发模式
dev: build-system-service install-frontend-dep
pnpm tauri dev
# 清理所有生成的文件
clean:
cargo clean --manifest-path "{{tauri_manifest}}" # 由于使用了workspace所以直接清理根项目即可
-rm -r "{{rust_path}}/sidecar"
# 运行所有测试
test: build-proxy-cli build-system-service
cargo test --manifest-path "{{tauri_manifest}}" --workspace
proxy_path := justfile_directory() / "../proxy"
proxy_version := `if v="$(git tag --list '*paw' | sort -V | tail -n 1)" && [ -n "$v" ]; then echo "$v"; else echo "v0.0.1-$(git rev-parse --short HEAD)"; fi`
rust_path := justfile_directory() / "src-tauri"
tauri_manifest := rust_path / "Cargo.toml"
system_service_manifest := rust_path / "system-service/Cargo.toml"
cargo_target_path := rust_path / "target/release"
bin_ext := if os() == "windows" { ".exe" } else { "" }
target_triple := ```case "$(uname)-$(uname -m)" in "Darwin-x86_64") echo "x86_64-apple-darwin" ;; "Darwin-arm64") echo "aarch64-apple-darwin" ;; "Linux-x86_64") echo "x86_64-unknown-linux-gnu" ;; "MINGW"*"-x86_64") echo "x86_64-pc-windows-msvc" ;; *) echo "Unsupported platform" && exit 1 ;; esac```