This directory contains scripts for setting up and building the REChain Flutter application in CI/CD environments.
The REChain application uses the vodozemac cryptographic library, which requires Rust compilation. These scripts handle the complex setup process and address common build issues.
Complete Windows build script that handles:
- Rust installation and configuration
- Chocolatey package management
- Visual Studio Build Tools setup
- Flutter installation and configuration
- vodozemac compilation and binding generation
- Windows application build
Usage:
.\scripts\build_windows_ci.ps1 -BuildType "Release" -FlutterVersion "3.32.8"Simplified setup script for Windows CI environments:
- Basic environment setup
- Dependency installation
- Flutter configuration
Usage:
.\scripts\setup_windows_ci.ps1 -BuildType "Release"Complete Linux build script that handles:
- Rust installation and configuration
- System dependency installation
- Flutter installation
- vodozemac compilation and binding generation
- Linux application build
Usage:
chmod +x scripts/build_linux_ci.sh
./scripts/build_linux_ci.sh release "3.32.8"The .github/workflows/build.yml file provides a complete CI/CD pipeline that:
- Builds for Windows, Linux, macOS, Android, and Web
- Runs tests and linting
- Uploads artifacts for each platform
- Handles vodozemac compilation automatically
Problem: Rust fails to start due to environment variable issues Solution: The scripts handle environment setup automatically, but if issues persist:
# Clear problematic environment variables
unset OWD APPIMAGE LD_LIBRARY_PATH APPDIR PERLLIB
source "$HOME/.cargo/env"Problem: vodozemac_bindings_dart.dll compilation fails
Solution: The scripts automatically:
- Clone the correct vodozemac repository
- Install required Rust components
- Generate proper bindings
- Copy files to the correct location
Problem: CMake deprecation warnings Solution: The scripts install the latest CMake version and configure it properly.
Problem: flutter_vodozemac plugin compilation fails
Solution: The scripts ensure:
- Proper Rust toolchain installation
- Correct target architecture setup
- Required dependencies are installed
If you need to build manually, follow these steps:
-
Install Rust:
Invoke-WebRequest -Uri "https://win.rustup.rs/x86_64" -OutFile "rustup-init.exe" Start-Process -FilePath "rustup-init.exe" -ArgumentList "-y" -Wait
-
Install Chocolatey and dependencies:
Set-ExecutionPolicy Bypass -Scope Process -Force iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) choco install visualstudio2019buildtools flutter cmake -y
-
Setup vodozemac:
git clone https://github.com/matrix-org/vodozemac.git cd vodozemac cargo install wasm-pack wasm-pack build --target web cd .. git clone https://github.com/famedly/dart-vodozemac.git .vodozemac cd .vodozemac cargo install flutter_rust_bridge_codegen flutter_rust_bridge_codegen build-web --dart-root dart --rust-root (Resolve-Path rust) --release cd .. Copy-Item ".vodozemac/dart/web/pkg/vodozemac_bindings_dart*" "assets/vodozemac/" -Force Remove-Item -Recurse -Force ".vodozemac"
-
Build Flutter application:
flutter pub get flutter build windows --release
-
Install Rust:
curl https://sh.rustup.rs -sSf | sh -s -- -y source "$HOME/.cargo/env"
-
Install system dependencies:
sudo apt-get update sudo apt-get install -y git curl wget build-essential cmake pkg-config libssl-dev
-
Setup vodozemac:
git clone https://github.com/matrix-org/vodozemac.git cd vodozemac cargo install wasm-pack wasm-pack build --target web cd .. git clone https://github.com/famedly/dart-vodozemac.git .vodozemac cd .vodozemac cargo install flutter_rust_bridge_codegen flutter_rust_bridge_codegen build-web --dart-root dart --rust-root $(readlink -f rust) --release cd .. cp .vodozemac/dart/web/pkg/vodozemac_bindings_dart* assets/vodozemac/ rm -rf .vodozemac
-
Build Flutter application:
flutter pub get flutter build linux --release
If you encounter environment-related issues:
-
Clear environment variables:
unset OWD APPIMAGE LD_LIBRARY_PATH APPDIR PERLLIB -
Reinstall Rust:
rustup self uninstall -y curl https://sh.rustup.rs -sSf | sh -s -- -y source "$HOME/.cargo/env"
-
Clean Flutter cache:
flutter clean flutter pub get
If builds fail:
-
Check Flutter doctor:
flutter doctor -v
-
Verify Rust installation:
rustc --version cargo --version
-
Check vodozemac bindings:
ls -la assets/vodozemac/
-
Clean and rebuild:
flutter clean flutter pub get flutter build windows --debug # Try debug build first
The scripts handle installation of:
- Rust (latest stable)
- Flutter (configurable version)
- CMake (latest)
- Visual Studio Build Tools (Windows)
- System development tools (Linux)
- Chocolatey (Windows package manager)
For issues with these scripts:
- Check the troubleshooting section above
- Review the GitHub Actions logs for specific error messages
- Ensure all prerequisites are met
- Try the manual build process to isolate issues