tari-rust/build.sh

58 lines
1.1 KiB
Bash
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.

#!/bin/bash
# GBT项目构建脚本
# 支持Linux和macOS
set -e
echo "🚀 开始构建GBT项目..."
# 检查Rust环境
if ! command -v cargo &> /dev/null; then
echo "❌ 错误: 未找到cargo请先安装Rust"
exit 1
fi
# 检查Rust版本
RUST_VERSION=$(rustc --version | cut -d' ' -f2)
echo "📦 Rust版本: $RUST_VERSION"
# 清理之前的构建
echo "🧹 清理之前的构建..."
cargo clean
# 更新依赖
echo "📥 更新依赖..."
cargo update
# 检查代码
echo "🔍 检查代码..."
cargo check
# 运行测试
echo "🧪 运行测试..."
cargo test
# 构建发布版本
echo "🔨 构建发布版本..."
cargo build --release
# 检查构建结果
if [ -f "target/release/gbt" ]; then
echo "✅ 构建成功!"
echo "📁 可执行文件位置: target/release/gbt"
# 显示文件信息
echo "📊 文件信息:"
ls -lh target/release/gbt
# 显示版本信息
echo " 版本信息:"
./target/release/gbt --version 2>/dev/null || echo "无法获取版本信息"
else
echo "❌ 构建失败!"
exit 1
fi
echo "🎉 GBT项目构建完成!"