From 90ed42b3c5f9ba6f116d96616ef96667d406df0a Mon Sep 17 00:00:00 2001 From: Eric Ratliff Date: Sun, 25 Jan 2026 00:26:58 -0600 Subject: [PATCH] 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. --- .gitignore | 5 +++ README.md | 12 +++---- build-release.sh | 80 ++++++++++++++++++++++++++++++++++++++++++++++ src/project/mod.rs | 4 +-- 4 files changed, 93 insertions(+), 8 deletions(-) create mode 100755 build-release.sh diff --git a/.gitignore b/.gitignore index 381057c..3a50c11 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,11 @@ Cargo.lock *.so *.exe +# Release packaging (uploaded to releases, not checked in) +/release-artifacts/ +*.tar.gz +*.zip + # OS Thumbs.db .AppleDouble diff --git a/README.md b/README.md index a3a9377..ea3ba19 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ weevil sdk status ### From Source ```bash -git clone https://github.com/yourusername/weevil.git +git clone https://www.nxgit.dev/nexus-workshops/weevil.git cd weevil cargo build --release sudo cp target/release/weevil /usr/local/bin/ @@ -255,7 +255,7 @@ weevil new competition-bot cd competition-bot # 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 # Make changes @@ -287,7 +287,7 @@ git push **Project Structure is Portable:** ```bash # Team member clones repo -git clone https://github.com/team/robot.git +git clone https://nxgit.dev/team/robot.git cd robot # Check SDK location @@ -466,7 +466,7 @@ Contributions welcome! Please: ### Development Setup ```bash -git clone https://github.com/yourusername/weevil.git +git clone https://www.nxgit.dev/nexus-workshops/weevil.git cd weevil cargo build cargo test @@ -511,7 +511,7 @@ Built with frustration at unnecessarily complex robotics frameworks, and hope th ## Project Status -**Current Version:** 1.0.0-beta1 +**Current Version:** 1.0.0-beta2 **What Works:** - ✅ Project generation @@ -532,4 +532,4 @@ Built with frustration at unnecessarily complex robotics frameworks, and hope th **Questions? Issues? Suggestions?** -Open an issue on GitHub or reach out to the FTC community. Let's make robot programming accessible for everyone! 🚀 \ No newline at end of file +Open an issue on NXGit or reach out to the FTC community. Let's make robot programming accessible for everyone! 🚀 \ No newline at end of file diff --git a/build-release.sh b/build-release.sh new file mode 100755 index 0000000..58a2337 --- /dev/null +++ b/build-release.sh @@ -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 "" \ No newline at end of file diff --git a/src/project/mod.rs b/src/project/mod.rs index fcb455b..561e6ab 100644 --- a/src/project/mod.rs +++ b/src/project/mod.rs @@ -434,14 +434,14 @@ class BasicTest { Ok(()) } - fn make_executable(&self, project_path: &Path) -> Result<()> { + fn make_executable(&self, _project_path: &Path) -> Result<()> { #[cfg(unix)] { use std::os::unix::fs::PermissionsExt; let scripts = vec!["gradlew", "build.sh", "deploy.sh"]; for script in scripts { - let path = project_path.join(script); + let path = _project_path.join(script); if path.exists() { let mut perms = fs::metadata(&path)?.permissions(); perms.set_mode(0o755);