Merge pull request #571 from cypherstack/windows

Windows: update flutter_libmonero to upgrade_gradle, update docs wrt dependencies
This commit is contained in:
Diego Salazar 2023-06-05 16:23:57 -06:00 committed by GitHub
commit a79d8a802f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 68 additions and 20 deletions

@ -1 +1 @@
Subproject commit 73d257ed2fe5b204cf3589822e226301b187b86d
Subproject commit db87831332ae2ead75aee4e55ea4434c229d9d5f

View file

@ -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.*'
```
<!-- TODO: configure compiler to prefer built over system libraries. Should already use them? -->
### 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
```
@ -147,22 +150,30 @@ 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/ 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,
```
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
```
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).
You may need to install CppWinRT / C++/WinRT SDKs:
```
winget install Microsoft.Windows.CppWinRT
```
### Run prebuild script
Install the Windows SDK: https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/
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

View file

@ -178,7 +178,9 @@ void main() async {
}
}
monero.onStartup();
if (!Platform.isWindows) {
monero.onStartup();
}
if (!Platform.isLinux && !Platform.isWindows) {
wownero.onStartup();
}

17
scripts/prebuild.ps1 Normal file
View file

@ -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 -Encoding UTF8
}
# 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 -Encoding UTF8
}
}

View file

@ -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")
}