Skip to content
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

Document environment variables of MacOS images #2493

Merged
merged 8 commits into from
Feb 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions images/macos/helpers/SoftwareReport.Helpers.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,22 @@ function New-MDNewLine {
$newLineSymbol = [System.Environment]::NewLine
return $newLineSymbol * $Count
}

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}"
}
14 changes: 14 additions & 0 deletions images/macos/software-report/SoftwareReport.Android.psm1
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Import-Module "$PSScriptRoot/../helpers/SoftwareReport.Helpers.psm1" -DisableNameChecking

function Split-TableRowByColumns {
param(
[string] $Row
Expand Down Expand Up @@ -98,6 +100,18 @@ function Build-AndroidTable {
}
}

function Build-AndroidEnvironmentTable {
$androidVersions = Get-Item env:ANDROID_*
dsame marked this conversation as resolved.
Show resolved Hide resolved

$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}
}
}
}

function Get-AndroidPackageVersions {
param (
[Parameter(Mandatory)]
Expand Down
24 changes: 23 additions & 1 deletion images/macos/software-report/SoftwareReport.Browsers.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,26 @@ function Get-FirefoxVersion {

function Get-GeckodriverVersion {
return Run-Command "geckodriver --version" | Select-Object -First 1
}
}

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
}
}
}
22 changes: 19 additions & 3 deletions images/macos/software-report/SoftwareReport.Common.psm1
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Import-Module "$PSScriptRoot/../helpers/SoftwareReport.Helpers.psm1" -DisableNameChecking

function Get-BashVersion {
$version = bash -c 'echo ${BASH_VERSION}'
return "Bash $version"
Expand Down Expand Up @@ -472,4 +470,22 @@ function Get-SwiftLintVersion {
function Get-PowershellVersion {
$powershellVersion = Run-Command "powershell --version"
return $powershellVersion
}
}

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
}
}
}
9 changes: 9 additions & 0 deletions images/macos/software-report/SoftwareReport.Generator.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ if ($os.IsHigherThanMojave) {
}

$markdown += New-MDList -Style Unordered -Lines ($packageManagementList | Sort-Object)
$markdown += New-MDHeader "Environment variables" -Level 4
$markdown += Build-PackageManagementEnvironmentTable | New-MDTable
$markdown += New-MDNewLine

# Project Management
$markdown += New-MDHeader "Project Management" -Level 3
Expand Down Expand Up @@ -183,6 +186,9 @@ $markdown += New-MDList -Style Unordered -Lines ($lintersList | Sort-Object)

$markdown += New-MDHeader "Browsers" -Level 3
$markdown += Get-BrowserSection
$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
Expand Down Expand Up @@ -267,6 +273,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

#
# Generate systeminfo.txt with information about image (for debug purpose)
Expand Down