build.ps1 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. function Get-LatestDirectory {
  2. param (
  3. $Path
  4. )
  5. Get-ChildItem -Path $Path | Where-Object {$_.PSIsContainer} | Sort-Object LastWriteTime -Descending | Select-Object -First 1
  6. }
  7. Push-Location $PSScriptRoot
  8. $official_build_path = "flipperzero-firmware_official\build"
  9. $unleashed_build_path = "flipperzero-firmware_unleashed\build"
  10. Remove-Item "$official_build_path\*" -Recurse -Force
  11. Remove-Item "$unleashed_build_path\*" -Recurse -Force
  12. ./fbt u COMPACT=1 DEBUG=0 VERBOSE=0 fap_totp
  13. ./fbt o COMPACT=1 DEBUG=0 VERBOSE=0 fap_totp
  14. if (!(Test-Path -PathType Container "build")) {
  15. New-Item -ItemType Directory -Path "build"
  16. } else {
  17. Remove-Item "build\*" -Recurse -Force
  18. }
  19. $official_latest_dir = Get-LatestDirectory -Path $official_build_path
  20. Copy-Item "$official_build_path\$official_latest_dir\.extapps\totp.fap" -Destination "build\totp_official-fw.fap"
  21. $unleashed_latest_dir = Get-LatestDirectory -Path $unleashed_build_path
  22. Copy-Item "$unleashed_build_path\$unleashed_latest_dir\.extapps\totp.fap" -Destination "build\totp_unleashed-fw.fap"
  23. Pop-Location