diff --git a/images/macos/helpers/Common.Helpers.psm1 b/images/macos/helpers/Common.Helpers.psm1 index 1c14ab3a..e71aa765 100644 --- a/images/macos/helpers/Common.Helpers.psm1 +++ b/images/macos/helpers/Common.Helpers.psm1 @@ -84,7 +84,7 @@ function Invoke-RestMethodWithRetry { Invoke-RestMethod $Url -MaximumRetryCount 10 -RetryIntervalSec 30 } -function Invoke-ExpressionWithValidation { +function Invoke-ValidateCommand { param( [Parameter(Mandatory)] [string]$Command diff --git a/images/macos/helpers/Xcode.Installer.psm1 b/images/macos/helpers/Xcode.Installer.psm1 index 59968b2b..37b48c5b 100644 --- a/images/macos/helpers/Xcode.Installer.psm1 +++ b/images/macos/helpers/Xcode.Installer.psm1 @@ -30,7 +30,7 @@ function Invoke-DownloadXcodeArchive { # TO-DO: Consider replacing of xcversion with own implementation Write-Host "Downloading Xcode $resolvedVersion" - Invoke-ExpressionWithValidation "xcversion install '$resolvedVersion' --no-install" + Invoke-ValidateCommand "xcversion install '$resolvedVersion' --no-install" } function Resolve-ExactXcodeVersion { @@ -85,7 +85,7 @@ function Expand-XcodeXipArchive { Write-Host "Extracting Xcode from '$xcodeXipPath'" Push-Location $DownloadDirectory - Invoke-ExpressionWithValidation "xip -x $xcodeXipPath" + Invoke-ValidateCommand "xip -x $xcodeXipPath" Pop-Location if (Test-Path "$DownloadDirectory/Xcode-beta.app") { @@ -110,7 +110,7 @@ function Confirm-XcodeIntegrity { $XcodeRootPath = Get-XcodeRootPath -Version $Version if (Test-XcodeStableRelease -XcodeRootPath $XcodeRootPath) { Write-Host "Validating Xcode integrity for '$XcodeRootPath'..." - Invoke-ExpressionWithValidation "spctl --assess --raw $XcodeRootPath" + Invoke-ValidateCommand "spctl --assess --raw $XcodeRootPath" } } @@ -123,7 +123,7 @@ function Approve-XcodeLicense { $XcodeRootPath = Get-XcodeRootPath -Version $Version Write-Host "Approving Xcode license for '$XcodeRootPath'..." $xcodeBuildPath = Get-XcodeToolPath -XcodeRootPath $XcodeRootPath -ToolName "xcodebuild" - Invoke-ExpressionWithValidation "sudo $xcodeBuildPath -license accept" + Invoke-ValidateCommand "sudo $xcodeBuildPath -license accept" } function Install-XcodeAdditionalPackages { @@ -136,7 +136,7 @@ function Install-XcodeAdditionalPackages { $xcodeRootPath = Get-XcodeRootPath -Version $Version $packages = Get-ChildItem -Path "$xcodeRootPath/Contents/Resources/Packages" -Filter "*.pkg" -File $packages | ForEach-Object { - Invoke-ExpressionWithValidation "sudo installer -pkg $($_.FullName) -target / -allowUntrusted" + Invoke-ValidateCommand "sudo installer -pkg $($_.FullName) -target / -allowUntrusted" } } @@ -152,7 +152,7 @@ function Invoke-XcodeRunFirstLaunch { Write-Host "Running 'runFirstLaunch' for Xcode $Version..." $xcodeRootPath = Get-XcodeToolPath -Version $Version -ToolName "xcodebuild" - Invoke-ExpressionWithValidation "sudo $xcodeRootPath -runFirstLaunch" + Invoke-ValidateCommand "sudo $xcodeRootPath -runFirstLaunch" } function Build-XcodeSymlinks { diff --git a/images/macos/provision/core/xcode.ps1 b/images/macos/provision/core/xcode.ps1 index 19f4d3c7..46f11518 100644 --- a/images/macos/provision/core/xcode.ps1 +++ b/images/macos/provision/core/xcode.ps1 @@ -1,8 +1,6 @@ # The script currently requires 2 external variables to be set: XCODE_INSTALL_USER # and XCODE_INSTALL_PASSWORD, in order to access the Apple Developer Center -Write-Host "Script begin" - $ErrorActionPreference = "Stop" Import-Module "$env:HOME/image-generation/helpers/Common.Helpers.psm1" diff --git a/images/macos/toolsets/toolset-10.13.json b/images/macos/toolsets/toolset-10.13.json index c828c198..797a83e6 100644 --- a/images/macos/toolsets/toolset-10.13.json +++ b/images/macos/toolsets/toolset-10.13.json @@ -2,19 +2,19 @@ "xcode": { "default": "10.1", "versions": [ - { "link": "10.1", "version": "10.1.0", "symlinks": [ "10.1_beta"] }, - { "link": "10", "version": "10.0.0", "symlinks": [ "10_beta"] }, - { "link": "9.4.1", "version": "9.4.1", "symlinks": [ "9.4.1_beta"] }, - { "link": "9.4", "version": "9.4.0", "symlinks": [ "9.4_beta"] }, - { "link": "9.3.1", "version": "9.3.1", "symlinks": [ "9.3.1_beta"] }, - { "link": "9.3", "version": "9.3.0", "symlinks": [ "9.3_beta"] }, - { "link": "9.2", "version": "9.2.0", "symlinks": [ "9.2_beta"] }, - { "link": "9.1", "version": "9.1.0", "symlinks": [ "9.1_beta"] }, - { "link": "9", "version": "9.0.0", "symlinks": [ "9_beta"] }, - { "link": "8.3.3", "version": "8.3.3", "symlinks": [ "8.3.3_beta"] }, - { "link": "8.2.1", "version": "8.2.1", "symlinks": [ "8.2.1_beta"] }, - { "link": "8.1", "version": "8.1.0", "symlinks": [ "8.1_beta"] }, - { "link": "8", "version": "8.0.0", "symlinks": [ "8_beta"] } + { "link": "10.1", "version": "10.1.0", "symlinks": ["10.1_beta"] }, + { "link": "10", "version": "10.0.0", "symlinks": ["10_beta"] }, + { "link": "9.4.1", "version": "9.4.1", "symlinks": ["9.4.1_beta"] }, + { "link": "9.4", "version": "9.4.0", "symlinks": ["9.4_beta"] }, + { "link": "9.3.1", "version": "9.3.1", "symlinks": ["9.3.1_beta"] }, + { "link": "9.3", "version": "9.3.0", "symlinks": ["9.3_beta"] }, + { "link": "9.2", "version": "9.2.0", "symlinks": ["9.2_beta"] }, + { "link": "9.1", "version": "9.1.0", "symlinks": ["9.1_beta"] }, + { "link": "9", "version": "9.0.0", "symlinks": ["9_beta"] }, + { "link": "8.3.3", "version": "8.3.3", "symlinks": ["8.3.3_beta"] }, + { "link": "8.2.1", "version": "8.2.1", "symlinks": ["8.2.1_beta"] }, + { "link": "8.1", "version": "8.1.0", "symlinks": ["8.1_beta"] }, + { "link": "8", "version": "8.0.0", "symlinks": ["8_beta"] } ] }, "xamarin": {