[macos] refactor XCode installation approach (#7858)

* [macos] refactor XCode installation approach

xcversion does not work anymore, we are switching to storing
XCode installers in intermediate Azure storage

* remove xcode_install_user, xcode_install_password

* rename xcode_install_storage --> xcode_install_storage_url

* mark xcode installation variables sensitive

* remove xcversion_auth_cookie variable

* renamed forgotten xcode_install_storage --> xcode_install_storage_url

* remove leftover xcode_install_user
This commit is contained in:
ilia-shipitsin
2023-07-06 11:36:08 +02:00
committed by GitHub
parent 406a7844ab
commit 63b7bc4bde
13 changed files with 57 additions and 142 deletions

View File

@@ -24,17 +24,14 @@ function Invoke-DownloadXcodeArchive {
[string]$Version
)
$resolvedVersion = Resolve-ExactXcodeVersion -Version $Version
if (-not $resolvedVersion) {
throw "Version '$Version' can't be matched to any available version"
}
Write-Host "Downloading Xcode $resolvedVersion"
Invoke-XCVersion -Arguments "install '$resolvedVersion' --no-install" | Out-Host
Write-Host "Downloading Xcode $Version"
$xcodeXipName = "$resolvedVersion" -replace " ", "_"
$xcodeXipFile = Get-ChildItem -Path $DownloadDirectory -Filter "Xcode_$xcodeXipName.xip" | Select-Object -First 1
$tempXipDirectory = New-Item -Path $DownloadDirectory -Name "Xcode$xcodeXipName" -ItemType "Directory"
Move-Item -Path "$xcodeXipFile" -Destination $tempXipDirectory
$tempXipDirectory = New-Item -Path $DownloadDirectory -Name "Xcode$Version" -ItemType "Directory"
$xcodeFileName = 'Xcode-{0}.xip' -f $Version
$xcodeUri = '{0}{1}{2}'-f ${env:XCODE_INSTALL_STORAGE_URL}, $xcodeFileName, ${env:XCODE_INSTALL_SAS}
Invoke-WebRequest -Uri $xcodeUri -OutFile (Join-Path $tempXipDirectory $xcodeFileName)
return $tempXipDirectory
@@ -86,7 +83,7 @@ function Expand-XcodeXipArchive {
[string]$TargetPath
)
$xcodeXipPath = Get-ChildItem -Path $DownloadDirectory -Filter "Xcode_*.xip" | Select-Object -First 1
$xcodeXipPath = Get-ChildItem -Path $DownloadDirectory -Filter "Xcode-*.xip" | Select-Object -First 1
Write-Host "Extracting Xcode from '$xcodeXipPath'"
Push-Location $DownloadDirectory