From 54691e8837366f302bb0e6c7a09adae059d19239 Mon Sep 17 00:00:00 2001 From: iGoX Date: Wed, 25 Mar 2026 12:53:07 +0100 Subject: [PATCH 01/11] [Android] Rework flutter build command --- android/flutter-build-apk.ps1 | 7 +++++-- android/flutter-build-apk.sh | 8 ++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/android/flutter-build-apk.ps1 b/android/flutter-build-apk.ps1 index db768ac..e1a26df 100644 --- a/android/flutter-build-apk.ps1 +++ b/android/flutter-build-apk.ps1 @@ -1,8 +1,11 @@ -$buildType = if ($args[0]) { $args[0] } else { "debug" } +$buildType = if ($args[0]) { $args[0] } else { "release" } +$buildName = if ($args[1]) { $args[1] } else { "0.0.0" } +$buildNumber = "$buildName-$(Get-Date -Format 'yyyyMMddHHmmss')" + $apkDir = "..\build\app\outputs\flutter-apk" $baseName = "org.igox.apps.android.busylight-buddy" -flutter build apk --$buildType +flutter build apk --$buildType --build-name=${buildName} --build-number ${buildNumber} --target-platform android-arm,android-arm64,android-x64 # Rename APK $oldApk = "$apkDir\app-$buildType.apk" diff --git a/android/flutter-build-apk.sh b/android/flutter-build-apk.sh index 4d6cbf9..de2aca8 100755 --- a/android/flutter-build-apk.sh +++ b/android/flutter-build-apk.sh @@ -1,9 +1,13 @@ #!/bin/bash -BUILD_TYPE=${1:-debug} +BUILD_TYPE=${1:-release} +BUILD_NAME=${2:-0.0.0} +BUILD_NUMBER="$BUILD_NAME-$(date +%Y%m%d%H%M%S)" + + APK_DIR="../build/app/outputs/flutter-apk" BASE_NAME="org.igox.apps.android.busylight-buddy" -flutter build apk --$BUILD_TYPE +flutter build apk --$BUILD_TYPE --build-name=$BUILD_NAME --build-number=$BUILD_NUMBER --target-platform android-arm,android-arm64,android-x64 # Rename APK OLD_APK="$APK_DIR/app-$BUILD_TYPE.apk" -- 2.52.0 From 804d949aac4ac18e6f813ec5daed315dbd88cc08 Mon Sep 17 00:00:00 2001 From: iGoX Date: Wed, 25 Mar 2026 12:59:00 +0100 Subject: [PATCH 02/11] [Windows] Rework flutter build command --- windows/build-installer.ps1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/windows/build-installer.ps1 b/windows/build-installer.ps1 index d3cf9f3..f0f2253 100644 --- a/windows/build-installer.ps1 +++ b/windows/build-installer.ps1 @@ -1,6 +1,9 @@ +$buildName = if ($args[1]) { $args[1] } else { "0.0.0" } +$buildNumber = "$buildName-$(Get-Date -Format 'yyyyMMddHHmmss')" + cd $PSScriptRoot # Build the Windows application using Flutter -flutter build windows --release +flutter build windows --build-name=$buildName --build-number=$buildNumber # Build the Windows installer using Inno Setup Compiler (ISCC.exe) ISCC.exe ./busylight-buddy-windows-installer-builder.iss \ No newline at end of file -- 2.52.0 From a32cfa328c47d2722b3d12e3399829d4799c4de7 Mon Sep 17 00:00:00 2001 From: iGoX Date: Wed, 25 Mar 2026 17:58:44 +0100 Subject: [PATCH 03/11] [Windows][Android] Rework flutter build helpers --- .gitignore | 3 +- android/flutter-build-apk.ps1 | 95 ++++++++++++++++++++++++++++----- android/flutter-build-apk.sh | 98 ++++++++++++++++++++++++++++------- windows/build-installer.ps1 | 2 +- 4 files changed, 166 insertions(+), 32 deletions(-) diff --git a/.gitignore b/.gitignore index ca2178b..56d161d 100644 --- a/.gitignore +++ b/.gitignore @@ -48,4 +48,5 @@ app.*.map.json android/key.properties windows/installer/* bugreport* -!downloads/* \ No newline at end of file +!downloads/* +androis/builds.json \ No newline at end of file diff --git a/android/flutter-build-apk.ps1 b/android/flutter-build-apk.ps1 index e1a26df..d9cc200 100644 --- a/android/flutter-build-apk.ps1 +++ b/android/flutter-build-apk.ps1 @@ -1,26 +1,97 @@ -$buildType = if ($args[0]) { $args[0] } else { "release" } -$buildName = if ($args[1]) { $args[1] } else { "0.0.0" } -$buildNumber = "$buildName-$(Get-Date -Format 'yyyyMMddHHmmss')" + +<# +.SYNOPSIS + Builds a Flutter APK with versioning support. + +.DESCRIPTION + This script builds a Flutter APK, manages build numbers, and renames output files. + +.PARAMETER buildType + The build type (release or debug). Default is "release". + +.PARAMETER buildName + The build name (version). Default is "0.0.0". + +.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()] +param ( + [string]$buildType = "release", # Default value is "release" + [string]$buildName = "0.0.0" # Default value is "0.0.0" +) + +$buildsRef = "builds.json" + +# Check if the file exists +if (-not (Test-Path -Path $buildsRef)) { + # Create the file if it doesn't exist + New-Item -Path $buildsRef -ItemType File + $buildsMap = @{ + $buildName = 0 + } + $buildsMap | ConvertTo-Json | Out-File $buildsRef + Write-Output "File created: $buildsRef" +} else { + Write-Output "File already exists: $buildsRef" +} + +# Read the JSON file and convert it to a hashtable +$jsonContent = Get-Content $buildsRef -Raw | ConvertFrom-Json +$buildsMap = @{} +$jsonContent.PSObject.Properties | ForEach-Object { + $buildsMap[$_.Name] = $_.Value +} + +if ($buildsMap.ContainsKey($buildName)) { + Write-Output "Build exists: $buildName" + $buildNumber = $buildsMap[$buildName] + $buildNumber++ + Write-Output "Next build number for ${buildName}: $buildNumber" + $buildsMap[$buildName] = $buildNumber +} +else { + $buildsMap[$buildName] = 1 +} + +$buildsMap | ConvertTo-Json | Out-File $buildsRef + $apkDir = "..\build\app\outputs\flutter-apk" $baseName = "org.igox.apps.android.busylight-buddy" -flutter build apk --$buildType --build-name=${buildName} --build-number ${buildNumber} --target-platform android-arm,android-arm64,android-x64 +# Build APK using an array for arguments +$flutterArgs = @( + "--$buildType", + "--build-name=$buildName", + "--build-number=$buildNumber", + "--target-platform=android-arm,android-arm64,android-x64" +) + +Write-Output "Building APK with arguments: $($flutterArgs -join ' ')" + +& flutter build apk @flutterArgs # Rename APK -$oldApk = "$apkDir\app-$buildType.apk" -$newApk = "$apkDir\$baseName-$buildType.apk" +$oldApk = "$apkDir\app-${buildType}.apk" +$newApk = "$apkDir\$baseName-${buildType}.apk" if (Test-Path $oldApk) { if (Test-Path $newApk) { Remove-Item $newApk -Force } - Rename-Item -Path $oldApk -NewName "$baseName-$buildType.apk" - Write-Host "APK renamed to: $baseName-$buildType.apk" + Rename-Item -Path $oldApk -NewName "$baseName-${buildType}.apk" + Write-Host "APK renamed to: $baseName-${buildType}.apk" } # Rename SHA1 (if exists) -$oldSha1 = "$apkDir\app-$buildType.apk.sha1" -$newSha1 = "$apkDir\$baseName-$buildType.apk.sha1" +$oldSha1 = "$apkDir\app-${buildType}.apk.sha1" +$newSha1 = "$apkDir\$baseName-${buildType}.apk.sha1" if (Test-Path $oldSha1) { if (Test-Path $newSha1) { Remove-Item $newSha1 -Force } - Rename-Item -Path $oldSha1 -NewName "$baseName-$buildType.apk.sha1" - Write-Host "SHA1 renamed to: $baseName-$buildType.apk.sha1" + Rename-Item -Path $oldSha1 -NewName "$baseName-${buildType}.apk.sha1" + Write-Host "SHA1 renamed to: $baseName-${buildType}.apk.sha1" } \ No newline at end of file diff --git a/android/flutter-build-apk.sh b/android/flutter-build-apk.sh index de2aca8..0bb9a1b 100755 --- a/android/flutter-build-apk.sh +++ b/android/flutter-build-apk.sh @@ -1,28 +1,90 @@ #!/bin/bash -BUILD_TYPE=${1:-release} -BUILD_NAME=${2:-0.0.0} -BUILD_NUMBER="$BUILD_NAME-$(date +%Y%m%d%H%M%S)" +# Default values +buildType="release" +buildName="0.0.0" +buildsRef="builds.json" -APK_DIR="../build/app/outputs/flutter-apk" -BASE_NAME="org.igox.apps.android.busylight-buddy" +# Help message +show_help() { + echo "Usage: $0 [-t buildType] [-n buildName]" + echo "Builds a Flutter APK with versioning support." + echo "" + echo "Options:" + echo " -t, --buildType Build type (release or debug). Default: release" + echo " -n, --buildName Build name (version). Default: 0.0.0" + echo " -h, --help Show this help message" + exit 0 +} -flutter build apk --$BUILD_TYPE --build-name=$BUILD_NAME --build-number=$BUILD_NUMBER --target-platform android-arm,android-arm64,android-x64 +# Parse command-line arguments +while [[ "$#" -gt 0 ]]; do + case $1 in + -t|--buildType) buildType="$2"; shift ;; + -n|--buildName) buildName="$2"; shift ;; + -h|--help) show_help ;; + *) echo "Unknown parameter: $1"; show_help; exit 1 ;; + esac + shift +done + +# Check if builds.json exists +if [ ! -f "$buildsRef" ]; then + echo "File created: $buildsRef" + echo "{\"$buildName\": 0}" > "$buildsRef" +else + echo "File already exists: $buildsRef" +fi + +# Read the JSON file +buildsMap=$(cat "$buildsRef") + +# Check if buildName exists in the JSON +if jq -e --arg key "$buildName" 'has($key)' <<< "$buildsMap" > /dev/null; then + echo "Build exists: $buildName" + buildNumber=$(jq --arg key "$buildName" '.[$key]' <<< "$buildsMap") + buildNumber=$((buildNumber + 1)) + echo "Next build number for $buildName: $buildNumber" + buildsMap=$(jq --arg key "$buildName" --argjson value "$buildNumber" '.[$key] = $value' <<< "$buildsMap") +else + echo "New build: $buildName, starting at build number: 1" + buildNumber=1 + buildsMap=$(jq --arg key "$buildName" --argjson value "$buildNumber" '.[$key] = $value' <<< "$buildsMap") +fi + +# Save the updated JSON back to the file +echo "$buildsMap" > "$buildsRef" + +# Define paths +apkDir="../build/app/outputs/flutter-apk" +baseName="org.igox.apps.android.busylight-buddy" + +# Build APK +echo "Building APK with arguments: --$buildType --build-name=$buildName --build-number=$buildNumber --target-platform=android-arm,android-arm64,android-x64" +flutter build apk --"$buildType" --build-name="$buildName" --build-number="$buildNumber" --target-platform=android-arm,android-arm64,android-x64 # Rename APK -OLD_APK="$APK_DIR/app-$BUILD_TYPE.apk" -NEW_APK="$APK_DIR/$BASE_NAME-$BUILD_TYPE.apk" -if [ -f "$OLD_APK" ]; then - [ -f "$NEW_APK" ] && rm -f "$NEW_APK" - mv "$OLD_APK" "$NEW_APK" - echo "APK renamed to: $BASE_NAME-$BUILD_TYPE.apk" +oldApk="$apkDir/app-$buildType.apk" +newApk="$apkDir/$baseName-$buildType.apk" +if [ -f "$oldApk" ]; then + if [ -f "$newApk" ]; then + rm -f "$newApk" + fi + mv "$oldApk" "$newApk" + echo "APK renamed to: $baseName-$buildType.apk" +else + echo "Warning: APK not found at $oldApk" fi # Rename SHA1 (if exists) -OLD_SHA1="$APK_DIR/app-$BUILD_TYPE.apk.sha1" -NEW_SHA1="$APK_DIR/$BASE_NAME-$BUILD_TYPE.apk.sha1" -if [ -f "$OLD_SHA1" ]; then - [ -f "$NEW_SHA1" ] && rm -f "$NEW_SHA1" - mv "$OLD_SHA1" "$NEW_SHA1" - echo "SHA1 renamed to: $BASE_NAME-$BUILD_TYPE.apk.sha1" +oldSha1="$apkDir/app-$buildType.apk.sha1" +newSha1="$apkDir/$baseName-$buildType.apk.sha1" +if [ -f "$oldSha1" ]; then + if [ -f "$newSha1" ]; then + rm -f "$newSha1" + fi + mv "$oldSha1" "$newSha1" + echo "SHA1 renamed to: $baseName-$buildType.apk.sha1" +else + echo "Warning: SHA1 not found at $oldSha1" fi \ No newline at end of file diff --git a/windows/build-installer.ps1 b/windows/build-installer.ps1 index f0f2253..097d019 100644 --- a/windows/build-installer.ps1 +++ b/windows/build-installer.ps1 @@ -1,5 +1,5 @@ $buildName = if ($args[1]) { $args[1] } else { "0.0.0" } -$buildNumber = "$buildName-$(Get-Date -Format 'yyyyMMddHHmmss')" +$buildNumber = "$(Get-Date -Format 'yyyyMMddHHmmss')" cd $PSScriptRoot -- 2.52.0 From ce44343b462da30ea8bd26356563588d64368544 Mon Sep 17 00:00:00 2001 From: iGoX Date: Wed, 25 Mar 2026 18:02:45 +0100 Subject: [PATCH 04/11] Fix typo in .gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 56d161d..73448e6 100644 --- a/.gitignore +++ b/.gitignore @@ -49,4 +49,4 @@ android/key.properties windows/installer/* bugreport* !downloads/* -androis/builds.json \ No newline at end of file +android/builds.json \ No newline at end of file -- 2.52.0 From 5311174a4e54c1259085d6c97c1f5e1148451413 Mon Sep 17 00:00:00 2001 From: iGoX Date: Wed, 25 Mar 2026 18:21:17 +0100 Subject: [PATCH 05/11] [Windows] Rework flutter build helper --- .gitignore | 3 +- windows/build-installer.ps1 | 15 ++++- ...ht-buddy-windows-installer-builder.iss.tpl | 62 +++++++++++++++++++ 3 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 windows/busylight-buddy-windows-installer-builder.iss.tpl diff --git a/.gitignore b/.gitignore index 73448e6..189846c 100644 --- a/.gitignore +++ b/.gitignore @@ -49,4 +49,5 @@ android/key.properties windows/installer/* bugreport* !downloads/* -android/builds.json \ No newline at end of file +android/builds.json +windows/busylight-buddy-windows-installer-builder.iss \ No newline at end of file diff --git a/windows/build-installer.ps1 b/windows/build-installer.ps1 index 097d019..fbd600b 100644 --- a/windows/build-installer.ps1 +++ b/windows/build-installer.ps1 @@ -3,7 +3,20 @@ $buildNumber = "$(Get-Date -Format 'yyyyMMddHHmmss')" cd $PSScriptRoot +# 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 +$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 +$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 ./busylight-buddy-windows-installer-builder.iss \ No newline at end of file +ISCC.exe $issFile \ No newline at end of file diff --git a/windows/busylight-buddy-windows-installer-builder.iss.tpl b/windows/busylight-buddy-windows-installer-builder.iss.tpl new file mode 100644 index 0000000..83373fa --- /dev/null +++ b/windows/busylight-buddy-windows-installer-builder.iss.tpl @@ -0,0 +1,62 @@ +; Script generated by the Inno Setup Script Wizard. +; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! +; Non-commercial use only + +#define MyAppName "BusyLight Buddy" +;#define MyAppVersion "0.0.1" +#define MyAppVersion "%%MyAppVersion%%" +#define MyAppPublisher "iGoX" +#define MyAppURL "https://github.com/igox/busylight-buddy" +#define MyAppExeName "busylight_buddy.exe" + +[Setup] +; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications. +; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) +AppId={{0E33DC67-F87E-4363-917F-B4FE941C7677} +AppName={#MyAppName} +AppVersion={#MyAppVersion} +;AppVerName={#MyAppName} {#MyAppVersion} +AppPublisher={#MyAppPublisher} +AppPublisherURL={#MyAppURL} +AppSupportURL={#MyAppURL} +AppUpdatesURL={#MyAppURL} +DefaultDirName={autopf}\{#MyAppName} +UninstallDisplayIcon={app}\{#MyAppExeName} +; "ArchitecturesAllowed=x64compatible" specifies that Setup cannot run +; on anything but x64 and Windows 11 on Arm. +ArchitecturesAllowed=x64compatible +; "ArchitecturesInstallIn64BitMode=x64compatible" requests that the +; install be done in "64-bit mode" on x64 or Windows 11 on Arm, +; meaning it should use the native 64-bit Program Files directory and +; the 64-bit view of the registry. +ArchitecturesInstallIn64BitMode=x64compatible +DisableProgramGroupPage=yes +LicenseFile="..\LICENSE" +; Uncomment the following line to run in non administrative install mode (install for current user only). +;PrivilegesRequired=lowest +PrivilegesRequiredOverridesAllowed=dialog +OutputDir="installer" +OutputBaseFilename=BusyLight-Buddy-Installer +SetupIconFile="runner\resources\app_icon.ico" +SolidCompression=yes +WizardStyle=modern dynamic + +[Languages] +Name: "english"; MessagesFile: "compiler:Default.isl" + +[Tasks] +Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked + +[Files] +Source: "..\build\windows\x64\runner\Release\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion +Source: "..\build\windows\x64\runner\Release\flutter_windows.dll"; DestDir: "{app}"; Flags: ignoreversion +Source: "..\build\windows\x64\runner\Release\data\*"; DestDir: "{app}\data"; Flags: ignoreversion recursesubdirs createallsubdirs +; NOTE: Don't use "Flags: ignoreversion" on any shared system files + +[Icons] +Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" +Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon + +[Run] +Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent + -- 2.52.0 From 2c7946e92cdf72eba6dea5aedb79f2aa8fa559ae Mon Sep 17 00:00:00 2001 From: iGoX Date: Wed, 25 Mar 2026 18:22:00 +0100 Subject: [PATCH 06/11] Remove tmp resource --- ...ylight-buddy-windows-installer-builder.iss | 61 ------------------- 1 file changed, 61 deletions(-) delete mode 100644 windows/busylight-buddy-windows-installer-builder.iss diff --git a/windows/busylight-buddy-windows-installer-builder.iss b/windows/busylight-buddy-windows-installer-builder.iss deleted file mode 100644 index 0075ade..0000000 --- a/windows/busylight-buddy-windows-installer-builder.iss +++ /dev/null @@ -1,61 +0,0 @@ -; Script generated by the Inno Setup Script Wizard. -; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! -; Non-commercial use only - -#define MyAppName "BusyLight Buddy" -#define MyAppVersion "0.0.1" -#define MyAppPublisher "iGoX" -#define MyAppURL "https://github.com/igox/busylight-buddy" -#define MyAppExeName "busylight_buddy.exe" - -[Setup] -; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications. -; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) -AppId={{0E33DC67-F87E-4363-917F-B4FE941C7677} -AppName={#MyAppName} -AppVersion={#MyAppVersion} -;AppVerName={#MyAppName} {#MyAppVersion} -AppPublisher={#MyAppPublisher} -AppPublisherURL={#MyAppURL} -AppSupportURL={#MyAppURL} -AppUpdatesURL={#MyAppURL} -DefaultDirName={autopf}\{#MyAppName} -UninstallDisplayIcon={app}\{#MyAppExeName} -; "ArchitecturesAllowed=x64compatible" specifies that Setup cannot run -; on anything but x64 and Windows 11 on Arm. -ArchitecturesAllowed=x64compatible -; "ArchitecturesInstallIn64BitMode=x64compatible" requests that the -; install be done in "64-bit mode" on x64 or Windows 11 on Arm, -; meaning it should use the native 64-bit Program Files directory and -; the 64-bit view of the registry. -ArchitecturesInstallIn64BitMode=x64compatible -DisableProgramGroupPage=yes -LicenseFile="..\LICENSE" -; Uncomment the following line to run in non administrative install mode (install for current user only). -;PrivilegesRequired=lowest -PrivilegesRequiredOverridesAllowed=dialog -OutputDir="installer" -OutputBaseFilename=BusyLight-Buddy-Installer -SetupIconFile="runner\resources\app_icon.ico" -SolidCompression=yes -WizardStyle=modern dynamic - -[Languages] -Name: "english"; MessagesFile: "compiler:Default.isl" - -[Tasks] -Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked - -[Files] -Source: "..\build\windows\x64\runner\Release\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion -Source: "..\build\windows\x64\runner\Release\flutter_windows.dll"; DestDir: "{app}"; Flags: ignoreversion -Source: "..\build\windows\x64\runner\Release\data\*"; DestDir: "{app}\data"; Flags: ignoreversion recursesubdirs createallsubdirs -; NOTE: Don't use "Flags: ignoreversion" on any shared system files - -[Icons] -Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" -Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon - -[Run] -Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent - -- 2.52.0 From 6d1a542a8857b3fc711b16f6e3c6a44a8531b7e9 Mon Sep 17 00:00:00 2001 From: iGoX Date: Wed, 25 Mar 2026 18:24:20 +0100 Subject: [PATCH 07/11] Clean up Inno template --- windows/busylight-buddy-windows-installer-builder.iss.tpl | 1 - 1 file changed, 1 deletion(-) diff --git a/windows/busylight-buddy-windows-installer-builder.iss.tpl b/windows/busylight-buddy-windows-installer-builder.iss.tpl index 83373fa..e04f5f4 100644 --- a/windows/busylight-buddy-windows-installer-builder.iss.tpl +++ b/windows/busylight-buddy-windows-installer-builder.iss.tpl @@ -3,7 +3,6 @@ ; Non-commercial use only #define MyAppName "BusyLight Buddy" -;#define MyAppVersion "0.0.1" #define MyAppVersion "%%MyAppVersion%%" #define MyAppPublisher "iGoX" #define MyAppURL "https://github.com/igox/busylight-buddy" -- 2.52.0 From 9b250b0d64825512d2875015a9364bd5a84ada8e Mon Sep 17 00:00:00 2001 From: iGoX Date: Wed, 25 Mar 2026 18:25:21 +0100 Subject: [PATCH 08/11] Rename Windows helper --- windows/{build-installer.ps1 => build-windows-installer.ps1} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename windows/{build-installer.ps1 => build-windows-installer.ps1} (100%) diff --git a/windows/build-installer.ps1 b/windows/build-windows-installer.ps1 similarity index 100% rename from windows/build-installer.ps1 rename to windows/build-windows-installer.ps1 -- 2.52.0 From cae99a898639bc5be1ca100a1a37f500ca67f7e0 Mon Sep 17 00:00:00 2001 From: iGoX Date: Wed, 25 Mar 2026 18:38:40 +0100 Subject: [PATCH 09/11] [Windows] Rework flutter build helper --- android/flutter-build-apk.ps1 | 6 +--- windows/build-windows-installer.ps1 | 49 ++++++++++++++++++++++++----- 2 files changed, 42 insertions(+), 13 deletions(-) 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 -- 2.52.0 From 251be0a75ec3ee327760906660ee3db22a8d3bff Mon Sep 17 00:00:00 2001 From: iGoX Date: Wed, 25 Mar 2026 18:48:39 +0100 Subject: [PATCH 10/11] [macOS] Create flutter build helper --- .gitignore | 1 + macos/flutter-build-macos.sh | 60 ++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100755 macos/flutter-build-macos.sh diff --git a/.gitignore b/.gitignore index 189846c..f8ddb9e 100644 --- a/.gitignore +++ b/.gitignore @@ -50,4 +50,5 @@ windows/installer/* bugreport* !downloads/* android/builds.json +macos/builds.json windows/busylight-buddy-windows-installer-builder.iss \ No newline at end of file diff --git a/macos/flutter-build-macos.sh b/macos/flutter-build-macos.sh new file mode 100755 index 0000000..fe90891 --- /dev/null +++ b/macos/flutter-build-macos.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +# Default values +buildType="release" +buildName="0.0.0" +buildsRef="builds.json" + +# Help message +show_help() { + echo "Usage: $0 [-t buildType] [-n buildName]" + echo "Builds a Flutter macOS application with versioning support." + echo "" + echo "Options:" + echo " -t, --buildType Build type (release or debug). Default: release" + echo " -n, --buildName Build name (version). Default: 0.0.0" + echo " -h, --help Show this help message" + exit 0 +} + +# Parse command-line arguments +while [[ "$#" -gt 0 ]]; do + case $1 in + -t|--buildType) buildType="$2"; shift ;; + -n|--buildName) buildName="$2"; shift ;; + -h|--help) show_help ;; + *) echo "Unknown parameter: $1"; show_help; exit 1 ;; + esac + shift +done + +# Check if builds.json exists +if [ ! -f "$buildsRef" ]; then + echo "File created: $buildsRef" + echo "{\"$buildName\": 0}" > "$buildsRef" +else + echo "File already exists: $buildsRef" +fi + +# Read the JSON file +buildsMap=$(cat "$buildsRef") + +# Check if buildName exists in the JSON +if jq -e --arg key "$buildName" 'has($key)' <<< "$buildsMap" > /dev/null; then + echo "Build exists: $buildName" + buildNumber=$(jq --arg key "$buildName" '.[$key]' <<< "$buildsMap") + buildNumber=$((buildNumber + 1)) + echo "Next build number for $buildName: $buildNumber" + buildsMap=$(jq --arg key "$buildName" --argjson value "$buildNumber" '.[$key] = $value' <<< "$buildsMap") +else + echo "New build: $buildName, starting at build number: 1" + buildNumber=1 + buildsMap=$(jq --arg key "$buildName" --argjson value "$buildNumber" '.[$key] = $value' <<< "$buildsMap") +fi + +# Save the updated JSON back to the file +echo "$buildsMap" > "$buildsRef" + +# Build macOS application +echo "Building macOS application with arguments: --$buildType --build-name=$buildName --build-number=$buildNumber" +flutter build macos --"$buildType" --build-name="$buildName" --build-number="$buildNumber" \ No newline at end of file -- 2.52.0 From 6b4f11272802caa5c880c475d3cd7af48c8e663f Mon Sep 17 00:00:00 2001 From: iGoX Date: Wed, 25 Mar 2026 18:54:08 +0100 Subject: [PATCH 11/11] [iOS] Create flutter build helper --- .gitignore | 1 + ios/flutter-build-ios.sh | 60 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100755 ios/flutter-build-ios.sh diff --git a/.gitignore b/.gitignore index f8ddb9e..755cd34 100644 --- a/.gitignore +++ b/.gitignore @@ -51,4 +51,5 @@ bugreport* !downloads/* android/builds.json macos/builds.json +ios/builds.json windows/busylight-buddy-windows-installer-builder.iss \ No newline at end of file diff --git a/ios/flutter-build-ios.sh b/ios/flutter-build-ios.sh new file mode 100755 index 0000000..e7a32f6 --- /dev/null +++ b/ios/flutter-build-ios.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +# Default values +buildType="release" +buildName="0.0.0" +buildsRef="builds.json" + +# Help message +show_help() { + echo "Usage: $0 [-t buildType] [-n buildName]" + echo "Builds a Flutter iOS application with versioning support." + echo "" + echo "Options:" + echo " -t, --buildType Build type (release or debug). Default: release" + echo " -n, --buildName Build name (version). Default: 0.0.0" + echo " -h, --help Show this help message" + exit 0 +} + +# Parse command-line arguments +while [[ "$#" -gt 0 ]]; do + case $1 in + -t|--buildType) buildType="$2"; shift ;; + -n|--buildName) buildName="$2"; shift ;; + -h|--help) show_help ;; + *) echo "Unknown parameter: $1"; show_help; exit 1 ;; + esac + shift +done + +# Check if builds.json exists +if [ ! -f "$buildsRef" ]; then + echo "File created: $buildsRef" + echo "{\"$buildName\": 0}" > "$buildsRef" +else + echo "File already exists: $buildsRef" +fi + +# Read the JSON file +buildsMap=$(cat "$buildsRef") + +# Check if buildName exists in the JSON +if jq -e --arg key "$buildName" 'has($key)' <<< "$buildsMap" > /dev/null; then + echo "Build exists: $buildName" + buildNumber=$(jq --arg key "$buildName" '.[$key]' <<< "$buildsMap") + buildNumber=$((buildNumber + 1)) + echo "Next build number for $buildName: $buildNumber" + buildsMap=$(jq --arg key "$buildName" --argjson value "$buildNumber" '.[$key] = $value' <<< "$buildsMap") +else + echo "New build: $buildName, starting at build number: 1" + buildNumber=1 + buildsMap=$(jq --arg key "$buildName" --argjson value "$buildNumber" '.[$key] = $value' <<< "$buildsMap") +fi + +# Save the updated JSON back to the file +echo "$buildsMap" > "$buildsRef" + +# Build iOS application +echo "Building iOS application with arguments: --$buildType --build-name=$buildName --build-number=$buildNumber" +flutter build ios --"$buildType" --build-name="$buildName" --build-number="$buildNumber" \ No newline at end of file -- 2.52.0