From cdc08b4d43266ba53e2a23549586e668bf66765f Mon Sep 17 00:00:00 2001 From: sneurlax Date: Mon, 5 Jun 2023 16:05:14 -0500 Subject: [PATCH 01/10] upgrade powershell script TODO enable overwriting files when extracting archive ... or delete folder prior to extraction? --- scripts/windows/deps.ps1 | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/scripts/windows/deps.ps1 b/scripts/windows/deps.ps1 index db00e4fb2..2d90ed7fe 100644 --- a/scripts/windows/deps.ps1 +++ b/scripts/windows/deps.ps1 @@ -1,9 +1,25 @@ # Create C:\development -New-Item -Path 'C:\development' -ItemType Directory +New-Item -Path 'C:\development' -ItemType Directory -ErrorAction Ignore + +# $wc = [System.Net.WebClient]::new() +# $publishedHash = '8E28E54D601F0751922DE24632C1E716B4684876255CF82304A9B19E89A9CCAC' +# $FileHash = Get-FileHash -InputStream ($wc.OpenRead("C:\development\flutter_windows_3.7.12-stable.zip")) + +# if (-Not [System.IO.File]::Exists("C:\development\flutter_windows_3.7.12-stable.zip") or -Not ($FileHash.Hash -eq $publishedHash)) { +# } else { # Download flutter_windows_3.7.12-stable.zip -Invoke-WebRequest "https://storage.googleapis.com/flutter_infra_release/releases/stable/windows/flutter_windows_3.7.12-stable.zip" -OutFile "C:\development\flutter_windows_3.7.12-stable.zip" +# Write-Output "Downloading flutter_windows_3.7.12-stable.zip" +# $ProgressPreference = 'SilentlyContinue' # Speed up download process, see https://stackoverflow.com/questions/28682642/powershell-why-is-using-invoke-webrequest-much-slower-than-a-browser-download +# Invoke-WebRequest "https://storage.googleapis.com/flutter_infra_release/releases/stable/windows/flutter_windows_3.7.12-stable.zip" -OutFile "C:\development\flutter_windows_3.7.12-stable.zip" +# } + # Extract Flutter SDK -Expand-Archive "C:\development\flutter_windows_3.7.12-stable.zip" -DestinationPath "C:\development" +Write-Output "Extracting flutter_windows_3.7.12-stable.zip" +$progressPreference = 'SilentlyContinue' # Speed up extraction process, see https://github.com/PowerShell/Microsoft.PowerShell.Archive/issues/32#issuecomment-642582179 +# Add-MpPreference -ExclusionPath C:\development +# Expand-Archive "C:\development\flutter_windows_3.7.12-stable.zip" -DestinationPath "C:\development" +Add-Type -Assembly "System.IO.Compression.Filesystem" +[System.IO.Compression.ZipFile]::ExtractToDirectory("C:\development\flutter_windows_3.7.12-stable.zip", "C:\development") # See https://stackoverflow.com/a/69239861 function Add-Path { @@ -52,6 +68,8 @@ function Add-Path { # Add Flutter SDK to PATH if it's not there already if ($Env:Path -split ";" -contains 'C:\development\flutter\bin') { + Write-Output "Flutter SDK in PATH, done" } else { + Write-Output "Attempting to add Flutter SDK to PATH" Add-Path("C:\development\flutter\bin") } From 133d5d9001d636c9985a1e3670fe9b23031df85d Mon Sep 17 00:00:00 2001 From: sneurlax Date: Mon, 5 Jun 2023 16:09:10 -0500 Subject: [PATCH 02/10] flutter_libmonero: merge update_gradle into windows --- crypto_plugins/flutter_libmonero | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto_plugins/flutter_libmonero b/crypto_plugins/flutter_libmonero index 73d257ed2..017ef8759 160000 --- a/crypto_plugins/flutter_libmonero +++ b/crypto_plugins/flutter_libmonero @@ -1 +1 @@ -Subproject commit 73d257ed2fe5b204cf3589822e226301b187b86d +Subproject commit 017ef87592f7af7b7155e09c97da09aa5d01a211 From 95656ff7aa072fa240eac93165956805b0938c0f Mon Sep 17 00:00:00 2001 From: Josh Babb Date: Mon, 5 Jun 2023 14:36:55 -0700 Subject: [PATCH 03/10] update docs wrt CppWinRT --- docs/building.md | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/docs/building.md b/docs/building.md index 7fbbf3cac..de8b57143 100644 --- a/docs/building.md +++ b/docs/building.md @@ -147,22 +147,19 @@ Set up Ubuntu 20.04 in WSL2. Follow the entire Linux host section to get set up Install Flutter 3.7.12 on your Windows host (not in WSL2) by following these instructions: https://docs.flutter.dev/get-started/install/windows or by running `scripts/windows/deps.ps1`. You may still have to add `C:\development\flutter\bin` to PATH before proceeding, even if you ran `deps.ps1`. Run `flutter doctor` in PowerShell to confirm its installation. ### Dependencies -You may need to enable Developer Mode for symlink support, +Install the Windows SDK: https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/ + +Enable Developer Mode for symlink support, ``` start ms-settings:developers ``` -Install NuGet: +You may need to install NuGet and CppWinRT / C++/WinRT SDKs version `2.0.210806.1`: ``` winget install 9WZDNCRDMDM3 # NuGet, can also use Microsoft.NuGet +winget install Microsoft.Windows.CppWinRT -Version 2.0.210806.1 ``` - -You may need to install CppWinRT / C++/WinRT SDKs: -``` -winget install Microsoft.Windows.CppWinRT -``` - -Install the Windows SDK: https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/ +or [download the package](https://www.nuget.org/packages/Microsoft.Windows.CppWinRT/2.0.210806.1) and [manually install it](https://github.com/Baseflow/flutter-permission-handler/issues/1025#issuecomment-1518576722). ### Running From 1b26d7fc9cc3b582a6612e78a2dbcc45d3e0b71c Mon Sep 17 00:00:00 2001 From: Josh Babb Date: Mon, 5 Jun 2023 14:50:59 -0700 Subject: [PATCH 04/10] add windows prebuild script and update docs iaw --- docs/building.md | 30 ++++++++++++++++++++++-------- scripts/prebuild.ps1 | 17 +++++++++++++++++ 2 files changed, 39 insertions(+), 8 deletions(-) create mode 100644 scripts/prebuild.ps1 diff --git a/docs/building.md b/docs/building.md index de8b57143..9f081da2e 100644 --- a/docs/building.md +++ b/docs/building.md @@ -77,14 +77,6 @@ git submodule update --init --recursive ``` -Run prebuild script -``` -cd scripts -./prebuild.sh -// when finished go back to the root directory -cd .. -``` - Remove pre-installed system libraries for the following packages built by cryptography plugins in the crypto_plugins folder: `boost iconv libjson-dev libsecret openssl sodium unbound zmq`. You can use ``` sudo apt list --installed | grep boost @@ -95,6 +87,17 @@ sudo apt-get remove '^libboost.*-dev.*' ``` +### Run prebuild script + +Certain test wallet parameter and API key template files must be created in order to run Stack Wallet. These can be created by script as in +``` +cd scripts +./prebuild.sh +// when finished go back to the root directory +cd .. +``` +or manually by creating the files referenced in that script with the specified content. + ### Building plugins for Android > Warning: This will take a long time, please be patient ``` @@ -161,6 +164,17 @@ winget install Microsoft.Windows.CppWinRT -Version 2.0.210806.1 ``` or [download the package](https://www.nuget.org/packages/Microsoft.Windows.CppWinRT/2.0.210806.1) and [manually install it](https://github.com/Baseflow/flutter-permission-handler/issues/1025#issuecomment-1518576722). +### Run prebuild script + +Certain test wallet parameter and API key template files must be created in order to run Stack Wallet. These can be created by script as in +``` +cd scripts +./prebuild.ps1 +// when finished go back to the root directory +cd .. +``` +or manually by creating the files referenced in that script with the specified content. + ### Running Run the following commands: diff --git a/scripts/prebuild.ps1 b/scripts/prebuild.ps1 new file mode 100644 index 000000000..6618378ee --- /dev/null +++ b/scripts/prebuild.ps1 @@ -0,0 +1,17 @@ +# Create template lib/external_api_keys.dart file if it doesn't already exist +$KEYS = "..\lib\external_api_keys.dart" +if (-not (Test-Path $KEYS)) { + Write-Host "prebuild.ps1: creating template lib/external_api_keys.dart file" + "const kChangeNowApiKey = "";" + "`nconst kSimpleSwapApiKey = "";" | Out-File $KEYS +} + +# Create template wallet test parameter files if they don't already exist +$coins = @("bitcoin", "bitcoincash", "dogecoin", "namecoin", "firo", "particl") # TODO add monero and wownero when those tests are updated to use the .gitignored test wallet setup: when doing that, make sure to update the test vectors for a new, private development seed + +foreach ($coin in $coins) { + $WALLETTESTPARAMFILE = "..\test\services\coins\$coin\${coin}_wallet_test_parameters.dart" + if (-not (Test-Path $WALLETTESTPARAMFILE)) { + Write-Host "prebuild.ps1: creating template test/services/coins/$coin/${coin}_wallet_test_parameters.dart file" + "const TEST_MNEMONIC = "";" + "`nconst ROOT_WIF = "";" + "`nconst NODE_WIF_84 = "";" | Out-File -FilePath $WALLETTESTPARAMFILE + } +} From 2e93bb656b11b1fd3eae8fa0cf44b0017c0191cd Mon Sep 17 00:00:00 2001 From: Josh Babb Date: Mon, 5 Jun 2023 14:51:38 -0700 Subject: [PATCH 05/10] update flutter_libmonero to main --- crypto_plugins/flutter_libmonero | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto_plugins/flutter_libmonero b/crypto_plugins/flutter_libmonero index 017ef8759..db8783133 160000 --- a/crypto_plugins/flutter_libmonero +++ b/crypto_plugins/flutter_libmonero @@ -1 +1 @@ -Subproject commit 017ef87592f7af7b7155e09c97da09aa5d01a211 +Subproject commit db87831332ae2ead75aee4e55ea4434c229d9d5f From 9ecb87206b6dd74a2ef264edd9bb7becbf8e4637 Mon Sep 17 00:00:00 2001 From: Josh Babb Date: Mon, 5 Jun 2023 14:55:42 -0700 Subject: [PATCH 06/10] encode external_api_keys.dart file as utf-8 --- scripts/prebuild.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/prebuild.ps1 b/scripts/prebuild.ps1 index 6618378ee..34b9b8771 100644 --- a/scripts/prebuild.ps1 +++ b/scripts/prebuild.ps1 @@ -2,7 +2,7 @@ $KEYS = "..\lib\external_api_keys.dart" if (-not (Test-Path $KEYS)) { Write-Host "prebuild.ps1: creating template lib/external_api_keys.dart file" - "const kChangeNowApiKey = "";" + "`nconst kSimpleSwapApiKey = "";" | Out-File $KEYS + "const kChangeNowApiKey = '';" + "`nconst kSimpleSwapApiKey = '';" | Out-File $KEYS -Encoding UTF8 } # Create template wallet test parameter files if they don't already exist From d78972307c2fbb3c11e0e2b0c95260063218c3bd Mon Sep 17 00:00:00 2001 From: Josh Babb Date: Mon, 5 Jun 2023 14:56:53 -0700 Subject: [PATCH 07/10] encode wallet test parameters files as utf-8 --- scripts/prebuild.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/prebuild.ps1 b/scripts/prebuild.ps1 index 34b9b8771..80a6991b7 100644 --- a/scripts/prebuild.ps1 +++ b/scripts/prebuild.ps1 @@ -12,6 +12,6 @@ foreach ($coin in $coins) { $WALLETTESTPARAMFILE = "..\test\services\coins\$coin\${coin}_wallet_test_parameters.dart" if (-not (Test-Path $WALLETTESTPARAMFILE)) { Write-Host "prebuild.ps1: creating template test/services/coins/$coin/${coin}_wallet_test_parameters.dart file" - "const TEST_MNEMONIC = "";" + "`nconst ROOT_WIF = "";" + "`nconst NODE_WIF_84 = "";" | Out-File -FilePath $WALLETTESTPARAMFILE + "const TEST_MNEMONIC = "";" + "`nconst ROOT_WIF = "";" + "`nconst NODE_WIF_84 = "";" | Out-File -FilePath $WALLETTESTPARAMFILE -Encoding UTF8 } } From 8740f97ca06910dc692f3e6898e49074d616e277 Mon Sep 17 00:00:00 2001 From: Josh Babb Date: Mon, 5 Jun 2023 15:03:42 -0700 Subject: [PATCH 08/10] update docs wrt windows 10 sdk --- docs/building.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/building.md b/docs/building.md index 9f081da2e..ec85cfad4 100644 --- a/docs/building.md +++ b/docs/building.md @@ -150,7 +150,7 @@ Set up Ubuntu 20.04 in WSL2. Follow the entire Linux host section to get set up Install Flutter 3.7.12 on your Windows host (not in WSL2) by following these instructions: https://docs.flutter.dev/get-started/install/windows or by running `scripts/windows/deps.ps1`. You may still have to add `C:\development\flutter\bin` to PATH before proceeding, even if you ran `deps.ps1`. Run `flutter doctor` in PowerShell to confirm its installation. ### Dependencies -Install the Windows SDK: https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/ +Install the Windows SDK: https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/ You may need to install the [Windows 10 SDK](https://developer.microsoft.com/en-us/windows/downloads/sdk-archive/), which can be installed [by Visual Studio](https://stackoverflow.com/a/73923899) (`Tools > Get Tools and Features... > Individual Components > Windows 10 SDK`) Enable Developer Mode for symlink support, ``` From bb13c7e90a529c9c365509e067749fd800e1c7cf Mon Sep 17 00:00:00 2001 From: Josh Babb Date: Mon, 5 Jun 2023 15:17:34 -0700 Subject: [PATCH 09/10] update docs wrt Visual Studio --- docs/building.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/building.md b/docs/building.md index ec85cfad4..df4374797 100644 --- a/docs/building.md +++ b/docs/building.md @@ -150,7 +150,7 @@ Set up Ubuntu 20.04 in WSL2. Follow the entire Linux host section to get set up Install Flutter 3.7.12 on your Windows host (not in WSL2) by following these instructions: https://docs.flutter.dev/get-started/install/windows or by running `scripts/windows/deps.ps1`. You may still have to add `C:\development\flutter\bin` to PATH before proceeding, even if you ran `deps.ps1`. Run `flutter doctor` in PowerShell to confirm its installation. ### Dependencies -Install the Windows SDK: https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/ You may need to install the [Windows 10 SDK](https://developer.microsoft.com/en-us/windows/downloads/sdk-archive/), which can be installed [by Visual Studio](https://stackoverflow.com/a/73923899) (`Tools > Get Tools and Features... > Individual Components > Windows 10 SDK`) +Install the Windows SDK: https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/ You may need to install the [Windows 10 SDK](https://developer.microsoft.com/en-us/windows/downloads/sdk-archive/), which can be installed [by Visual Studio](https://stackoverflow.com/a/73923899) (`Tools > Get Tools and Features... > Modify > Individual Components > Windows 10 SDK`) Enable Developer Mode for symlink support, ``` From 18e08a8cb7a08b1544c292045ac2aae1fd5c5fed Mon Sep 17 00:00:00 2001 From: Josh Babb Date: Mon, 5 Jun 2023 15:19:50 -0700 Subject: [PATCH 10/10] do not start monero on windows --- lib/main.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/main.dart b/lib/main.dart index 8fa870214..08f29617a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -178,7 +178,9 @@ void main() async { } } - monero.onStartup(); + if (!Platform.isWindows) { + monero.onStartup(); + } if (!Platform.isLinux && !Platform.isWindows) { wownero.onStartup(); }