[macos] Add toolcache for arm (#7974)

This commit is contained in:
Shamil Mubarakshin
2023-07-28 12:37:00 +02:00
committed by GitHub
parent 9a403df7bd
commit fc2f35d593
10 changed files with 199 additions and 114 deletions

View File

@@ -22,23 +22,23 @@ function Get-ToolsetToolFullPath
return $installationDir
}
$arch = Get-Architecture
$toolcache = Get-ToolsetValue "toolcache"
foreach ($tool in $toolcache)
{
$toolName = $tool.name
$toolArch = $tool.arch
$toolEnvironment = $tool.variable_template
$toolEnvironment = $tool.arch.$arch.variable_template
if (-not $toolEnvironment)
{
continue
}
foreach ($toolVersion in $tool.versions)
foreach ($toolVersion in $tool.arch.$arch.versions)
{
Write-Host "Set $toolName $toolVersion environment variable..."
$toolPath = Get-ToolsetToolFullPath -ToolName $toolName -ToolVersion $toolVersion -ToolArchitecture $toolArch
$toolPath = Get-ToolsetToolFullPath -ToolName $toolName -ToolVersion $toolVersion -ToolArchitecture $arch
$envName = $toolEnvironment -f $toolVersion.split(".")
# Add environment variable name=value

View File

@@ -75,8 +75,9 @@ function InstallPyPy
rm -f $PACKAGE_TAR_TEMP_PATH
}
arch=$(get_arch)
pypyVersions=$(curl https://downloads.python.org/pypy/versions.json)
toolsetVersions=$(get_toolset_value '.toolcache[] | select(.name | contains("PyPy")) | .versions[]')
toolsetVersions=$(get_toolset_value '.toolcache[] | select(.name | contains("PyPy")) | .arch.'$arch'.versions[]')
for toolsetVersion in $toolsetVersions; do
latestMajorPyPyVersion=$(echo $pypyVersions |

View File

@@ -23,7 +23,7 @@ if ! is_VenturaArm64; then
echo "Install Ruby from toolset..."
[ -n "$API_PAT" ] && authString=(-H "Authorization: token ${API_PAT}")
PACKAGE_TAR_NAMES=$(curl "${authString[@]}" -s "https://api.github.com/repos/ruby/ruby-builder/releases/latest" | jq -r '.assets[].name')
TOOLSET_VERSIONS=$(get_toolset_value '.toolcache[] | select(.name | contains("Ruby")) | .versions[]')
TOOLSET_VERSIONS=$(get_toolset_value '.toolcache[] | select(.name | contains("Ruby")) | .arch.'$arch'.versions[]')
RUBY_PATH="$AGENT_TOOLSDIRECTORY/Ruby"
echo "Check if Ruby hostedtoolcache folder exists..."

View File

@@ -28,6 +28,8 @@ Function Install-Asset {
Pop-Location
}
$arch = Get-Architecture
# Get toolcache content from toolset
$toolsToInstall = @("Python", "Node", "Go")
$tools = Get-ToolsetValue "toolcache" | Where-Object {$toolsToInstall -contains $_.Name}
@@ -37,10 +39,10 @@ foreach ($tool in $tools) {
$assets = Invoke-RestMethodWithRetry -Url $tool.url
# Get github release asset for each version
foreach ($version in $tool.versions) {
foreach ($version in $tool.arch.$arch.versions) {
$asset = $assets | Where-Object version -like $version `
| Select-Object -ExpandProperty files `
| Where-Object { ($_.platform -eq $tool.platform) -and ($_.arch -eq $tool.arch) -and ($_.platform_version -eq $tool.platform_version)} `
| Where-Object { ($_.platform -eq $tool.platform) -and ($_.arch -eq $arch)} `
| Select-Object -First 1
Write-Host "Installing $($tool.name) $version..."