-
Notifications
You must be signed in to change notification settings - Fork 1.2k
RNW dependencies #4876
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
RNW dependencies #4876
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
03bd6a8
add rnw-dependencies.ps1
asklar 085493b
Change files
asklar 4cc5923
--sln
asklar 15d2b3f
run in CI
asklar dd000e3
print
asklar d4dc77a
desktop appium is optional
asklar 247481d
use agent directory
asklar 6415a71
15GB is a ballpark estimate
asklar 7d3a10e
optional space
asklar 9bf1bbb
.
asklar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
change/react-native-windows-2020-05-11-17-22-16-rnw-dependencies.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "type": "prerelease", | ||
| "comment": "add rnw-dependencies.ps1", | ||
| "packageName": "react-native-windows", | ||
| "email": "[email protected]", | ||
| "dependentChangeType": "patch", | ||
| "date": "2020-05-12T00:22:16.000Z" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,147 @@ | ||
| # Troubleshoot RNW dependencies | ||
asklar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| param([switch]$Install = $false, [switch]$NoPrompt = $false) | ||
| $vsWorkloads = @( 'Microsoft.Component.MSBuild', 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64', 'Microsoft.VisualStudio.ComponentGroup.UWP.Support'); | ||
|
|
||
| $v = [System.Environment]::OSVersion.Version; | ||
| if ($env:Agent_BuildDirectory) { | ||
| $drive = (Resolve-Path $env:Agent_BuildDirectory).Drive | ||
| } else { | ||
| $drive = (Resolve-Path $PSCommandPath).Drive | ||
| } | ||
|
|
||
| function CheckVS { | ||
| $vsWhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" | ||
| if (!(Test-Path $vsWhere)) { | ||
| return $false; | ||
| } | ||
| $output = & $vsWhere -version 16 -requires $vsWorkloads -property productPath | ||
| return Test-Path $output; | ||
| } | ||
|
|
||
| function InstallVS { | ||
| $installerPath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer"; | ||
| $vsWhere = "$installerPath\vswhere.exe" | ||
| if (!(Test-Path $vsWhere)) { | ||
| # No VSWhere / VS_Installer | ||
| & choco install -y visualstudio2019community | ||
| } | ||
| $channelId = & $vsWhere -version 16 -property channelId | ||
| $productId = & $vsWhere -version 16 -property productId | ||
| $vsInstaller = "$installerPath\vs_installer.exe" | ||
| $addWorkloads = $vsWorkloads | % { '--add', $_ }; | ||
| Start-Process -PassThru -Wait -Path $vsInstaller -ArgumentList ("install --channelId $channelId --productId $productId $addWorkloads --quiet" -split ' ') | ||
|
|
||
| } | ||
|
|
||
| function CheckNode { | ||
| try { | ||
| $v = (Get-Command node).Version.Major | ||
| return $v -eq 12 -or $v -eq 13 | ||
| } catch { | ||
| return $false; | ||
| } | ||
| } | ||
|
|
||
| function GetChocoPkgVersion{ | ||
| params([string]$packageId) | ||
| [version]$version = (& choco list --local-only $packageId -r -e).Substring($packageId.Length + 1); | ||
| return $version; | ||
| } | ||
|
|
||
| $requiredFreeSpaceGB = 15; | ||
|
|
||
| $requirements = @( | ||
| @{ | ||
| Name = "Free space on $drive`: > $requiredFreeSpaceGB GB"; | ||
| Valid = $drive.Free/1GB -gt $requiredFreeSpaceGB; | ||
| Optional = $true # this requirement is fuzzy | ||
| }, | ||
| @{ | ||
| Name = 'Windows version > 10.0.16299.0'; | ||
| Valid = ($v.Major -eq 10 -and $v.Minor -eq 0 -and $v.Build -ge 16299) | ||
| }, | ||
| @{ | ||
| Name = 'Developer mode is on'; | ||
| Valid = try { (Get-WindowsDeveloperLicense).IsValid } catch { $false } | ||
| }, | ||
| @{ | ||
| Name = 'git'; | ||
| Valid = try { (Get-Command git.exe) -ne $null } catch { $false } | ||
| } | ||
| @{ | ||
| Name = 'Choco'; | ||
| Valid = try { (Get-Command choco) -ne $null } catch { $false }; | ||
| Install = { | ||
| [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; | ||
| iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) | ||
| }; | ||
| }, | ||
| @{ | ||
| Name = 'VS 2019 with UWP and Desktop/C++'; | ||
| Valid = CheckVS | ||
| }, | ||
| @{ | ||
| Name = 'NodeJS 12 or 13 installed'; | ||
| Valid = CheckNode | ||
| Install = { choco install -y nodejs.install --version=12.9.1 } | ||
| }, | ||
| @{ | ||
| Name = 'Chrome'; | ||
| Valid = try { ((Get-Item (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe').'(Default)').VersionInfo).ProductMajorPart | ||
| } catch { $false } ; | ||
| Install = { choco install -y GoogleChrome } | ||
| }, | ||
| @{ | ||
| Name = 'Yarn'; | ||
| Valid = try { (Get-Command yarn) -ne $null } catch { $false }; | ||
| Install = { choco install -y yarn } | ||
| }, | ||
| @{ | ||
| Name = 'Appium'; | ||
| Valid = (Test-Path "${env:ProgramFiles}\Appium\Appium.exe"); | ||
| Install = { choco install -y Appium-desktop }; | ||
| Optional = $true | ||
| }, | ||
| @{ | ||
| Name = 'WinAppDriver'; | ||
| Valid = (Test-Path "${env:ProgramFiles(x86)}\Windows Application Driver\WinAppDriver.exe"); | ||
| Install = { choco install -y WinAppDriver }; | ||
| } | ||
|
|
||
| ); | ||
|
|
||
| function IsElevated { | ||
| return [bool](([System.Security.Principal.WindowsIdentity]::GetCurrent()).groups -match "S-1-5-32-544"); | ||
| } | ||
|
|
||
| if (!(IsElevated)) { | ||
| Write-Output "rnw-dependencies - this script must run elevated. Exiting."; | ||
| return; | ||
| } | ||
|
|
||
| $NeedsRerun = $false | ||
| foreach ($req in $requirements) | ||
| { | ||
| Write-Output "Checking $($req.Name)"; | ||
| if (!($req.Valid)) { | ||
| Write-Output "Requirement failed: $($req.Name)"; | ||
| if ($req.Install) { | ||
| if ($Install -or (!$NoPrompt -and (Read-Host "Do you want to install? ").ToUpperInvariant() -eq 'Y')) { | ||
| Invoke-Command $req.Install -ErrorAction Stop | ||
| if ($LASTEXITCODE -ne 0) { throw "Last exit code was non-zero: $LASTEXITCODE"; } | ||
| } elseif (!$req.Optional) { | ||
| $NeedsRerun = $true; | ||
| } | ||
| } else { | ||
| $NeedsRerun = !($req.Optional); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if ($NeedsRerun) { | ||
| Write-Output "Some dependencies are not met. Re-run with -Install to install them."; | ||
| exit 1; | ||
| } else { | ||
| Write-Output "All mandatory requirements met"; | ||
| exit 0; | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.