2022-12-08 19:14:16 +01:00
Import-Module " $PSScriptRoot /../helpers/Common.Helpers.psm1"
2020-12-14 09:29:07 +03:00
function Get-BashVersion {
$version = bash -c 'echo ${BASH_VERSION}'
2022-12-06 18:16:20 +01:00
return $version
2020-12-14 09:29:07 +03:00
}
2020-09-10 14:34:08 +03:00
function Get-DotnetVersionList {
$sdkRawList = Run-Command "dotnet --list-sdks"
2022-12-13 16:54:41 +01:00
return $sdkRawList | ForEach-Object { Take-Part $_ -Part 0 }
2020-09-10 14:34:08 +03:00
}
function Get-GoVersion {
$goOutput = Run-Command "go version" | Take-Part -Part 2
if ( $goOutput . StartsWith ( "go" )) {
$goOutput = $goOutput . Substring ( 2 )
}
2022-12-06 18:16:20 +01:00
return $goOutput
2020-09-10 14:34:08 +03:00
}
function Get-RVersion {
$rVersion = Run-Command "R --version | grep 'R version'" | Take-Part -Part 2
2022-12-06 18:16:20 +01:00
return $rVersion
2020-09-10 14:34:08 +03:00
}
2021-01-11 12:57:51 +05:00
2020-09-10 14:34:08 +03:00
function Get-RustVersion {
$rustVersion = Run-Command "rustc --version" | Take-Part -Part 1
2022-12-06 18:16:20 +01:00
return $rustVersion
2020-09-10 14:34:08 +03:00
}
2021-01-11 12:57:51 +05:00
function Get-RustfmtVersion {
$version = Run-Command "rustfmt --version" | Take-Part -Part 1
2022-12-06 18:16:20 +01:00
return $version
2021-01-11 12:57:51 +05:00
}
function Get-RustdocVersion {
$version = Run-Command "rustdoc --version" | Take-Part -Part 1
2022-12-06 18:16:20 +01:00
return $version
2021-01-11 12:57:51 +05:00
}
function Get-RustCargoVersion {
$version = Run-Command "cargo --version" | Take-Part -Part 1
2022-12-06 18:16:20 +01:00
return $version
2021-01-11 12:57:51 +05:00
}
function Get-RustClippyVersion {
$version = Run-Command "cargo clippy --version" | Take-Part -Part 1
2022-12-06 18:16:20 +01:00
return $version
2021-01-11 12:57:51 +05:00
}
2020-09-10 14:34:08 +03:00
function Get-Bindgen {
$bindgenVersion = Run-Command "bindgen --version" | Take-Part -Part 1
2022-12-06 18:16:20 +01:00
return $bindgenVersion
2020-09-10 14:34:08 +03:00
}
function Get-Cbindgen {
$cbindgenVersion = Run-Command "cbindgen --version" | Take-Part -Part 1
2022-12-06 18:16:20 +01:00
return $cbindgenVersion
2020-09-10 14:34:08 +03:00
}
function Get-Cargooutdated {
$cargoOutdatedVersion = Run-Command "cargo outdated --version" | Take-Part -Part 1
2022-12-06 18:16:20 +01:00
return $cargoOutdatedVersion
2020-09-10 14:34:08 +03:00
}
function Get-Cargoaudit {
2022-05-25 16:04:34 +02:00
$cargoAuditVersion = Run-Command "cargo-audit --version" | Take-Part -Part 1
2022-12-06 18:16:20 +01:00
return $cargoAuditVersion
2020-09-10 14:34:08 +03:00
}
function Get-RustupVersion {
2020-12-03 19:50:09 +03:00
$rustupVersion = Run-Command "rustup --version" | Select-Object -First 1 | Take-Part -Part 1
2022-12-06 18:16:20 +01:00
return $rustupVersion
2020-09-10 14:34:08 +03:00
}
function Get-VcpkgVersion {
$vcpkgVersion = Run-Command "vcpkg version" | Select-Object -First 1 | Take-Part -Part 5 | Take-Part -Part 0 -Delimiter "-"
2020-12-04 10:21:32 +03:00
$commitId = git -C "/usr/local/share/vcpkg" rev-parse - -short HEAD
2022-12-08 19:14:16 +01:00
return " $vcpkgVersion (build from commit $commitId )"
2020-09-10 14:34:08 +03:00
}
2022-12-06 18:16:20 +01:00
function Get-GccVersions {
2023-12-04 12:13:08 +01:00
$versionList = ( Get-ToolsetContent ). gcc . versions
2020-09-10 14:34:08 +03:00
$versionList | Foreach-Object {
2022-12-06 18:16:20 +01:00
$nameVersion = Run-Command "gcc- ${_} --version" | Select-Object -First 1
$version = ( $nameVersion -replace "^gcc- ${_} " ). Trim () -replace '\).*$' , ')'
2022-12-14 10:24:47 +01:00
return [ ToolVersionNode ]:: new ( "GCC ${_} " , " $version - available by `` gcc- ${_} `` alias" )
2020-09-10 14:34:08 +03:00
}
}
2022-12-06 18:16:20 +01:00
function Get-FortranVersions {
2023-12-04 12:13:08 +01:00
$versionList = ( Get-ToolsetContent ). gcc . versions
2020-09-10 14:34:08 +03:00
$versionList | Foreach-Object {
2022-12-06 18:16:20 +01:00
$nameVersion = Run-Command "gfortran- ${_} --version" | Select-Object -First 1
$version = ( $nameVersion -replace "^GNU Fortran" ). Trim () -replace '\).*$' , ')'
2022-12-14 10:24:47 +01:00
return [ ToolVersionNode ]:: new ( "GNU Fortran ${_} " , " $version - available by `` gfortran- ${_} `` alias" )
2020-09-10 14:34:08 +03:00
}
}
2022-12-06 18:16:20 +01:00
function Get-ClangLLVMVersions {
$clangVersionRegex = [ Regex ]:: new ( "(?<version>\d+\.\d+\.\d+)" )
$defaultClangOutput = Run-Command "clang --version" | Out-String
$defaultClangVersion = $clangVersionRegex . Match ( $defaultClangOutput ). Groups [ 'version' ]. Value
2023-12-04 12:13:08 +01:00
$homebrewClangPath = '$(brew --prefix llvm@{0})/bin/clang' -f (( Get-ToolsetContent ). llvm . version )
2022-12-06 18:16:20 +01:00
$homebrewClangOutput = Run-Command " $homebrewClangPath --version" | Out-String
$homebrewClangVersion = $clangVersionRegex . Match ( $homebrewClangOutput ). Groups [ 'version' ]. Value
return @ (
2022-12-14 10:24:47 +01:00
[ ToolVersionNode ]:: new ( "Clang/LLVM" , $defaultClangVersion )
[ ToolVersionNode ]:: new ( "Clang/LLVM (Homebrew)" , " $homebrewClangVersion - available on `` $homebrewClangPath `` " )
2022-12-06 18:16:20 +01:00
)
2020-09-10 14:34:08 +03:00
}
function Get-NVMVersion {
$nvmPath = Join-Path $env:HOME ".nvm" "nvm.sh"
$nvmInitCommand = ". ${nvmPath} > /dev/null 2>&1 || true"
$nodejsVersion = Run-Command " ${nvmInitCommand} && nvm --version"
2022-12-06 18:16:20 +01:00
return $nodejsVersion
2020-09-10 14:34:08 +03:00
}
function Get-PipVersion {
param (
[ Parameter ( Mandatory )][ ValidateRange ( 2 , 3 )]
[ int ] $Version
)
2023-10-15 20:34:15 +02:00
$command = If ( $Version -eq 2 ) { "/Library/Frameworks/Python.framework/Versions/2.7/bin/pip --version" } Else { "pip3 --version" }
2020-09-10 14:34:08 +03:00
$commandOutput = Run-Command $command
$versionPart1 = $commandOutput | Take-Part -Part 1
$versionPart2 = $commandOutput | Take-Part -Part 4
$versionPart3 = $commandOutput | Take-Part -Part 5
2022-12-06 18:16:20 +01:00
return " ${versionPart1} ${versionPart2} ${versionPart3} "
2020-09-10 14:34:08 +03:00
}
2020-10-07 09:29:37 +03:00
function Get-PipxVersion {
2020-10-12 11:10:02 +03:00
$pipxVersion = Run-Command "pipx --version" -SuppressStderr
2022-12-06 18:16:20 +01:00
return $pipxVersion
2020-10-07 09:29:37 +03:00
}
2020-09-10 14:34:08 +03:00
function Get-NVMNodeVersionList {
$nvmPath = Join-Path $env:HOME ".nvm" "nvm.sh"
$nvmInitCommand = ". ${nvmPath} > /dev/null 2>&1 || true"
$nodejsVersionsRaw = Run-Command " ${nvmInitCommand} && nvm ls"
$nodeVersions = $nodejsVersionsRaw | ForEach-Object { $_ . TrimStart ( " " ). TrimEnd ( " *" ) } | Where-Object { $_ . StartsWith ( "v" ) }
2022-12-13 16:54:41 +01:00
return $nodeVersions | ForEach-Object { $_ . TrimStart ( "v" ) }
2020-09-10 14:34:08 +03:00
}
function Build-OSInfoSection {
2022-12-06 18:16:20 +01:00
param (
[ string ] $ImageName
)
2020-09-10 14:34:08 +03:00
$fieldsToInclude = @ ( "System Version:" , "Kernel Version:" )
2024-01-04 10:46:00 +01:00
$rawSystemInfo = Run-Command "system_profiler SPSoftwareDataType"
2020-09-10 14:34:08 +03:00
$parsedSystemInfo = $rawSystemInfo | Where-Object { -not ( $_ | Select-String -NotMatch $fieldsToInclude ) } | ForEach-Object { $_ . Trim () }
2023-02-13 16:40:48 +01:00
$parsedSystemInfo [ 0 ] -match "System Version: macOS (?<version>\d+)" | Out-Null
2020-09-10 14:34:08 +03:00
$version = $Matches . Version
2022-12-06 18:16:20 +01:00
$systemVersion = $parsedSystemInfo [ 0 ]. Replace ( $fieldsToInclude [ 0 ], "" ). Trim ()
$kernelVersion = $parsedSystemInfo [ 1 ]. Replace ( $fieldsToInclude [ 1 ], "" ). Trim ()
2022-12-08 19:14:16 +01:00
$osInfoNode = [ HeaderNode ]:: new ( "macOS $version " )
2022-12-14 10:24:47 +01:00
$osInfoNode . AddToolVersion ( "OS Version:" , $systemVersion )
$osInfoNode . AddToolVersion ( "Kernel Version:" , $kernelVersion )
$osInfoNode . AddToolVersion ( "Image Version:" , $ImageName . Split ( '_' )[ 1 ])
2022-12-06 18:16:20 +01:00
return $osInfoNode
2020-12-28 11:15:54 +03:00
}
2022-12-08 19:14:16 +01:00
function Get-MonoVersion {
2024-01-04 10:46:00 +01:00
$monoVersion = Run-Command "mono --version" | Out-String | Take-Part -Part 4
2022-12-08 19:14:16 +01:00
return $monoVersion
}
2021-04-20 11:24:51 +03:00
function Get-MSBuildVersion {
2024-01-04 10:46:00 +01:00
$msbuildVersion = Run-Command "msbuild -version" | Select-Object -Last 1
2022-12-08 19:14:16 +01:00
$monoVersion = Get-MonoVersion
return " $msbuildVersion (Mono $monoVersion )"
2021-04-20 11:24:51 +03:00
}
2020-12-28 11:15:54 +03:00
function Get-NodeVersion {
$nodeVersion = Run-Command "node --version"
2022-12-08 19:14:16 +01:00
return $nodeVersion . TrimStart ( "v" )
2020-12-28 11:15:54 +03:00
}
2021-01-20 10:07:43 +03:00
function Get-PerlVersion {
$version = Run-Command "perl -e 'print substr( `$ ^V,1)'"
2022-12-06 18:16:20 +01:00
return $version
2021-01-20 10:07:43 +03:00
}
2020-12-28 11:15:54 +03:00
function Get-PythonVersion {
2023-10-15 20:34:15 +02:00
$pythonVersion = Run-Command "/Library/Frameworks/Python.framework/Versions/2.7/bin/python --version"
2022-12-06 18:16:20 +01:00
return ( $pythonVersion -replace "^Python" ). Trim ()
2020-12-28 11:15:54 +03:00
}
function Get-Python3Version {
$python3Version = Run-Command "python3 --version"
2022-12-06 18:16:20 +01:00
return ( $python3Version -replace "^Python" ). Trim ()
2020-12-28 11:15:54 +03:00
}
function Get-RubyVersion {
$rubyVersion = Run-Command "ruby --version" | Take-Part -Part 1
2022-12-06 18:16:20 +01:00
return $rubyVersion
2020-12-28 11:15:54 +03:00
}
function Get-PHPVersion {
$PHPVersion = Run-Command "php --version" | Select-Object -First 1 | Take-Part -Part 0 , 1
2022-12-06 18:16:20 +01:00
return ( $PHPVersion -replace "^PHP" ). Trim ()
2020-12-28 11:15:54 +03:00
}
function Get-JuliaVersion {
$juliaVersion = Run-Command "julia --version" | Take-Part -Part 0 , 2
2022-12-06 18:16:20 +01:00
return ( $juliaVersion -replace "^Julia" ). Trim ()
2020-12-28 11:15:54 +03:00
}
function Get-BundlerVersion {
$bundlerVersion = Run-Command "bundle --version"
2022-12-08 19:14:16 +01:00
return ( $bundlerVersion -replace "^Bundler version" ). Trim ()
2020-12-28 11:15:54 +03:00
}
function Get-CarthageVersion {
$carthageVersion = Run-Command "carthage version" -SuppressStderr
2022-12-06 18:16:20 +01:00
return $carthageVersion
2020-12-28 11:15:54 +03:00
}
function Get-CocoaPodsVersion {
$cocoaPodsVersion = Run-Command "pod --version"
2022-12-06 18:16:20 +01:00
return $cocoaPodsVersion
2020-12-28 11:15:54 +03:00
}
function Get-HomebrewVersion {
$homebrewVersion = Run-Command "brew --version" | Select-Object -First 1
2022-12-06 18:16:20 +01:00
return ( $homebrewVersion -replace "^Homebrew" ). Trim ()
2020-12-28 11:15:54 +03:00
}
function Get-NPMVersion {
$NPMVersion = Run-Command "npm --version"
2022-12-06 18:16:20 +01:00
return $NPMVersion
2020-12-28 11:15:54 +03:00
}
function Get-YarnVersion {
$yarmVersion = Run-Command "yarn --version"
2022-12-06 18:16:20 +01:00
return $yarmVersion
2020-12-28 11:15:54 +03:00
}
function Get-NuGetVersion {
$nugetVersion = Run-Command "nuget help" | Select-Object -First 1 | Take-Part -Part 2
2022-12-06 18:16:20 +01:00
return $nugetVersion
2020-12-28 11:15:54 +03:00
}
function Get-CondaVersion {
2024-01-04 10:46:00 +01:00
$condaVersion = Run-Command "conda --version"
2022-12-06 18:16:20 +01:00
return ( $condaVersion -replace "^conda" ). Trim ()
2020-12-28 11:15:54 +03:00
}
function Get-RubyGemsVersion {
$rubyGemsVersion = Run-Command "gem --version"
2022-12-06 18:16:20 +01:00
return $rubyGemsVersion
2020-12-28 11:15:54 +03:00
}
function Get-ComposerVersion {
$composerVersion = Run-Command "composer --version" | Take-Part -Part 2
2022-12-06 18:16:20 +01:00
return $composerVersion
2020-12-28 11:15:54 +03:00
}
function Get-MavenVersion {
$mavenVersion = Run-Command "mvn -version" | Select-Object -First 1 | Take-Part -Part 2
2022-12-06 18:16:20 +01:00
return $mavenVersion
2020-12-28 11:15:54 +03:00
}
#gradle output differs on the first launch – a welcome message, that we don't need is rendered. The solution is to take the last "Gradle" occurrence from the output
function Get-GradleVersion {
$gradleVersion = ( Run-Command "gradle --version" | Select-String "Gradle" )[ -1 ]
2022-12-06 18:16:20 +01:00
return ( $gradleVersion . Line -replace "^Gradle" ). Trim ()
2020-12-28 11:15:54 +03:00
}
function Get-ApacheAntVersion {
$apacheAntVersion = Run-Command "ant -version" | Take-Part -Part 0 , 1 , 3
2022-12-06 18:16:20 +01:00
return ( $apacheAntVersion -replace "^Apache Ant\(TM\)" ). Trim ()
2020-12-28 11:15:54 +03:00
}
function Get-CurlVersion {
$curlVersion = Run-Command "curl --version" | Select-Object -First 1 | Take-Part -Part 1
2022-12-06 18:16:20 +01:00
return $curlVersion
2020-12-28 11:15:54 +03:00
}
function Get-GitVersion {
2022-02-18 10:23:34 +03:00
$gitVersion = Run-Command "git --version" | Take-Part -Part -1
2022-12-06 18:16:20 +01:00
return $gitVersion
2020-12-28 11:15:54 +03:00
}
function Get-GitLFSVersion {
$gitLFSVersion = Run-Command "git-lfs version" | Take-Part -Part 0 | Take-Part -Part 1 -Delimiter "/"
2022-12-06 18:16:20 +01:00
return $gitLFSVersion
2020-12-28 11:15:54 +03:00
}
function Get-GitHubCLIVersion {
$ghVersion = Run-Command "gh --version" | Select-String "gh version" | Select-Object -First 1 | Take-Part -Part 2
2022-12-06 18:16:20 +01:00
return $ghVersion
2020-12-28 11:15:54 +03:00
}
function Get-WgetVersion {
$wgetVersion = Run-Command "wget --version" | Select-String "GNU Wget" | Take-Part -Part 2
2022-12-06 18:16:20 +01:00
return $wgetVersion
2020-12-28 11:15:54 +03:00
}
function Get-SVNVersion {
$svnVersion = Run-Command "svn --version --quiet"
2022-12-06 18:16:20 +01:00
return $svnVersion
2020-12-28 11:15:54 +03:00
}
function Get-PackerVersion {
2021-04-05 18:41:57 +03:00
# Packer 1.7.1 has a bug and outputs version to stderr instead of stdout https://github.com/hashicorp/packer/issues/10855
2024-01-04 10:46:00 +01:00
$result = Run-Command "packer --version"
2021-04-05 18:41:57 +03:00
$packerVersion = [ regex ]:: matches ( $result , "(\d+.){2}\d+" ). Value
2022-12-06 18:16:20 +01:00
return $packerVersion
2020-12-28 11:15:54 +03:00
}
function Get-OpenSSLVersion {
2022-12-13 16:54:41 +01:00
$opensslVersion = Run-Command "openssl version"
2022-12-06 18:16:20 +01:00
return ( $opensslVersion -replace "^OpenSSL" ). Trim ()
2020-12-28 11:15:54 +03:00
}
function Get-JqVersion {
$jqVersion = Run-Command "jq --version" | Take-Part -Part 1 -Delimiter "-"
2022-12-06 18:16:20 +01:00
return $jqVersion
2020-12-28 11:15:54 +03:00
}
function Get-GPGVersion {
$gpgVersion = Run-Command "gpg --version" | Select-String 'gpg (GnuPG)' -SimpleMatch
2022-12-06 18:16:20 +01:00
return ( $gpgVersion . Line -replace "^gpg \(GnuPG\)" ). Trim ()
2020-12-28 11:15:54 +03:00
}
function Get-PostgresClientVersion {
$postgresClientVersion = Run-Command "psql --version"
2022-12-06 18:16:20 +01:00
return ( $postgresClientVersion -replace "^psql \(PostgreSQL\)" ). Trim ()
2020-12-28 11:15:54 +03:00
}
function Get-PostgresServerVersion {
$postgresServerVersion = Run-Command "pg_config --version"
2022-12-06 18:16:20 +01:00
return ( $postgresServerVersion -replace "^PostgreSQL" ). Trim ()
2020-12-28 11:15:54 +03:00
}
function Get-Aria2Version {
$aria2Version = Run-Command "aria2c --version" | Select-Object -First 1 | Take-Part -Part 2
2022-12-06 18:16:20 +01:00
return $aria2Version
2020-12-28 11:15:54 +03:00
}
function Get-AzcopyVersion {
2023-12-11 22:26:33 +01:00
$azcopyVersion = [ string ] $ ( Run-Command "azcopy --version" ) | Take-Part -Part 2
2022-12-06 18:16:20 +01:00
return $azcopyVersion
2020-12-28 11:15:54 +03:00
}
function Get-ZstdVersion {
$zstdVersion = Run-Command "zstd --version" | Take-Part -Part 1 -Delimiter "v" | Take-Part -Part 0 -Delimiter ","
2022-12-06 18:16:20 +01:00
return $zstdVersion
2020-12-28 11:15:54 +03:00
}
function Get-BazelVersion {
$bazelVersion = Run-Command "bazel --version" | Take-Part -Part 0 -Delimiter "-"
2022-12-06 18:16:20 +01:00
return ( $bazelVersion -replace "^bazel" ). Trim ()
2020-12-28 11:15:54 +03:00
}
function Get-BazeliskVersion {
$bazeliskVersion = Run-Command "brew list bazelisk --versions"
2022-12-06 18:16:20 +01:00
return ( $bazeliskVersion -replace "^bazelisk" ). Trim ()
2020-12-28 11:15:54 +03:00
}
function Get-HelmVersion {
$helmVersion = Run-Command "helm version --short"
2022-12-06 18:16:20 +01:00
return $helmVersion
2020-12-28 11:15:54 +03:00
}
function Get-MongoVersion {
$mongo = Run-Command "mongo --version" | Select-String "MongoDB shell version" | Take-Part -Part 3
2022-12-23 09:38:33 +01:00
return $mongo . TrimStart ( "v" ). Trim ()
2020-12-28 11:15:54 +03:00
}
function Get-MongodVersion {
$mongod = Run-Command "mongod --version" | Select-String "db version " | Take-Part -Part 2
2022-12-23 09:38:33 +01:00
return $mongod . TrimStart ( "v" ). Trim ()
2020-12-28 11:15:54 +03:00
}
function Get-7zipVersion {
$7zip = Run-Command "7z i" | Select-String "7-Zip" | Take-Part -Part 0 , 2
2022-12-06 18:16:20 +01:00
return ( $7zip -replace "^7-Zip" ). Trim ()
2020-12-28 11:15:54 +03:00
}
function Get-GnuTarVersion {
$gnuTar = Run-Command "gtar --version" | Select-String "tar" | Take-Part -Part 3
2022-12-06 18:16:20 +01:00
return " $gnuTar - available by 'gtar' alias"
2020-12-28 11:15:54 +03:00
}
function Get-BsdtarVersion {
$bsdtar = Run-Command "tar --version" | Take-Part -Part 1
2022-12-06 18:16:20 +01:00
return " $bsdtar - available by 'tar' alias"
2020-12-28 11:15:54 +03:00
}
function Get-NewmanVersion {
$newmanVersion = Run-Command "newman --version"
2022-12-06 18:16:20 +01:00
return $newmanVersion
2020-12-28 11:15:54 +03:00
}
function Get-VirtualBoxVersion {
$virtualBox = Run-Command "vboxmanage -v"
2022-12-06 18:16:20 +01:00
return $virtualBox
2020-12-28 11:15:54 +03:00
}
function Get-VagrantVersion {
$vagrant = Run-Command "vagrant -v"
2022-12-06 18:16:20 +01:00
return ( $vagrant -replace "^Vagrant" ). Trim ()
2020-12-28 11:15:54 +03:00
}
function Get-ParallelVersion {
$parallelVersion = Run-Command "parallel --version" | Select-String "GNU parallel" | Select-Object -First 1
2022-12-06 18:16:20 +01:00
return ( $parallelVersion -replace "^GNU parallel" ). Trim ()
2020-12-28 11:15:54 +03:00
}
function Get-FastlaneVersion {
$fastlaneVersion = Run-Command "fastlane --version" | Select-String "^fastlane [0-9]" | Take-Part -Part 1
2022-12-06 18:16:20 +01:00
return $fastlaneVersion
2020-12-28 11:15:54 +03:00
}
function Get-CmakeVersion {
$cmakeVersion = Run-Command "cmake --version" | Select-Object -First 1 | Take-Part -Part 2
2022-12-06 18:16:20 +01:00
return $cmakeVersion
2020-12-28 11:15:54 +03:00
}
function Get-AppCenterCLIVersion {
$appcenterCLIVersion = Run-Command "appcenter --version" | Take-Part -Part 2
2022-12-06 18:16:20 +01:00
return $appcenterCLIVersion
2020-12-28 11:15:54 +03:00
}
function Get-AzureCLIVersion {
2021-11-02 19:29:24 +03:00
$azureCLIVersion = ( az version | ConvertFrom-Json ). 'azure-cli'
2022-12-06 18:16:20 +01:00
return $azureCLIVersion
2020-12-28 11:15:54 +03:00
}
2022-02-11 12:53:36 +03:00
function Get-AzureDevopsVersion {
$azdevopsVersion = ( az version | ConvertFrom-Json ). extensions . 'azure-devops'
2022-12-06 18:16:20 +01:00
return $azdevopsVersion
2022-02-11 12:53:36 +03:00
}
2020-12-28 11:15:54 +03:00
function Get-AWSCLIVersion {
$awsVersion = Run-Command "aws --version" | Take-Part -Part 0 | Take-Part -Delimiter "/" -Part 1
2022-12-06 18:16:20 +01:00
return $awsVersion
2020-12-28 11:15:54 +03:00
}
function Get-AWSSAMCLIVersion {
$awsSamVersion = Run-Command "sam --version" | Take-Part -Part 3
2022-12-06 18:16:20 +01:00
return $awsSamVersion
2020-12-28 11:15:54 +03:00
}
function Get-AWSSessionManagerCLIVersion {
$awsSessionManagerVersion = Run-Command "session-manager-plugin --version"
2022-12-06 18:16:20 +01:00
return $awsSessionManagerVersion
2020-12-28 11:15:54 +03:00
}
function Get-AliyunCLIVersion {
$aliyunVersion = Run-Command "aliyun --version" | Select-String "Alibaba Cloud Command Line Interface Version " | Take-Part -Part 6
2022-12-06 18:16:20 +01:00
return $aliyunVersion
2020-12-28 11:15:54 +03:00
}
function Get-GHCupVersion {
2022-05-08 09:32:24 +03:00
$ghcUpVersion = ( Run-Command "ghcup --version" | Take-Part -Part 5 ). Replace ( 'v' , '' )
2022-12-06 18:16:20 +01:00
return $ghcUpVersion
2020-12-28 11:15:54 +03:00
}
function Get-GHCVersion {
$ghcVersion = Run-Command "ghc --version" | Take-Part -Part 7
2022-12-06 18:16:20 +01:00
return $ghcVersion
2020-12-28 11:15:54 +03:00
}
function Get-CabalVersion {
$cabalVersion = Run-Command "cabal --version" | Take-Part -Part 3
2022-12-06 18:16:20 +01:00
return $cabalVersion
2020-12-28 11:15:54 +03:00
}
2021-06-08 10:44:31 +03:00
function Get-SwitchAudioOsxVersion {
$switchAudioVersion = Get-BrewPackageVersion -CommandName "SwitchAudioSource"
2022-12-06 18:16:20 +01:00
return $switchAudioVersion
2021-06-08 10:44:31 +03:00
}
function Get-SoxVersion {
$soxVersion = Get-BrewPackageVersion -CommandName "sox"
2022-12-06 18:16:20 +01:00
return $soxVersion
2021-06-08 10:44:31 +03:00
}
2020-12-28 11:15:54 +03:00
function Get-StackVersion {
$stackVersion = Run-Command "stack --version" | Take-Part -Part 1 | ForEach-Object { $_ . replace ( "," , "" )}
2022-12-06 18:16:20 +01:00
return $stackVersion
2020-12-28 11:15:54 +03:00
}
2021-04-14 10:22:41 +03:00
function Get-SwiftFormatVersion {
$swiftFormatVersion = Run-Command "swiftformat --version"
2022-12-06 18:16:20 +01:00
return $swiftFormatVersion
2021-04-14 10:22:41 +03:00
}
2020-12-28 11:15:54 +03:00
function Get-YamllintVersion {
$yamllintVersion = Run-Command "yamllint --version"
2022-12-06 18:16:20 +01:00
return ( $yamllintVersion -replace "^Yamllint" ). Trim ()
2020-12-28 11:15:54 +03:00
}
function Get-SwiftLintVersion {
$swiftlintVersion = Run-Command "swiftlint version"
2022-12-06 18:16:20 +01:00
return $swiftlintVersion
2020-12-28 11:15:54 +03:00
}
function Get-PowershellVersion {
$powershellVersion = Run-Command "powershell --version"
2022-12-06 18:16:20 +01:00
return ( $powershellVersion -replace "^PowerShell" ). Trim ()
2021-02-08 11:45:16 +05:00
}
2021-06-07 16:00:50 +03:00
function Get-SwigVersion {
$swigVersion = Run-Command "swig -version" | Select-Object -First 2 | Take-Part -Part 2
2022-12-06 18:16:20 +01:00
return $swigVersion
2021-06-07 16:00:50 +03:00
}
2021-07-07 09:10:31 -05:00
function Get-BicepVersion {
$bicepVersion = Run-Command "bicep --version" | Take-Part -Part 3
2022-12-06 18:16:20 +01:00
return $bicepVersion
2021-07-07 09:10:31 -05:00
}
2021-07-29 17:21:09 +03:00
function Get-KotlinVersion {
$kotlinVersion = Run-Command "kotlin -version" | Take-Part -Part 2
2022-12-06 18:16:20 +01:00
return $kotlinVersion
2021-07-29 17:21:09 +03:00
}
2021-09-21 12:49:59 +03:00
function Get-SbtVersion {
$sbtVersion = Run-Command "sbt -version" | Take-Part -Part 3
2022-12-06 18:16:20 +01:00
return $sbtVersion
2021-09-21 12:49:59 +03:00
}
2021-10-27 16:48:10 +03:00
function Get-JazzyVersion {
$jazzyVersion = Run-Command "jazzy --version" | Take-Part -Part 2
2022-12-06 18:16:20 +01:00
return $jazzyVersion
2021-10-27 16:48:10 +03:00
}
2021-12-17 23:47:47 +03:00
function Get-ZlibVersion {
2024-01-04 10:46:00 +01:00
$zlibVersion = ( Run-Command "brew info --json zlib" | ConvertFrom-Json ). installed . version
2022-12-06 18:16:20 +01:00
return $zlibVersion
2021-12-17 23:47:47 +03:00
}
2021-12-20 22:07:41 +03:00
function Get-LibXftVersion {
2024-01-04 10:46:00 +01:00
$libXftVersion = ( Run-Command "brew info --json libxft" | ConvertFrom-Json ). installed . version
2022-12-06 18:16:20 +01:00
return $libXftVersion
2021-12-20 22:07:41 +03:00
}
function Get-LibXextVersion {
2024-01-04 10:46:00 +01:00
$libXextVersion = ( Run-Command "brew info --json libxext" | ConvertFrom-Json ). installed . version
2022-12-06 18:16:20 +01:00
return $libXextVersion
2021-12-20 22:07:41 +03:00
}
2022-02-07 11:12:13 +03:00
function Get-TclTkVersion {
2024-01-04 10:46:00 +01:00
$tcltkVersion = ( Run-Command "brew info --json tcl-tk" | ConvertFrom-Json ). installed . version
2022-12-06 18:16:20 +01:00
return $tcltkVersion
2022-02-07 11:12:13 +03:00
}
2022-03-23 11:20:36 +01:00
function Get-YqVersion {
$yqVersion = Run-Command "yq --version"
2022-12-06 18:16:20 +01:00
$yqVersion -match "\d{1,2}\.\d{1,2}\.\d{1,2}" | Out-Null
return ( $Matches [ 0 ])
2022-03-23 11:20:36 +01:00
}
2022-05-02 11:05:31 +02:00
function Get-ImageMagickVersion {
$imagemagickVersion = Run-Command "magick --version" | Select-Object -First 1 | Take-Part -Part 1 , 2
2022-12-06 18:16:20 +01:00
return ( $imagemagickVersion -replace "^ImageMagick" ). Trim ()
2022-05-02 11:05:31 +02:00
}
2021-02-08 11:45:16 +05:00
function Build-PackageManagementEnvironmentTable {
2022-12-06 18:16:20 +01:00
$node = [ HeaderNode ]:: new ( "Environment variables" )
$table = @ (
2021-02-08 11:45:16 +05:00
@ {
"Name" = "CONDA"
"Value" = $env:CONDA
},
@ {
"Name" = "VCPKG_INSTALLATION_ROOT"
"Value" = $env:VCPKG_INSTALLATION_ROOT
}
) | ForEach-Object {
[ PSCustomObject ] @ {
"Name" = $_ . Name
"Value" = $_ . Value
}
}
2022-12-06 18:16:20 +01:00
2022-12-14 10:24:47 +01:00
$node . AddTable ( $table )
2022-12-06 18:16:20 +01:00
return $node
2021-02-08 11:45:16 +05:00
}
2022-02-02 11:02:55 +03:00
2022-09-28 19:06:08 +02:00
function Build-MiscellaneousEnvironmentTable {
return @ (
@ {
"Name" = "PARALLELS_DMG_URL"
"Value" = $env:PARALLELS_DMG_URL
}
) | ForEach-Object {
[ PSCustomObject ] @ {
"Name" = $_ . Name
"Value" = $_ . Value
}
}
}
2023-10-17 21:18:48 +01:00
function Get-CodeQLBundleVersion {
$CodeQLVersionWildcard = Join-Path $Env:AGENT_TOOLSDIRECTORY -ChildPath "CodeQL" | Join-Path -ChildPath "*"
$CodeQLVersionPath = Get-ChildItem $CodeQLVersionWildcard | Select-Object -First 1 -Expand FullName
$CodeQLPath = Join-Path $CodeQLVersionPath -ChildPath "x64" | Join-Path -ChildPath "codeql" | Join-Path -ChildPath "codeql"
$CodeQLVersion = & $CodeQLPath version - -quiet
return $CodeQLVersion
2022-09-27 09:54:35 +02:00
}
function Get-ColimaVersion {
$colimaVersion = Run-Command "colima version" | Select-String "colima version" | Take-Part -Part 2
2022-12-06 18:16:20 +01:00
return $colimaVersion
2022-09-27 09:54:35 +02:00
}
2023-02-23 17:00:00 +01:00
function Get-PKGConfigVersion {
$pkgconfigVersion = Run-Command "pkg-config --version"
return $pkgconfigVersion
2023-09-26 09:32:02 +02:00
}
2023-11-20 14:47:33 +01:00
function Get-XcbeautifyVersion {
$XcbeautifyVersion = Run-Command "xcbeautify --version"
return $XcbeautifyVersion
}
function Get-XcodesVersion {
$XcodesVersion = Run-Command "xcodes version"
return $XcodesVersion
}