tari-rust/build.bat

100 lines
1.9 KiB
Batchfile
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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.

@echo off
setlocal enabledelayedexpansion
REM GBT项目构建脚本 (Windows版本)
echo 🚀 开始构建GBT项目...
REM 检查Rust环境
where cargo >nul 2>&1
if %errorlevel% neq 0 (
echo ❌ 错误: 未找到cargo请先安装Rust
echo 访问: https://rustup.rs/
pause
exit /b 1
)
REM 检查Rust版本
for /f "tokens=2" %%i in ('rustc --version') do set RUST_VERSION=%%i
echo 📦 Rust版本: %RUST_VERSION%
REM 检查是否在正确的目录
if not exist "Cargo.toml" (
echo ❌ 错误: 未找到Cargo.toml请在gbt目录下运行此脚本
pause
exit /b 1
)
REM 清理之前的构建
echo 🧹 清理之前的构建...
cargo clean
if %errorlevel% neq 0 (
echo ❌ 清理失败
pause
exit /b 1
)
REM 更新依赖
echo 📥 更新依赖...
cargo update
if %errorlevel% neq 0 (
echo ❌ 更新依赖失败
pause
exit /b 1
)
REM 检查代码
echo 🔍 检查代码...
cargo check
if %errorlevel% neq 0 (
echo ❌ 代码检查失败
pause
exit /b 1
)
REM 运行测试
echo 🧪 运行测试...
cargo test
if %errorlevel% neq 0 (
echo ❌ 测试失败
pause
exit /b 1
)
REM 构建发布版本
echo 🔨 构建发布版本...
cargo build --release
if %errorlevel% neq 0 (
echo ❌ 构建失败
pause
exit /b 1
)
REM 检查构建结果
if exist "target\release\gbt.exe" (
echo ✅ 构建成功!
echo 📁 可执行文件位置: target\release\gbt.exe
REM 显示文件信息
echo 📊 文件信息:
dir target\release\gbt.exe
REM 显示版本信息
echo 版本信息:
target\release\gbt.exe --version 2>nul || echo 无法获取版本信息
) else (
echo ❌ 构建失败!
pause
exit /b 1
)
echo 🎉 GBT项目构建完成!
echo.
echo 📖 使用方法:
echo target\release\gbt.exe --wallet-address ^<YOUR_WALLET_ADDRESS^>
echo.
echo 📖 更多选项:
echo target\release\gbt.exe --help
echo.
pause