From 68f0a34ebeaa464b76942428cea1f20053ff6918 Mon Sep 17 00:00:00 2001 From: Alexander Kopachov Date: Thu, 17 Nov 2022 13:45:21 +0100 Subject: [PATCH] Implemented #28 (#29) --- .gitmodules | 15 ++++-- build.ps1 | 48 ++++++++++++++----- fbt.ps1 | 10 ++-- ...icial => flipperzero-firmware_official_dev | 0 flipperzero-firmware_official_stable | 1 + 5 files changed, 53 insertions(+), 21 deletions(-) rename flipperzero-firmware_official => flipperzero-firmware_official_dev (100%) create mode 160000 flipperzero-firmware_official_stable diff --git a/.gitmodules b/.gitmodules index 758805be040..8a0ccf56a6a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,10 +1,15 @@ -[submodule "flipperzero-firmware_official"] - path = flipperzero-firmware_official - url = https://github.com/flipperdevices/flipperzero-firmware.git - branch = dev - ignore = dirty [submodule "flipperzero-firmware_unleashed"] path = flipperzero-firmware_unleashed url = https://github.com/Eng1n33r/flipperzero-firmware.git branch = dev ignore = dirty +[submodule "flipperzero-firmware_official_dev"] + path = flipperzero-firmware_official_dev + url = https://github.com/flipperdevices/flipperzero-firmware.git + branch = dev + ignore = dirty +[submodule "flipperzero-firmware_official_stable"] + path = flipperzero-firmware_official_stable + url = https://github.com/flipperdevices/flipperzero-firmware.git + branch = release + ignore = dirty diff --git a/build.ps1 b/build.ps1 index afe589b3b81..a7dc42470f6 100644 --- a/build.ps1 +++ b/build.ps1 @@ -6,16 +6,28 @@ function Get-LatestDirectory { Get-ChildItem -Path $Path | Where-Object {$_.PSIsContainer} | Sort-Object LastWriteTime -Descending | Select-Object -First 1 } -Push-Location $PSScriptRoot - -$official_build_path = "flipperzero-firmware_official\build" -$unleashed_build_path = "flipperzero-firmware_unleashed\build" +$build_commands = @( + [PSCustomObject]@{ + Name = "Official Dev"; + FbtSwitch = "od"; + FirmwarePath = "flipperzero-firmware_official_dev"; + ArtifactName = "totp_official-dev-fw.fap" + } + [PSCustomObject]@{ + Name = "Official Stable"; + FbtSwitch = "os"; + FirmwarePath = "flipperzero-firmware_official_stable"; + ArtifactName = "totp_official-stable-fw.fap" + } + [PSCustomObject]@{ + Name = "Unleashed"; + FbtSwitch = "u"; + FirmwarePath = "flipperzero-firmware_unleashed"; + ArtifactName = "totp_unleashed-fw.fap" + } +) -Remove-Item "$official_build_path\*" -Recurse -Force -Remove-Item "$unleashed_build_path\*" -Recurse -Force - -./fbt u COMPACT=1 DEBUG=0 VERBOSE=0 fap_totp -./fbt o COMPACT=1 DEBUG=0 VERBOSE=0 fap_totp +Push-Location $PSScriptRoot if (!(Test-Path -PathType Container "build")) { New-Item -ItemType Directory -Path "build" @@ -23,10 +35,20 @@ if (!(Test-Path -PathType Container "build")) { Remove-Item "build\*" -Recurse -Force } -$official_latest_dir = Get-LatestDirectory -Path $official_build_path -Copy-Item "$official_build_path\$official_latest_dir\.extapps\totp.fap" -Destination "build\totp_official-fw.fap" +foreach ($build_command in $build_commands) { + Write-Host "Building $($build_command.Name)" + $build_path = Join-Path -Path $build_command.FirmwarePath -ChildPath "build" + if (Test-Path -PathType Container $build_path) { + Remove-Item "$build_path\*" -Recurse -Force + } -$unleashed_latest_dir = Get-LatestDirectory -Path $unleashed_build_path -Copy-Item "$unleashed_build_path\$unleashed_latest_dir\.extapps\totp.fap" -Destination "build\totp_unleashed-fw.fap" + ./fbt $build_command.FbtSwitch COMPACT=1 DEBUG=0 VERBOSE=0 fap_totp + + $latest_dir = Get-LatestDirectory -Path $build_path + $build_output_artifact = "build\$($build_command.ArtifactName)" + Copy-Item "$build_path\$latest_dir\.extapps\totp.fap" -Destination $build_output_artifact + + Write-Host "Artifacts for $($build_command.Name) stored at $build_output_artifact" +} Pop-Location \ No newline at end of file diff --git a/fbt.ps1 b/fbt.ps1 index b13a4c8f49e..a6747ad146e 100644 --- a/fbt.ps1 +++ b/fbt.ps1 @@ -2,9 +2,13 @@ Push-Location $PSScriptRoot $firmware_path = "" $firmware_name = "" -if (('official', 'off', 'o').Contains($args[0])) { - $firmware_path = "flipperzero-firmware_official" - $firmware_name = "Official" +if (('official-dev', 'off-dev', 'od').Contains($args[0])) { + $firmware_path = "flipperzero-firmware_official_dev" + $firmware_name = "Official Dev" +} +elseif (('official-stable', 'off-stbl', 'os').Contains($args[0])) { + $firmware_path = "flipperzero-firmware_official_stable" + $firmware_name = "Official Stable" } elseif (('unleashed', 'un', 'u').Contains($args[0])) { $firmware_path = "flipperzero-firmware_unleashed" diff --git a/flipperzero-firmware_official b/flipperzero-firmware_official_dev similarity index 100% rename from flipperzero-firmware_official rename to flipperzero-firmware_official_dev diff --git a/flipperzero-firmware_official_stable b/flipperzero-firmware_official_stable new file mode 160000 index 00000000000..303c266eba3 --- /dev/null +++ b/flipperzero-firmware_official_stable @@ -0,0 +1 @@ +Subproject commit 303c266eba3a60e7cd77bba40b3098cefb156c56