From b169ce9de9749c133b1377252c4aa9fdd6848f2d Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Mon, 8 Feb 2021 11:45:45 +0500 Subject: [PATCH] Document environment variables of Win images (#2494) * Document environment variables of Win images * Change adnroid variables * Apply reviews * Remove some variables, fix headers * Show link targets * rename helper * remove symlinks * More links --- .../SoftwareReport.Android.psm1 | 13 ++++++++++ .../SoftwareReport.Browsers.psm1 | 24 ++++++++++++++++++- .../SoftwareReport.CachedTools.psm1 | 2 +- .../SoftwareReport/SoftwareReport.Common.psm1 | 19 +++++++++++++++ .../SoftwareReport.Generator.ps1 | 10 ++++++++ .../SoftwareReport.Helpers.psm1 | 21 +++++++++++++++- 6 files changed, 86 insertions(+), 3 deletions(-) diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Android.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.Android.psm1 index 14327ecf6..bc1ad0be7 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Android.psm1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Android.psm1 @@ -1,3 +1,5 @@ +Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Helpers.psm1") -DisableNameChecking + function Split-TableRowByColumns { param( [string] $Row @@ -156,3 +158,14 @@ function Get-AndroidGoogleAPIsVersions { return ($versions -Join "
") } +function Build-AndroidEnvironmentTable { + $androidVersions = Get-Item env:ANDROID_* + + $shoulddResolveLink = 'ANDROID_NDK_PATH', 'ANDROID_NDK_HOME', 'ANDROID_NDK_ROOT', 'ANDROID_NDK_LATEST_HOME' + return $androidVersions | Sort-Object -Property Name | ForEach-Object { + [PSCustomObject] @{ + "Name" = $_.Name + "Value" = if ($shoulddResolveLink.Contains($_.Name )) { Get-PathWithLink($_.Value) } else {$_.Value} + } + } +} diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Browsers.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.Browsers.psm1 index 3784b7fa9..d60ce845b 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Browsers.psm1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Browsers.psm1 @@ -52,4 +52,26 @@ function Get-SeleniumWebDriverVersion { $versionFileName = "versioninfo.txt"; $webDriverVersion = Get-Content -Path "$driverPath\$versionFileName" return "$driverName $webDriverVersion" -} \ No newline at end of file +} + +function Build-BrowserWebdriversEnvironmentTable { + return @( + @{ + "Name" = "CHROMEWEBDRIVER" + "Value" = $env:CHROMEWEBDRIVER + }, + @{ + "Name" = "EDGEWEBDRIVER" + "Value" = $env:EDGEWEBDRIVER + }, + @{ + "Name" = "GECKOWEBDRIVER" + "Value" = $env:GECKOWEBDRIVER + } + ) | ForEach-Object { + [PSCustomObject] @{ + "Name" = $_.Name + "Value" = $_.Value + } + } +} diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.CachedTools.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.CachedTools.psm1 index f283d1426..b5e1e5295 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.CachedTools.psm1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.CachedTools.psm1 @@ -114,4 +114,4 @@ function Build-CachedToolsMarkdown $markdown += Get-PyPyMarkdown return $markdown -} \ No newline at end of file +} diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1 index 746356cd5..41a22bb8c 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1 @@ -337,3 +337,22 @@ function Get-PipxVersion { $pipxVersion = pipx --version return "Pipx $pipxVersion" } + +function Build-PackageManagementEnvironmentTable { + return @( + @{ + "Name" = "CONDA" + "Value" = $env:CONDA + }, + @{ + "Name" = "VCPKG_INSTALLATION_ROOT" + "Value" = $env:VCPKG_INSTALLATION_ROOT + } + ) | ForEach-Object { + [PSCustomObject] @{ + "Name" = $_.Name + "Value" = $_.Value + } + } +} + diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index 07d74b378..9a66ad7ab 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -58,6 +58,9 @@ $markdown += New-MDList -Style Unordered -Lines (@( (Get-YarnVersion) ) | Sort-Object ) +$markdown += New-MDHeader "Environment variables" -Level 4 +$markdown += Build-PackageManagementEnvironmentTable | New-MDTable +$markdown += New-MDNewLine $markdown += New-MDHeader "Project Management" -Level 3 $markdown += New-MDList -Style Unordered -Lines (@( @@ -150,6 +153,10 @@ $markdown += New-MDList -Style Unordered -Lines @( (Get-SeleniumWebDriverVersion -Driver "iexplorer") ) +$markdown += New-MDHeader "Environment variables" -Level 4 +$markdown += Build-BrowserWebdriversEnvironmentTable | New-MDTable +$markdown += New-MDNewLine + $markdown += New-MDHeader "Java" -Level 3 $markdown += Get-JavaVersions | New-MDTable $markdown += New-MDNewLine @@ -259,6 +266,9 @@ $markdown += New-MDNewLine $markdown += New-MDHeader "Android" -Level 3 $markdown += Build-AndroidTable | New-MDTable $markdown += New-MDNewLine +$markdown += New-MDHeader "Environment variables" -Level 4 +$markdown += Build-AndroidEnvironmentTable | New-MDTable +$markdown += New-MDNewLine # Docker images section $markdown += New-MDHeader "Cached Docker images" -Level 3 diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Helpers.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.Helpers.psm1 index 11c0f5c5c..7971f91e0 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Helpers.psm1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Helpers.psm1 @@ -102,4 +102,23 @@ function New-MDNewLine { ) $newLineSymbol = [System.Environment]::NewLine return $newLineSymbol * $Count -} \ No newline at end of file +} + +function Get-LinkTarget { + param ( + [string] $inputPath + ) + $link = Get-Item $inputPath | Select-Object -ExpandProperty Target + if ($link) { + return " -> $link" + } + return "" +} + +function Get-PathWithLink { + param ( + [string] $inputPath + ) + $link = Get-LinkTarget($inputPath) + return "${inputPath}${link}" +}