1 Commits

Author SHA1 Message Date
Eric Ratliff
90ed42b3c5 fix: Remove unused variable warning and add release build script
- Fix unused `project_path` parameter warning in make_executable()
- Add build-release.sh for automated binary packaging
- Update .gitignore to exclude release artifacts
- Support cross-compilation for Linux and Windows binaries

Release artifacts are now built with ./build-release.sh and uploaded
to Gitea releases separately, keeping the git repo clean.
2026-01-25 01:17:47 -06:00
4 changed files with 93 additions and 8 deletions

5
.gitignore vendored
View File

@@ -22,6 +22,11 @@ Cargo.lock
*.so *.so
*.exe *.exe
# Release packaging (uploaded to releases, not checked in)
/release-artifacts/
*.tar.gz
*.zip
# OS # OS
Thumbs.db Thumbs.db
.AppleDouble .AppleDouble

View File

@@ -86,7 +86,7 @@ weevil sdk status
### From Source ### From Source
```bash ```bash
git clone https://github.com/yourusername/weevil.git git clone https://www.nxgit.dev/nexus-workshops/weevil.git
cd weevil cd weevil
cargo build --release cargo build --release
sudo cp target/release/weevil /usr/local/bin/ sudo cp target/release/weevil /usr/local/bin/
@@ -255,7 +255,7 @@ weevil new competition-bot
cd competition-bot cd competition-bot
# Project is already a git repo! # Project is already a git repo!
git remote add origin https://github.com/team/robot.git git remote add origin https://nxgit.dev/team/robot.git
git push -u origin main git push -u origin main
# Make changes # Make changes
@@ -287,7 +287,7 @@ git push
**Project Structure is Portable:** **Project Structure is Portable:**
```bash ```bash
# Team member clones repo # Team member clones repo
git clone https://github.com/team/robot.git git clone https://nxgit.dev/team/robot.git
cd robot cd robot
# Check SDK location # Check SDK location
@@ -466,7 +466,7 @@ Contributions welcome! Please:
### Development Setup ### Development Setup
```bash ```bash
git clone https://github.com/yourusername/weevil.git git clone https://www.nxgit.dev/nexus-workshops/weevil.git
cd weevil cd weevil
cargo build cargo build
cargo test cargo test
@@ -511,7 +511,7 @@ Built with frustration at unnecessarily complex robotics frameworks, and hope th
## Project Status ## Project Status
**Current Version:** 1.0.0-beta1 **Current Version:** 1.0.0-beta2
**What Works:** **What Works:**
- ✅ Project generation - ✅ Project generation
@@ -532,4 +532,4 @@ Built with frustration at unnecessarily complex robotics frameworks, and hope th
**Questions? Issues? Suggestions?** **Questions? Issues? Suggestions?**
Open an issue on GitHub or reach out to the FTC community. Let's make robot programming accessible for everyone! 🚀 Open an issue on NXGit or reach out to the FTC community. Let's make robot programming accessible for everyone! 🚀

80
build-release.sh Executable file
View File

@@ -0,0 +1,80 @@
#!/bin/bash
# Build release binaries for distribution
# This script builds both Linux and Windows binaries (cross-compile)
#
# For Windows-only builds, use build-release.ps1 on Windows
# For Linux-only builds, comment out the Windows section below
set -e
VERSION=${1:-$(git describe --tags --always)}
RELEASE_DIR="release-artifacts"
echo "Building Weevil $VERSION release binaries..."
echo ""
# Clean previous artifacts
rm -rf "$RELEASE_DIR"
mkdir -p "$RELEASE_DIR"
# Build Linux binary (optimized)
echo "Building Linux x86_64 binary..."
cargo build --release
strip target/release/weevil
# Package Linux binary
echo "Packaging Linux binaries..."
cd target/release
tar -czf "../../$RELEASE_DIR/weevil-${VERSION}-linux-x86_64.tar.gz" weevil
zip -q "../../$RELEASE_DIR/weevil-${VERSION}-linux-x86_64.zip" weevil
cd ../..
# Build Windows binary (cross-compile)
echo ""
echo "Building Windows x86_64 binary..."
# Check if Windows target is installed
if ! rustup target list | grep -q "x86_64-pc-windows-gnu (installed)"; then
echo "Installing Windows target..."
rustup target add x86_64-pc-windows-gnu
fi
# Check if MinGW is installed
if ! command -v x86_64-w64-mingw32-gcc &> /dev/null; then
echo "Warning: MinGW not found. Install with: sudo apt install mingw-w64"
echo "Skipping Windows build."
else
cargo build --release --target x86_64-pc-windows-gnu
x86_64-w64-mingw32-strip target/x86_64-pc-windows-gnu/release/weevil.exe
# Package Windows binary
echo "Packaging Windows binary..."
cd target/x86_64-pc-windows-gnu/release
zip -q "../../../$RELEASE_DIR/weevil-${VERSION}-windows-x86_64.zip" weevil.exe
cd ../../..
fi
# Generate checksums
echo ""
echo "Generating checksums..."
cd "$RELEASE_DIR"
sha256sum * > SHA256SUMS
cd ..
# Display results
echo ""
echo "═══════════════════════════════════════════════════════════"
echo " ✓ Release artifacts built successfully!"
echo "═══════════════════════════════════════════════════════════"
echo ""
echo "Artifacts in $RELEASE_DIR/:"
ls -lh "$RELEASE_DIR"
echo ""
echo "Checksums:"
cat "$RELEASE_DIR/SHA256SUMS"
echo ""
echo "Upload these files to your Gitea release:"
echo " 1. Go to: Releases → $VERSION → Edit Release"
echo " 2. Drag and drop files from $RELEASE_DIR/"
echo " 3. Save"
echo ""

View File

@@ -434,14 +434,14 @@ class BasicTest {
Ok(()) Ok(())
} }
fn make_executable(&self, project_path: &Path) -> Result<()> { fn make_executable(&self, _project_path: &Path) -> Result<()> {
#[cfg(unix)] #[cfg(unix)]
{ {
use std::os::unix::fs::PermissionsExt; use std::os::unix::fs::PermissionsExt;
let scripts = vec!["gradlew", "build.sh", "deploy.sh"]; let scripts = vec!["gradlew", "build.sh", "deploy.sh"];
for script in scripts { for script in scripts {
let path = project_path.join(script); let path = _project_path.join(script);
if path.exists() { if path.exists() {
let mut perms = fs::metadata(&path)?.permissions(); let mut perms = fs::metadata(&path)?.permissions();
perms.set_mode(0o755); perms.set_mode(0o755);