diff --git a/building/macos/build.sh b/building/macos/build.sh old mode 100644 new mode 100755 index 66579f022..941d851b3 --- a/building/macos/build.sh +++ b/building/macos/build.sh @@ -2,19 +2,44 @@ set -euo pipefail # Build FGCS for macOS (arm64 by default). Run from any directory. -# Usage: ./build.sh +# Usage: ./build.sh [version] +# If no version is provided, the script will show current version and prompt for new one -if [[ ${1:-} == "" ]]; then - echo "Usage: $0 " - echo "Example: $0 0.2.0-alpha" - exit 1 -fi - -VERSION="$1" +VERSION="${1:-}" echo "Assuming location is FGCS/building/macos" cd ../../ +# Read and display current version from package.json +echo "Reading current version from package.json..." +PACKAGE_JSON_PATH="./gcs/package.json" +if [[ -f "$PACKAGE_JSON_PATH" ]]; then + CURRENT_VERSION=$(grep '"version"' "$PACKAGE_JSON_PATH" | sed 's/.*"version": *"\([^"]*\)".*/\1/') + echo "Current version: $CURRENT_VERSION" + + # Prompt for version if not provided + if [[ -z "$VERSION" ]]; then + read -p "Enter new version number: " VERSION + if [[ -z "$VERSION" ]]; then + echo "Error: Version is required to continue" + exit 1 + fi + fi + + echo "New version will be: $VERSION" +else + echo "Warning: Could not find package.json at $PACKAGE_JSON_PATH" + + # Still prompt for version if package.json not found + if [[ -z "$VERSION" ]]; then + read -p "Enter version number: " VERSION + if [[ -z "$VERSION" ]]; then + echo "Error: Version is required to continue" + exit 1 + fi + fi +fi + echo "Building backend" cd radio source ./venv/bin/activate diff --git a/building/windows/build.ps1 b/building/windows/build.ps1 index 77314af67..74c678915 100644 --- a/building/windows/build.ps1 +++ b/building/windows/build.ps1 @@ -4,17 +4,48 @@ .EXAMPLE .\build.ps1 -Version "0.1.8-alpha" + .\build.ps1 #> Param ( - [Parameter(Mandatory = $true)] + [Parameter(Mandatory = $false)] [string]$Version ) -Write-Output "Building backend" Write-Output "Assuming location is FGCS\building\windows" Set-Location ../../ +# Read and display current version from package.json +Write-Output "Reading current version from package.json..." +$packageJsonPath = ".\gcs\package.json" +if (Test-Path $packageJsonPath) { + $packageJson = Get-Content $packageJsonPath | ConvertFrom-Json + $currentVersion = $packageJson.version + Write-Output "Current version: $currentVersion" + + # Prompt for version if not provided + if (-not $Version) { + $Version = Read-Host "Enter new version number" + if (-not $Version) { + Write-Error "Version is required to continue" + exit 1 + } + } + + Write-Output "New version will be: $Version" +} else { + Write-Warning "Could not find package.json at $packageJsonPath" + + # Still prompt for version if package.json not found + if (-not $Version) { + $Version = Read-Host "Enter version number" + if (-not $Version) { + Write-Error "Version is required to continue" + exit 1 + } + } +} + Write-Output "Building backend" Set-Location radio pip install pyinstaller