mirror of
https://github.com/actions/runner-images.git
synced 2025-12-14 22:05:17 +00:00
[Ubuntu] Add clang-format to the readme (#3081)
* Add clang-format to the readme * Create a function to retrieve clang tool versions * Add ClangFormatVersions to software report * Add new line * Resolve nitpicks
This commit is contained in:
@@ -20,19 +20,36 @@ function Get-FortranVersions {
|
||||
return "GNU Fortran " + ($fortranVersions -Join ", ")
|
||||
}
|
||||
|
||||
function Get-ClangVersions {
|
||||
$clangVersions = @()
|
||||
function Get-ClangToolVersions {
|
||||
param (
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string] $ToolName,
|
||||
[string] $VersionPattern = "\d+\.\d+\.\d+)-"
|
||||
)
|
||||
|
||||
$result = Get-CommandResult "apt list --installed" -Multiline
|
||||
$clangVersions = $result.Output | Where-Object { $_ -match "^clang-\d+"} | ForEach-Object {
|
||||
$toolVersions = $result.Output | Where-Object { $_ -match "^${ToolName}-\d+"} | ForEach-Object {
|
||||
$clangCommand = ($_ -Split "/")[0]
|
||||
Invoke-Expression "$clangCommand --version" | Where-Object { $_ -match "clang version" } | ForEach-Object {
|
||||
$_ -match "clang version (?<version>\d+\.\d+\.\d+)-" | Out-Null
|
||||
Invoke-Expression "$clangCommand --version" | Where-Object { $_ -match "${ToolName} version" } | ForEach-Object {
|
||||
$_ -match "${ToolName} version (?<version>${VersionPattern}" | Out-Null
|
||||
$Matches.version
|
||||
}
|
||||
} | Sort-Object {[Version]$_}
|
||||
return "Clang " + ($clangVersions -Join ", ")
|
||||
}
|
||||
} | Sort-Object {[Version]$_}
|
||||
|
||||
return $toolVersions -Join ", "
|
||||
}
|
||||
|
||||
function Get-ClangVersions {
|
||||
$clangVersions = Get-ClangToolVersions -ToolName "clang"
|
||||
return "Clang " + $clangVersions
|
||||
}
|
||||
|
||||
function Get-ClangFormatVersions {
|
||||
$clangFormatVersions = Get-ClangToolVersions -ToolName "clang-format"
|
||||
return "Clang-format " + $clangFormatVersions
|
||||
}
|
||||
|
||||
|
||||
function Get-ErlangVersion {
|
||||
$erlangVersion = (erl -eval '{ok, Version} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), ''OTP_VERSION''])), io:fwrite(Version), halt().' -noshell)
|
||||
$shellVersion = (erl -eval 'erlang:display(erlang:system_info(version)), halt().' -noshell).Trim('"')
|
||||
|
||||
Reference in New Issue
Block a user