Alexander Kopachov 3 лет назад
Родитель
Сommit
68f0a34ebe
5 измененных файлов с 53 добавлено и 21 удалено
  1. 10 5
      .gitmodules
  2. 35 13
      build.ps1
  3. 7 3
      fbt.ps1
  4. 0 0
      flipperzero-firmware_official_dev
  5. 1 0
      flipperzero-firmware_official_stable

+ 10 - 5
.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"]
 [submodule "flipperzero-firmware_unleashed"]
 	path = flipperzero-firmware_unleashed
 	path = flipperzero-firmware_unleashed
 	url = https://github.com/Eng1n33r/flipperzero-firmware.git
 	url = https://github.com/Eng1n33r/flipperzero-firmware.git
 	branch = dev
 	branch = dev
 	ignore = dirty
 	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

+ 35 - 13
build.ps1

@@ -6,16 +6,28 @@ function Get-LatestDirectory {
     Get-ChildItem -Path $Path | Where-Object {$_.PSIsContainer} | Sort-Object LastWriteTime -Descending | Select-Object -First 1
     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")) {
 if (!(Test-Path -PathType Container "build")) {
     New-Item -ItemType Directory -Path "build"
     New-Item -ItemType Directory -Path "build"
@@ -23,10 +35,20 @@ if (!(Test-Path -PathType Container "build")) {
     Remove-Item "build\*" -Recurse -Force
     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
 Pop-Location

+ 7 - 3
fbt.ps1

@@ -2,9 +2,13 @@ Push-Location $PSScriptRoot
 
 
 $firmware_path = ""
 $firmware_path = ""
 $firmware_name = ""
 $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])) {
 elseif (('unleashed', 'un', 'u').Contains($args[0])) {
     $firmware_path = "flipperzero-firmware_unleashed"
     $firmware_path = "flipperzero-firmware_unleashed"

+ 0 - 0
flipperzero-firmware_official → flipperzero-firmware_official_dev


+ 1 - 0
flipperzero-firmware_official_stable

@@ -0,0 +1 @@
+Subproject commit 303c266eba3a60e7cd77bba40b3098cefb156c56