Cross-platform tool for generating clean, testable FTC robot projects without editing the SDK installation. Features: - Standalone project generation with proper separation from SDK - Per-project SDK configuration via .weevil.toml - Local unit testing support (no robot required) - Cross-platform build/deploy scripts (Linux/macOS/Windows) - Project upgrade system preserving user code - Configuration management commands - Comprehensive test suite (11 passing tests) - Zero-warning builds Architecture: - Pure Rust implementation with embedded Gradle wrapper - Projects use deployToSDK task to copy code to FTC SDK TeamCode - Git-ready projects with automatic initialization - USB and WiFi deployment with auto-detection Commands: - weevil new <name> - Create new project - weevil upgrade <path> - Update project infrastructure - weevil config <path> - View/modify project configuration - weevil sdk status/install/update - Manage SDKs Addresses the core problem: FTC's SDK structure forces students to edit framework internals instead of separating concerns like industry standard practices. Weevil enables proper software engineering workflows for robotics education.
4.0 KiB
4.0 KiB
Getting Started with Weevil Development
Prerequisites
- Rust (if not installed):
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
-
Git (should already have this)
-
Gradle (for now - will be embedded later):
# Ubuntu/Debian
sudo apt install gradle
# Or use sdkman
curl -s "https://get.sdkman.io" | bash
sdk install gradle 8.9
Initial Setup
# Navigate to the weevil directory
cd ~/Desktop/FTC_Decode/weevil
# Build the project (this will download all dependencies)
cargo build
# Run tests to verify everything works
cargo test
Usage Examples
1. Check if it compiles
cargo check
2. Run with arguments (dev mode)
# Show help
cargo run -- --help
# Show version
cargo run -- --version
# Check SDK status
cargo run -- sdk status
# Create a new project (will try to download SDKs)
cargo run -- new test-robot
3. Build release binary
cargo build --release
# The binary will be at: target/release/weevil
# You can copy it to your PATH:
sudo cp target/release/weevil /usr/local/bin/
# Then use it directly:
weevil --help
weevil new my-robot
4. Run tests
# Run all tests
cargo test
# Run specific test
cargo test test_help_command
# Run tests with output
cargo test -- --nocapture
# Run ignored tests (like project creation)
cargo test -- --ignored
Development Workflow
Quick Iteration
# 1. Make changes to src/*.rs files
# 2. Check if it compiles
cargo check
# 3. Run relevant tests
cargo test
# 4. Try it out
cargo run -- sdk status
Adding New Features
-
Add a new command:
- Add to
Commandsenum insrc/main.rs - Create handler in
src/commands/ - Add to match statement in
main()
- Add to
-
Add a new template:
- Create file in
templates/directory - Access via
TEMPLATES_DIRinsrc/templates/mod.rs - Files are automatically embedded at compile time!
- Create file in
-
Add tests:
- Unit tests: Add
#[cfg(test)]module in same file - Integration tests: Add to
tests/directory
- Unit tests: Add
Common Issues
"error: could not find Cargo.toml"
You're not in the weevil directory. Run: cd ~/Desktop/FTC_Decode/weevil
"gradle: command not found"
Install gradle (see prerequisites). We'll embed gradle-wrapper.jar later to avoid this.
Compilation errors with include_dir
The templates directory must exist: mkdir -p templates
Tests failing
Some tests are marked #[ignore] until we build mock SDKs. That's expected.
Next Steps
Phase 1: Get Basic Functionality Working
- ✅ Project compiles
- ✅ CLI works with --help, --version
- ✅ SDK status command works
- ⏳ Project creation creates basic structure
- ⏳ Generated projects can build with gradle
Phase 2: Complete Templates
- Copy template files from ftc-project-gen
- Convert to Tera template syntax ({{variable}})
- Test template rendering
Phase 3: Full SDK Management
- Complete FTC SDK download/update
- Complete Android SDK download/update
- Embed gradle-wrapper.jar in binary
Phase 4: Deploy Functionality
- ADB detection and communication
- APK building
- Installation to Control Hub
Phase 5: Polish
- Progress bars for downloads
- Better error messages
- Windows testing
- Create releases
Debugging Tips
See what's being compiled
cargo build -vv
Check dependencies
cargo tree
Format code
cargo fmt
Lint code
cargo clippy
Generate documentation
cargo doc --open
Performance
Check binary size
cargo build --release
ls -lh target/release/weevil
Profile build
cargo build --release --timings
Questions?
The code is well-commented. Start reading from:
src/main.rs- Entry point and CLI definitionsrc/commands/new.rs- Project creation logicsrc/project/mod.rs- Project buildersrc/templates/mod.rs- Template engine
Each module has its own documentation. Rust's type system will guide you!