mirror of
https://github.com/actions/runner-images.git
synced 2025-12-11 03:27:05 +00:00
[Ubuntu] Reworked clang installation to use default Ubuntu repo (#3834)
This commit is contained in:
@@ -44,13 +44,6 @@ function Get-ClangVersions {
|
||||
return "Clang " + $clangVersions
|
||||
}
|
||||
|
||||
function Get-LLVMInfo {
|
||||
$clangVersions = Get-ClangToolVersions -ToolName "clang"
|
||||
$clangFormatVersions = Get-ClangToolVersions -ToolName "clang-format"
|
||||
$aptSourceRepo = Get-AptSourceRepository -PackageName "llvm"
|
||||
return "LLVM components: Clang $clangFormatVersions, Clang-format $clangFormatVersions (apt source: $aptSourceRepo)"
|
||||
}
|
||||
|
||||
function Get-ClangFormatVersions {
|
||||
$clangFormatVersions = Get-ClangToolVersions -ToolName "clang-format"
|
||||
return "Clang-format " + $clangFormatVersions
|
||||
|
||||
@@ -50,16 +50,11 @@ $runtimesList = @(
|
||||
(Get-RubyVersion),
|
||||
(Get-SwiftVersion),
|
||||
(Get-JuliaVersion),
|
||||
(Get-KotlinVersion)
|
||||
(Get-KotlinVersion),
|
||||
(Get-ClangVersions),
|
||||
(Get-ClangFormatVersions)
|
||||
)
|
||||
|
||||
if (Test-IsUbuntu20) {
|
||||
$runtimesList += (Get-LLVMInfo)
|
||||
} else {
|
||||
$runtimesList += (Get-ClangVersions)
|
||||
$runtimesList += (Get-ClangFormatVersions)
|
||||
}
|
||||
|
||||
$markdown += New-MDList -Style Unordered -Lines ($runtimesList | Sort-Object)
|
||||
|
||||
$markdown += New-MDHeader "Package Management" -Level 3
|
||||
|
||||
@@ -5,21 +5,13 @@
|
||||
################################################################################
|
||||
|
||||
# Source the helpers for use with the script
|
||||
source $HELPER_SCRIPTS/os.sh
|
||||
source $HELPER_SCRIPTS/install.sh
|
||||
|
||||
function InstallClang {
|
||||
local version=$1
|
||||
|
||||
echo "Installing clang-$version..."
|
||||
if [[ $version =~ 9 ]] && isUbuntu16 || [[ $version =~ 12 ]]; then
|
||||
./llvm.sh $version
|
||||
apt-get install -y "clang-format-$version"
|
||||
llvm_repo=$(grep '^deb.*apt.llvm.org\/' /etc/apt/sources.list)
|
||||
echo "llvm $llvm_repo" >> $HELPER_SCRIPTS/apt-sources.txt
|
||||
else
|
||||
apt-get install -y "clang-$version" "lldb-$version" "lld-$version" "clang-format-$version"
|
||||
fi
|
||||
apt-get install -y "clang-$version" "lldb-$version" "lld-$version" "clang-format-$version"
|
||||
}
|
||||
|
||||
function SetDefaultClang {
|
||||
@@ -31,10 +23,6 @@ function SetDefaultClang {
|
||||
update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-${version} 100
|
||||
}
|
||||
|
||||
# Download script for automatic installation
|
||||
download_with_retries https://apt.llvm.org/llvm.sh
|
||||
chmod +x llvm.sh
|
||||
|
||||
versions=$(get_toolset_value '.clang.versions[]')
|
||||
default_clang_version=$(get_toolset_value '.clang.default_version')
|
||||
|
||||
@@ -43,9 +31,8 @@ for version in ${versions[*]}; do
|
||||
InstallClang $version
|
||||
fi
|
||||
done
|
||||
InstallClang $default_clang_version
|
||||
|
||||
InstallClang $default_clang_version
|
||||
SetDefaultClang $default_clang_version
|
||||
rm llvm.sh
|
||||
|
||||
invoke_tests "Tools" "clang"
|
||||
|
||||
Reference in New Issue
Block a user