[Windows] Rework common tools software report script (#7801)

This commit is contained in:
Erik Bershel
2023-06-29 10:18:16 +02:00
committed by GitHub
parent f0c7d3c5b1
commit 32bb7d9e99

View File

@@ -22,95 +22,79 @@ function Build-OSInfoSection {
} }
function Get-BashVersion { function Get-BashVersion {
$version = bash --% -c 'echo ${BASH_VERSION}' bash --% -c 'echo ${BASH_VERSION}'
return $version
} }
function Get-RustVersion { function Get-RustVersion {
$rustVersion = [regex]::matches($(rustc --version), "\d+\.\d+\.\d+").Value rustc --version | Take-Part -Part 1
return $rustVersion
} }
function Get-RustupVersion { function Get-RustupVersion {
$rustupInfo = cmd /c "rustup --version 2>NUL" cmd /c "rustup --version 2>NUL" | Take-Part -Part 1
$version = [regex]::matches($rustupInfo, "\d+\.\d+\.\d+").Value
return $version
} }
function Get-RustCargoVersion { function Get-RustCargoVersion {
$version = [regex]::matches($(cargo --version), "\d+\.\d+\.\d+").Value cargo --version | Take-Part -Part 1
return $version
} }
function Get-RustdocVersion { function Get-RustdocVersion {
$version = [regex]::matches($(rustdoc --version), "\d+\.\d+\.\d+").Value rustdoc --version | Take-Part -Part 1
return $version
} }
function Get-RustfmtVersion { function Get-RustfmtVersion {
$version = [regex]::matches($(rustfmt --version), "\d+\.\d+\.\d+").Value rustfmt --version | Take-Part -Part 1
return $version
} }
function Get-RustClippyVersion { function Get-RustClippyVersion {
$version = [regex]::matches($(cargo clippy --version), "\d+\.\d+\.\d+").Value cargo clippy --version | Take-Part -Part 1
return $version
} }
function Get-BindgenVersion { function Get-BindgenVersion {
return ((bindgen --version) -replace "^bindgen").Trim() bindgen --version | Take-Part -Part 1
} }
function Get-CbindgenVersion { function Get-CbindgenVersion {
return ((cbindgen --version) -replace "^cbindgen").Trim() cbindgen --version | Take-Part -Part 1
} }
function Get-CargoAuditVersion { function Get-CargoAuditVersion {
return ((cargo-audit --version) -replace "^cargo-audit").Trim() cargo-audit --version | Take-Part -Part 1
} }
function Get-CargoOutdatedVersion { function Get-CargoOutdatedVersion {
return ((cargo outdated --version) -replace "^cargo-outdated").Trim() cargo outdated --version | Take-Part -Part 1
} }
function Get-PythonVersion { function Get-PythonVersion {
return ((python --version) -replace "^Python").Trim() python --version | Take-Part -Part 1
} }
function Get-PowershellCoreVersion { function Get-PowershellCoreVersion {
return ((pwsh --version) -replace "^PowerShell").Trim() pwsh --version | Take-Part -Part 1
} }
function Get-RubyVersion { function Get-RubyVersion {
$rubyVersion = $(ruby --version).split(" ")[1] ruby --version | Take-Part -Part 1
return $rubyVersion
} }
function Get-GoVersion { function Get-GoVersion {
$(go version) -match "go(?<version>\d+\.\d+\.\d+)" | Out-Null go version | Take-Part -Part 2 | Take-Part -Part 1 -Delimiter ('o')
$goVersion = $Matches.Version
return $goVersion
} }
function Get-KotlinVersion { function Get-KotlinVersion {
$kotlinVersion = $((cmd /c "kotlinc -version 2>&1") | Out-String).split(" ")[2] cmd /c "kotlinc -version 2>&1" | Take-Part -Part 2
return $kotlinVersion
} }
function Get-PHPVersion { function Get-PHPVersion {
($(php --version) | Out-String) -match "PHP (?<version>\d+\.\d+\.\d+)" | Out-Null php --version | Out-String | Take-Part -Part 1
$phpVersion = $Matches.Version
return $phpVersion
} }
function Get-JuliaVersion { function Get-JuliaVersion {
$juliaVersion = [regex]::matches($(julia --version), "\d+\.\d+\.\d+").Value julia --version | Take-Part -Part 2
return $juliaVersion
} }
function Get-LLVMVersion { function Get-LLVMVersion {
$llvmVersion = [regex]::matches($(clang --version), "\d+\.\d+\.\d+").Value (clang --version) -match "clang" | Take-Part -Part 2
return $llvmVersion
} }
function Get-PerlVersion { function Get-PerlVersion {
@@ -120,12 +104,11 @@ function Get-PerlVersion {
} }
function Get-NodeVersion { function Get-NodeVersion {
$nodeVersion = $(node --version).split("v")[1] node --version | Take-Part -Part 0 -Delimiter ('v')
return $nodeVersion
} }
function Get-ChocoVersion { function Get-ChocoVersion {
return $(choco --version) choco --version
} }
function Get-VcpkgVersion { function Get-VcpkgVersion {
@@ -134,15 +117,15 @@ function Get-VcpkgVersion {
} }
function Get-NPMVersion { function Get-NPMVersion {
return $(npm -version) npm -version
} }
function Get-YarnVersion { function Get-YarnVersion {
return $(yarn -version) yarn -version
} }
function Get-RubyGemsVersion { function Get-RubyGemsVersion {
return $(gem --version) gem --version
} }
function Get-HelmVersion { function Get-HelmVersion {
@@ -152,10 +135,7 @@ function Get-HelmVersion {
} }
function Get-PipVersion { function Get-PipVersion {
($(pip --version) | Out-String) -match "(?<version>pip [\d\.]+) .+ (?<python>\(python [\d\.]+\))" | Out-Null (pip --version) -match "pip" | Take-Part -Part 1,4,5
$pipVersion = $Matches.Version
$pythonVersion = $Matches.Python
return ("$pipVersion $pythonVersion" -replace "^pip").Trim()
} }
function Get-CondaVersion { function Get-CondaVersion {
@@ -168,19 +148,15 @@ function Get-ComposerVersion {
} }
function Get-NugetVersion { function Get-NugetVersion {
return (((nuget help) -match "NuGet Version") -replace "NuGet Version:").Trim() (nuget help) -match "Nuget Version" | Take-Part -Part 2
} }
function Get-AntVersion { function Get-AntVersion {
($(ant -version) | Out-String) -match "version (?<version>\d+\.\d+\.\d+)" | Out-Null (ant -version) -match "version" | Take-Part -Part 3
$antVersion = $Matches.Version
return $antVersion
} }
function Get-MavenVersion { function Get-MavenVersion {
($(mvn -version) | Out-String) -match "Apache Maven (?<version>\d+\.\d+\.\d+)" | Out-Null (mvn -version) -match "Apache Maven" | Take-Part -Part 2
$mavenVersion = $Matches.Version
return $mavenVersion
} }
function Get-GradleVersion { function Get-GradleVersion {
@@ -190,7 +166,7 @@ function Get-GradleVersion {
} }
function Get-SbtVersion { function Get-SbtVersion {
return ((sbt -version) -match "sbt script version:" -replace "sbt script version:").Trim() (sbt -version) -match "sbt script" | Take-Part -Part 3
} }
function Get-DotnetSdks { function Get-DotnetSdks {
@@ -326,7 +302,7 @@ function Get-PacmanVersion {
} }
function Get-YAMLLintVersion { function Get-YAMLLintVersion {
return ((yamllint --version) -replace "^yamllint").Trim() yamllint --version | Take-Part -Part 1
} }
function Get-BizTalkVersion { function Get-BizTalkVersion {
@@ -335,8 +311,7 @@ function Get-BizTalkVersion {
} }
function Get-PipxVersion { function Get-PipxVersion {
$pipxVersion = pipx --version pipx --version
return $pipxVersion
} }
function Build-PackageManagementEnvironmentTable { function Build-PackageManagementEnvironmentTable {