Skip to content

Commit 4ec9fda

Browse files
[macos] use unxip if available for XCode unpacking (#7992)
1 parent c493b06 commit 4ec9fda

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

images/macos/helpers/Common.Helpers.psm1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,12 @@ function Get-Architecture {
166166

167167
return $arch
168168
}
169+
170+
function Test-CommandExists {
171+
param
172+
(
173+
[Parameter(Mandatory)] [string] $Command
174+
)
175+
176+
[boolean] (Get-Command $Command -ErrorAction 'SilentlyContinue')
177+
}

images/macos/helpers/Xcode.Installer.psm1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
Import-Module "$PSScriptRoot/Common.Helpers.psm1"
12
Import-Module "$PSScriptRoot/Xcode.Helpers.psm1"
23

34
function Install-XcodeVersion {
@@ -86,7 +87,11 @@ function Expand-XcodeXipArchive {
8687

8788
Write-Host "Extracting Xcode from '$xcodeXipPath'"
8889
Push-Location $DownloadDirectory
89-
Invoke-ValidateCommand "xip -x $xcodeXipPath"
90+
if(Test-CommandExists 'unxip') {
91+
Invoke-ValidateCommand "unxip $xcodeXipPath"
92+
} else {
93+
Invoke-ValidateCommand "xip -x $xcodeXipPath"
94+
}
9095
Pop-Location
9196

9297
if (Test-Path "$DownloadDirectory/Xcode-beta.app") {

images/macos/toolsets/toolset-12.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@
202202
"tcl-tk",
203203
"r",
204204
"yq",
205-
"imagemagick"
205+
"imagemagick",
206+
"unxip"
206207
],
207208
"cask_packages": [
208209
"julia",

images/macos/toolsets/toolset-13.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@
7474
"zstd",
7575
"gmp",
7676
"r",
77-
"yq"
77+
"yq",
78+
"unxip"
7879
],
7980
"cask_packages": [
8081
"julia",

0 commit comments

Comments
 (0)