| 1 | @echo off |
| 2 | set cw_win_app_config=--monero --bitcoin --ethereum --polygon --nano --bitcoinCash --solana --tron --dogecoin --base --arbitrum --bsc |
| 3 | set cw_root=%cd% |
| 4 | set cw_archive_name=Cake Wallet.zip |
| 5 | set cw_archive_path=%cw_root%\%cw_archive_name% |
| 6 | set secrets_file_path=lib\.secrets.g.dart |
| 7 | set release_dir=build\windows\x64\runner\Release |
| 8 | @REM Path could be different |
| 9 | if [%~1]==[] (set tools_root=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Redist\MSVC\14.38.33135\x64\Microsoft.VC143.CRT) else (set tools_root=%1) |
| 10 | @REM Generate android manifest file |
| 11 | cd scripts |
| 12 | bash.exe gen_android_manifest.sh |
| 13 | cd /d %cw_root% |
| 14 | echo === Generating pubspec.yaml === |
| 15 | copy /Y pubspec_description.yaml pubspec.yaml > nul |
| 16 | call flutter pub get > nul |
| 17 | call dart run tool\generate_pubspec.dart |
| 18 | call flutter pub get > nul |
| 19 | call dart run tool\configure.dart %cw_win_app_config% |
| 20 | |
| 21 | IF NOT EXIST "%secrets_file_path%" ( |
| 22 | echo === Generating new secrets file === |
| 23 | call dart run tool\generate_new_secrets.dart |
| 24 | ) ELSE (echo === Using previously/already generated secrets file: %secrets_file_path% ===) |
| 25 | |
| 26 | echo === Generating mobx models === |
| 27 | for /d %%i in (cw_core cw_monero cw_bitcoin cw_evm cw_nano cw_bitcoin_cash cw_solana cw_tron cw_zcash.) do ( |
| 28 | cd %%i |
| 29 | call flutter pub get > nul |
| 30 | call dart run build_runner build --delete-conflicting-outputs > nul |
| 31 | cd /d %cw_root% |
| 32 | ) |
| 33 | |
| 34 | echo === Generating localization files === |
| 35 | call dart run tool\generate_localization.dart |
| 36 | |
| 37 | echo === Building the application executable file === |
| 38 | call flutter build windows --dart-define-from-file=env.json --release |
| 39 | |
| 40 | echo === Prepare distribution actions. Copy needed files to the application bundle === |
| 41 | copy /Y "%tools_root%\msvcp140.dll" "%release_dir%\" > nul |
| 42 | copy /Y "%tools_root%\vcruntime140.dll" "%release_dir%\" > nul |
| 43 | copy /Y "%tools_root%\vcruntime140_1.dll" "%release_dir%\" > nul |
| 44 | |
| 45 | echo === Generate the application archive === |
| 46 | xcopy /s /e /v /Y "%release_dir%\*.*" "build\Cake Wallet\" > nul |
| 47 | tar acf "%cw_archive_name%" -C build\ "Cake Wallet" |
| 48 | |
| 49 | echo === Open Explorer with the application archive === |
| 50 | echo Cake Wallet created archive at: %cw_archive_path% |
| 51 | %SystemRoot%\explorer.exe /select, %cw_archive_path% |