diff --git a/android/flutter-build-apk.ps1 b/android/flutter-build-apk.ps1 index d9cc200..f523b09 100644 --- a/android/flutter-build-apk.ps1 +++ b/android/flutter-build-apk.ps1 @@ -15,10 +15,6 @@ .EXAMPLE .\flutter-build-apk.ps1 -buildType debug -buildName 1.0.0 Builds a debug APK with version 1.0.0. - -.EXAMPLE - .\flutter-build-apk.ps1 -Help - Displays this help message. #> [CmdletBinding()] @@ -66,7 +62,7 @@ $buildsMap | ConvertTo-Json | Out-File $buildsRef $apkDir = "..\build\app\outputs\flutter-apk" $baseName = "org.igox.apps.android.busylight-buddy" -# Build APK using an array for arguments +# Build an array for arguments $flutterArgs = @( "--$buildType", "--build-name=$buildName", diff --git a/windows/build-windows-installer.ps1 b/windows/build-windows-installer.ps1 index fbd600b..3f87de3 100644 --- a/windows/build-windows-installer.ps1 +++ b/windows/build-windows-installer.ps1 @@ -1,22 +1,55 @@ -$buildName = if ($args[1]) { $args[1] } else { "0.0.0" } -$buildNumber = "$(Get-Date -Format 'yyyyMMddHHmmss')" +<# +.SYNOPSIS + Builds a Flutter Windows installer with versioning support. -cd $PSScriptRoot +.DESCRIPTION + This script builds a Flutter Windows application and creates an installer using Inno Setup. + +.PARAMETER buildType + The build type (release or debug). Default is "release". + +.PARAMETER buildName + The build name (version). Default is "0.0.0". + +.EXAMPLE + .\build-windows-installer.ps1 -buildType debug -buildName 1.0.0 + Builds a debug Windows application with version 1.0.0. +#> + +[CmdletBinding()] +param ( + [string]$buildType = "release", # Default value is "release" + [string]$buildName = "0.0.0" # Default value is "0.0.0" +) + +$buildNumber = "$(Get-Date -Format 'yyyyMMddHHmmss')" # Define the file path and the new version value $issTplFile = "./busylight-buddy-windows-installer-builder.iss.tpl" $issFile = "./busylight-buddy-windows-installer-builder.iss" -# Read the content of the file +cd $PSScriptRoot + +# Build an array for arguments +$flutterArgs = @( + "--$buildType", + "--build-name=$buildName", + "--build-number=$buildNumber" +) + +Write-Output "Building Windows application with arguments: $($flutterArgs -join ' ')" + +# Build the Windows application using Flutter +flutter build windows @flutterArgs + +# Build the Windows installer using Inno Setup Compiler (ISCC.exe) +# Read the content of Inno Setup template file $content = Get-Content -Path $issTplFile -Raw # Replace the placeholder with the new version value $updatedContent = $content -replace '%%MyAppVersion%%', $buildName -# Write the updated content back to the file +# Write the updated content back to Inno Setup file $updatedContent | Set-Content -Path $issFile -# Build the Windows application using Flutter -flutter build windows --build-name=$buildName --build-number=$buildNumber -# Build the Windows installer using Inno Setup Compiler (ISCC.exe) ISCC.exe $issFile \ No newline at end of file