[Windows] Rework flutter build helper

This commit is contained in:
2026-03-25 18:38:40 +01:00
parent 9b250b0d64
commit cae99a8986
2 changed files with 42 additions and 13 deletions
+41 -8
View File
@@ -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