diff --git a/images/macos/helpers/Xcode.Helpers.psm1 b/images/macos/helpers/Xcode.Helpers.psm1 index 6f3dcf730..dbc4803c2 100644 --- a/images/macos/helpers/Xcode.Helpers.psm1 +++ b/images/macos/helpers/Xcode.Helpers.psm1 @@ -91,4 +91,17 @@ function Get-XcodePairsList { $result += "$watchName $phoneName" } return $result +} + +function Test-XcodeStableVersion { + param([Parameter(Mandatory)][string]$Version) + + if ($Version -match "beta") { + return $false + } + if ($Version -match "GM") { + return $false + } + + return $true } \ No newline at end of file diff --git a/images/macos/provision/core/commonutils.sh b/images/macos/provision/core/commonutils.sh index efa4d0160..2f2a18ce5 100644 --- a/images/macos/provision/core/commonutils.sh +++ b/images/macos/provision/core/commonutils.sh @@ -1,15 +1,14 @@ #!/bin/sh - set -e source ~/utils/utils.sh + +# TO-DO: Move the list of brew packages and casks to toolset + # brew install binst_common_utils=( carthage - xctool cmake - bats - parallel subversion go gnupg @@ -27,6 +26,14 @@ binst_common_utils=( aria2 ) +if is_Less_BigSur; then + binst_common_utils+=( + xctool + bats + parallel + ) +fi + for package in ${binst_common_utils[@]}; do echo "Install $package" brew install $package diff --git a/images/macos/provision/core/dotnet.sh b/images/macos/provision/core/dotnet.sh index 4e8f7dfaa..780564881 100755 --- a/images/macos/provision/core/dotnet.sh +++ b/images/macos/provision/core/dotnet.sh @@ -19,7 +19,13 @@ chmod +x ./dotnet-install.sh ARGS_LIST=() echo "Parsing dotnet SDK (except rc and preview versions) from .json..." -if is_Less_Catalina; then +# TO-DO: move the list of versions to install to toolset +if is_BigSur; then + DOTNET_CHANNELS=( + 'https://raw.githubusercontent.com/dotnet/core/master/release-notes/2.1/releases.json' + 'https://raw.githubusercontent.com/dotnet/core/master/release-notes/3.1/releases.json' + ) +elif is_Less_Catalina; then DOTNET_CHANNELS=( 'https://raw.githubusercontent.com/dotnet/core/master/release-notes/2.1/releases.json' ) diff --git a/images/macos/provision/core/node.sh b/images/macos/provision/core/node.sh index f5bb099f7..daf5ea408 100644 --- a/images/macos/provision/core/node.sh +++ b/images/macos/provision/core/node.sh @@ -39,7 +39,9 @@ fi echo Installing yarn... curl -o- -L https://yarnpkg.com/install.sh | bash -for module in ${node_common_modules[@]}; do - echo "Install $module" - npm install -g $module -done +if is_Less_BigSur; then + for module in ${node_common_modules[@]}; do + echo "Install $module" + npm install -g $module + done +fi diff --git a/images/macos/provision/core/openssl.sh b/images/macos/provision/core/openssl.sh index 3b66441c4..0638dccf8 100755 --- a/images/macos/provision/core/openssl.sh +++ b/images/macos/provision/core/openssl.sh @@ -4,7 +4,11 @@ export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH" echo Installing OpenSSL... /usr/local/bin/brew install openssl -/usr/local/bin/brew link openssl --force + +if is_BigSur; then + ln -sf $(brew --prefix openssl)/bin/openssl /usr/local/bin/openssl + exit 0 +fi # Install OpenSSL 1.0.2t # https://www.openssl.org/policies/releasestrat.html - Version 1.0.2 will be supported until 2019-12-31 (LTS) diff --git a/images/macos/provision/core/python.sh b/images/macos/provision/core/python.sh index 05b135e1e..41488642e 100755 --- a/images/macos/provision/core/python.sh +++ b/images/macos/provision/core/python.sh @@ -1,3 +1,6 @@ +#!/bin/sh +source ~/utils/utils.sh + echo "Installing Python Tooling" echo "Brew Installing Python 3" diff --git a/images/macos/provision/core/ruby.sh b/images/macos/provision/core/ruby.sh index 912b00054..19877de3e 100755 --- a/images/macos/provision/core/ruby.sh +++ b/images/macos/provision/core/ruby.sh @@ -2,13 +2,16 @@ set -e -if [ $(id -u) -eq 0 ]; then - echo "This script can not run as root. Aborting..." - exit 1 +source ~/utils/utils.sh + +echo Installing Ruby... +if is_Less_BigSur; then + # We can't install latest ruby 2.7 as a default version related with bug + # https://github.com/fastlane/fastlane/issues/15397 + /usr/local/bin/brew install ruby@2.6 + ln -sf /usr/local/opt/ruby\@2.6 /usr/local/opt/ruby +else + brew install ruby fi -# We can't install latest ruby 2.7 as a default version related with bug -# https://github.com/fastlane/fastlane/issues/15397 -echo Installing Ruby... -/usr/local/bin/brew install ruby@2.6 -ln -sf /usr/local/opt/ruby\@2.6 /usr/local/opt/ruby + diff --git a/images/macos/provision/core/rubygem.sh b/images/macos/provision/core/rubygem.sh index 6872e57e7..83639e472 100755 --- a/images/macos/provision/core/rubygem.sh +++ b/images/macos/provision/core/rubygem.sh @@ -10,14 +10,16 @@ gem install xcode-install --force echo Installing CocoaPods... gem install cocoapods -# fix nomad-cli installation -if is_HighSierra; then - brew install libxml2 - gem install nokogiri -v 1.6.8.1 -- --use-system-libraries --with-xml2-include=$(brew --prefix libxml2)/include/libxml2 -fi +if is_Less_BigSur; then + # fix nomad-cli installation + if is_HighSierra; then + brew install libxml2 + gem install nokogiri -v 1.6.8.1 -- --use-system-libraries --with-xml2-include=$(brew --prefix libxml2)/include/libxml2 + fi -echo Installing nomad-cli... -gem install nomad-cli + echo Installing nomad-cli... + gem install nomad-cli +fi echo Installing xcpretty... gem install xcpretty diff --git a/images/macos/provision/core/xcode-ctl.sh b/images/macos/provision/core/xcode-ctl.sh index 18f352db0..cea7aa633 100644 --- a/images/macos/provision/core/xcode-ctl.sh +++ b/images/macos/provision/core/xcode-ctl.sh @@ -9,7 +9,7 @@ clt_placeholder="/tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress" touch $clt_placeholder clt_label=`/usr/sbin/softwareupdate -l | - grep -B 1 -E 'Command Line Tools' | + grep -B 1 -E 'Command Line Tools beta 5' | awk -F'*' '/^ *\\*/ {print \$2}' | sed -e 's/^ *Label: //' -e 's/^ *//' | sort -V | diff --git a/images/macos/provision/core/xcode-tools.sh b/images/macos/provision/core/xcode-tools.sh index f301a39c4..ef9bf648c 100755 --- a/images/macos/provision/core/xcode-tools.sh +++ b/images/macos/provision/core/xcode-tools.sh @@ -36,7 +36,12 @@ do extractXcodeXip $WORK_DIR "$VERSION_TO_INSTALL" # Remove "beta" postfix from version - XCODE_VERSION=$(echo $XCODE_VERSION | cut -d"_" -f 1) + if [[ $XCODE_VERSION == "12_beta" ]] && is_Catalina ; then + # trick to install Xcode 12 GM and Xcode 12 beta 6 side by side + XCODE_VERSION="12_beta" + else + XCODE_VERSION=$(echo $XCODE_VERSION | cut -d"_" -f 1) + fi echo "Checking if unpacked Xcode ${XCODE_VERSION} is valid" validateXcodeIntegrity "$WORK_DIR" @@ -69,6 +74,13 @@ do continue fi + if [[ $XCODE_VERSION == "12_beta" ]] && is_Catalina ; then + # trick to install Xcode 12 GM and Xcode 12 beta 6 side by side + XCODE_VERSION="12_beta" + else + XCODE_VERSION=$(echo $XCODE_VERSION | cut -d"_" -f 1) + fi + echo "Running 'runFirstLaunch' for Xcode ${XCODE_VERSION}..." runFirstLaunch $XCODE_VERSION done diff --git a/images/macos/provision/utils/xcode-utils.sh b/images/macos/provision/utils/xcode-utils.sh index 9cd795f03..0f7855ec1 100644 --- a/images/macos/provision/utils/xcode-utils.sh +++ b/images/macos/provision/utils/xcode-utils.sh @@ -11,7 +11,7 @@ getXcodeVersionToInstall() { local XCODE_VERSION="$1" if [[ ! $XCODE_VERSION =~ "_beta" ]]; then - echo "$XCODE_VERSION" + echo "${XCODE_VERSION//_/ }" else local XCODE_BETA="${XCODE_VERSION/_/ }" echo "$(xcversion list | sort -r | grep -m 1 "$XCODE_BETA")" @@ -59,7 +59,6 @@ extractXcodeXip() { local WORKING_DIR="$1" local XCODE_VERSION="$2" XCODE_XIP="${WORKING_DIR}/Xcode_${XCODE_VERSION// /_}.xip" - echo "XCODE_XIP = $XCODE_XIP" open -W $XCODE_XIP @@ -75,7 +74,7 @@ extractXcodeXip() { createBetaSymlink() { local XCODE_VERSION=$1 - if [[ $XCODE_VERSION =~ 1[01].* ]] || [[ $XCODE_VERSION == "12" ]] || [[ $XCODE_VERSION == "12_beta" ]]; then + if [[ $XCODE_VERSION =~ 1[01].* ]] || [[ $XCODE_VERSION == "12" ]]; then ln -sf "/Applications/Xcode_${XCODE_VERSION}.app" "/Applications/Xcode_${XCODE_VERSION}_beta.app" fi } \ No newline at end of file diff --git a/images/macos/software-report/SoftwareReport.Common.psm1 b/images/macos/software-report/SoftwareReport.Common.psm1 index cd3cce626..c3fe75171 100644 --- a/images/macos/software-report/SoftwareReport.Common.psm1 +++ b/images/macos/software-report/SoftwareReport.Common.psm1 @@ -58,7 +58,7 @@ function Get-GccVersion { $versionList = @("8", "9") $versionList | Foreach-Object { $version = Run-Command "gcc-${_} --version" | Select-Object -First 1 - "$version — available by ``gcc-${_}`` alias" + "$version - available by ``gcc-${_}`` alias" } } @@ -66,7 +66,7 @@ function Get-FortranVersion { $versionList = @("8", "9") $versionList | Foreach-Object { $version = Run-Command "gfortran-${_} --version" | Select-Object -First 1 - "$version — available by ``gfortran-${_}`` alias" + "$version - available by ``gfortran-${_}`` alias" } } diff --git a/images/macos/software-report/SoftwareReport.Generator.ps1 b/images/macos/software-report/SoftwareReport.Generator.ps1 index 9627e24e1..b8a5283cc 100644 --- a/images/macos/software-report/SoftwareReport.Generator.ps1 +++ b/images/macos/software-report/SoftwareReport.Generator.ps1 @@ -77,7 +77,6 @@ $homebrewVersion = Run-Command "brew --version" | Select-Object -First 1 $npmVersion = Run-Command "npm --version" $yarnVersion = Run-Command "yarn --version" $nugetVersion = Run-Command "nuget help" | Select-Object -First 1 | Take-Part -Part 2 -$pipVersion = Get-PipVersion -Version 2 $pip3Version = Get-PipVersion -Version 3 $condaVersion = Invoke-Expression "conda --version" $rubyGemsVersion = Run-Command "gem --version" @@ -88,7 +87,13 @@ if ($os.IsHigherThanMojave) { $vcpkgVersion = Get-VcpkgVersion $markdown += New-MDList -Lines $vcpkgVersion -Style Unordered -NoNewLine } +if ($os.IsLessThanBigSur) { + $pipVersion = Get-PipVersion -Version 2 + $markdown += New-MDList -Style Unordered -Lines @("Pip ${pipVersion}") -NoNewLine +} + $markdown += New-MDList -Style Unordered -Lines @( + "Pip ${pip3Version}", $bundlerVersion, "Carthage ${carthageVersion}", "CocoaPods ${cocoaPodsVersion}", @@ -96,8 +101,6 @@ $markdown += New-MDList -Style Unordered -Lines @( "NPM ${npmVersion}", "Yarn ${yarnVersion}", "NuGet ${nugetVersion}", - "Pip ${pipVersion}", - "Pip ${pip3Version}", "Mini${condaVersion}", "RubyGems ${rubyGemsVersion}", "Composer ${composerVersion}" @@ -124,7 +127,6 @@ $gitLFSVersion = Run-Command "git-lfs version" | Take-Part -Part 0 | Take-Part - $hubVersion = Run-Command "hub version | grep 'hub version'" | Take-Part -Part 2 $wgetVersion = Run-Command "wget --version" | Select-String "GNU Wget" | Take-Part -Part 2 $svnVersion = Run-Command "svn --version --quiet" -$parallelVersion = Run-Command "parallel --version" | Select-String "GNU parallel" | Select-Object -First 1 $jqVersion = Run-Command "jq --version" | Take-Part -Part 1 -Delimiter "-" $opensslVersion = Get-Item /usr/local/opt/openssl | ForEach-Object {"{0} ``({1} -> {2})``" -f (Run-Command "openssl version"), $_.FullName, $_.Target} $gpgVersion = Run-Command "gpg --version" | Select-String 'gpg (GnuPG)' -SimpleMatch @@ -153,7 +155,6 @@ $markdown += New-MDList -Style Unordered -NoNewLine -Lines @( "GNU Wget ${wgetVersion}", "Subversion (SVN) ${svnVersion}", "Packer $packerVersion", - $parallelVersion, $opensslVersion, "jq ${jqVersion}", $gpgVersion, @@ -173,7 +174,11 @@ $markdown += New-MDList -Style Unordered -NoNewLine -Lines @( ) if ($os.IsHigherThanMojave) { $newmanVersion = Run-Command "newman --version" - $markdown += New-MDList -Lines "Newman $newmanVersion" -Style Unordered + $markdown += New-MDList -Lines "Newman $newmanVersion" -Style Unordered -NoNewLine +} +if ($os.IsLessThanBigSur) { + $parallelVersion = Run-Command "parallel --version" | Select-String "GNU parallel" | Select-Object -First 1 + $markdown += New-MDList -Lines $parallelVersion -Style Unordered } $markdown += New-MDNewLine diff --git a/images/macos/software-report/SoftwareReport.Xcode.psm1 b/images/macos/software-report/SoftwareReport.Xcode.psm1 index d4cda2eb6..59754d583 100644 --- a/images/macos/software-report/SoftwareReport.Xcode.psm1 +++ b/images/macos/software-report/SoftwareReport.Xcode.psm1 @@ -1,3 +1,7 @@ +Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" + +$os = Get-OSVersion + function Get-XcodePaths { $xcodePaths = Get-ChildItemWithoutSymlinks "/Applications" -Filter "Xcode_*.app" return $xcodePaths | Select-Object -ExpandProperty Fullname @@ -43,7 +47,7 @@ function Get-XcodeInfoList { $versionInfo.Path = $xcodeRootPath $versionInfo.IsDefault = ($xcodeRootPath -eq $defaultXcodeRootPath) - $xcodeInfo.Add($versionInfo.Version.ToString(), [PSCustomObject] @{ + $xcodeInfo.Add($xcodeRootPath, [PSCustomObject] @{ VersionInfo = $versionInfo SDKInfo = Get-XcodeSDKList SimulatorsInfo = Get-XcodeSimulatorsInfo @@ -217,20 +221,27 @@ function Build-XcodeSimulatorsTable { } function Build-XcodeSupportToolsSection { - $nomadCLI = Run-Command "gem -v nomad-cli" - $nomadIPA = Run-Command "ipa -version" $xcpretty = Run-Command "xcpretty --version" - $xctool = Run-Command "xctool --version" $xcversion = Run-Command "xcversion --version" | Select-String "^[0-9]" + $toolList = @( + "xcpretty $xcpretty", + "xcversion $xcversion" + ) + + if ($os.IsLessThanBigSur) { + $nomadCLI = Run-Command "gem -v nomad-cli" + $nomadIPA = Run-Command "ipa -version" + $xctool = Run-Command "xctool --version" + $toolList += @( + "Nomad CLI $nomadCLI", + "Nomad CLI IPA $nomadIPA", + "xctool $xctool" + ) + } + $output = "" $output += New-MDHeader "Xcode Support Tools" -Level 4 - $output += New-MDList -Style Unordered -Lines @( - "Nomad CLI $nomadCLI", - "Nomad CLI IPA $nomadIPA", - "xcpretty $xcpretty", - "xctool $xctool", - "xcversion $xcversion" - ) + $output += New-MDList -Style Unordered -Lines $toolList return $output } \ No newline at end of file diff --git a/images/macos/templates/macOS-11.0.json b/images/macos/templates/macOS-11.0.json index 7cf7db8ed..6da9df38d 100644 --- a/images/macos/templates/macOS-11.0.json +++ b/images/macos/templates/macOS-11.0.json @@ -129,6 +129,7 @@ "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", "pause_before": "30s", "scripts": [ + "./provision/core/xcode-ctl.sh", "./provision/core/homebrew.sh", "./provision/core/dotnet.sh", "./provision/core/python.sh", diff --git a/images/macos/tests/Common.Tests.ps1 b/images/macos/tests/Common.Tests.ps1 index ed813f58c..3e61a9a81 100644 --- a/images/macos/tests/Common.Tests.ps1 +++ b/images/macos/tests/Common.Tests.ps1 @@ -94,17 +94,19 @@ Describe "Common utilities" { "aliyun --version" | Should -ReturnZeroExitCode } - It "Mobile Center CLI" { + It "Mobile Center CLI" -Skip:($os.IsBigSur) { "mobile-center --version" | Should -ReturnZeroExitCode } - It "Nomad CLI" { - $result = Get-CommandResult "gem list" - $result.Output | Should -BeLike "*nomad-cli*" - } - - It "Nomad CLI IPA" { - "ipa --version" | Should -ReturnZeroExitCode + Context "Nomad" -Skip:($os.IsBigSur) { + It "Nomad CLI" { + $result = Get-CommandResult "gem list" + $result.Output | Should -BeLike "*nomad-cli*" + } + + It "Nomad CLI IPA" { + "ipa --version" | Should -ReturnZeroExitCode + } } It "Conda" { @@ -129,7 +131,7 @@ Describe "Common utilities" { "curl --version" | Should -ReturnZeroExitCode } - It "xctool" { + It "xctool" -Skip:($os.IsBigSur) { "xctool --version" | Should -ReturnZeroExitCode } diff --git a/images/macos/tests/Python.Tests.ps1 b/images/macos/tests/Python.Tests.ps1 index 7b5f8348d..76cd8941b 100644 --- a/images/macos/tests/Python.Tests.ps1 +++ b/images/macos/tests/Python.Tests.ps1 @@ -1,6 +1,8 @@ Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" +$os = Get-OSVersion + Describe "Python" { It "Python 2 is available" { "python --version" | Should -ReturnZeroExitCode @@ -10,7 +12,7 @@ Describe "Python" { (Get-CommandResult "python --version").Output | Should -BeLike "Python 2.*" } - It "Python 2 is installed under /usr/local/bin" { + It "Python 2 is installed under /usr/local/bin" -Skip:($os.IsBigSur) { Get-WhichTool "python" | Should -BeLike "/usr/local/bin*" } @@ -22,7 +24,7 @@ Describe "Python" { Get-WhichTool "python3" | Should -BeLike "/usr/local/bin*" } - It "Pip 2 is available" { + It "Pip 2 is available" -Skip:($os.IsBigSur) { "pip --version" | Should -ReturnZeroExitCode } diff --git a/images/macos/tests/Xamarin.Tests.ps1 b/images/macos/tests/Xamarin.Tests.ps1 index 5e60f5366..2145f29a7 100644 --- a/images/macos/tests/Xamarin.Tests.ps1 +++ b/images/macos/tests/Xamarin.Tests.ps1 @@ -191,7 +191,7 @@ Describe "Xamarin Bundles" { $XAMARIN_ANDROID_VERSIONS_PATH = "/Library/Frameworks/Xamarin.Android.framework/Versions" } - $XAMARIN_BUNDLES = Get-ToolsetValue "xamarin.bundles" + [array]$XAMARIN_BUNDLES = Get-ToolsetValue "xamarin.bundles" $XAMARIN_DEFAULT_BUNDLE = Get-ToolsetValue "xamarin.bundle-default" If ($XAMARIN_DEFAULT_BUNDLE -eq "latest") { $XAMARIN_DEFAULT_BUNDLE = $XAMARIN_BUNDLES[0].symlink } diff --git a/images/macos/tests/Xcode.Tests.ps1 b/images/macos/tests/Xcode.Tests.ps1 index 543a715db..ff8d5e932 100644 --- a/images/macos/tests/Xcode.Tests.ps1 +++ b/images/macos/tests/Xcode.Tests.ps1 @@ -56,7 +56,7 @@ Describe "Xcode" { } Context "XCODE_DEVELOPER_DIR" { - $stableXcodeVersions = $XCODE_VERSIONS | Where-Object { -not ($_ -match "beta") } + $stableXcodeVersions = $XCODE_VERSIONS | Where-Object { Test-XcodeStableVersion $_ } $majorXcodeVersions = $stableXcodeVersions | ForEach-Object { $_.Split(".")[0] } | Select-Object -Unique $testCases = $majorXcodeVersions | ForEach-Object { $majorXcodeVersion = $_ @@ -84,7 +84,7 @@ Describe "Xcode" { } Describe "Xcode simulators" { - $XCODE_VERSIONS | ForEach-Object { + $XCODE_VERSIONS | Where-Object { Test-XcodeStableVersion $_ } | ForEach-Object { Switch-Xcode -Version $_ Context "$_" { diff --git a/images/macos/toolsets/toolset-10.15.json b/images/macos/toolsets/toolset-10.15.json index c825865c7..e7b17989f 100644 --- a/images/macos/toolsets/toolset-10.15.json +++ b/images/macos/toolsets/toolset-10.15.json @@ -2,11 +2,11 @@ "xcode": { "default": "11.7", "versions": [ - "12_beta", "11.7", "11.6", "11.5", "11.4.1", "11.4", "11.3.1", "11.2.1", "11.1", "11", "10.3" + "12.2_beta", "12", "12_beta", "11.7", "11.6", "11.5", "11.4.1", "11.4", "11.3.1", "11.2.1", "11.1", "11", "10.3" ] }, "xamarin": { - "vsmac": "8.7.5.19", + "vsmac": "8.7.7.10", "mono-versions": [ "6.12.0.93", "6.10.0.106", "6.8.0.123", "6.6.0.166", "6.4.0.208" ], diff --git a/images/macos/toolsets/toolset-11.0.json b/images/macos/toolsets/toolset-11.0.json index bab2c6f92..fa7a65a5a 100644 --- a/images/macos/toolsets/toolset-11.0.json +++ b/images/macos/toolsets/toolset-11.0.json @@ -2,22 +2,22 @@ "xcode": { "default": "11.7", "versions": [ - "12_beta", "11.7" + "12.2_beta", "12_beta", "11.7" ] }, "xamarin": { - "vsmac": "8.7.5.19", + "vsmac": "8.7.7.10", "mono-versions": [ - "6.12.0.93", "6.10.0.106" + "6.12.0.93" ], "ios-versions": [ - "13.20.2.2", "13.18.2.1" + "13.20.2.2" ], "mac-versions": [ - "6.20.2.2", "6.18.3.2" + "6.20.2.2" ], "android-versions": [ - "11.0.2.0", "10.3.1.4" + "11.0.2.0" ], "bundle-default": "latest", "bundles": [ @@ -27,13 +27,6 @@ "ios": "13.20", "mac": "6.20", "android": "11.0" - }, - { - "symlink": "6_10_0", - "mono":"6.10", - "ios": "13.18", - "mac": "6.18", - "android": "10.3" } ] }, @@ -67,9 +60,6 @@ "arch": "x64", "platform" : "darwin", "versions": [ - "2.7.*", - "3.5.*", - "3.6.*", "3.7.*", "3.8.*" ] @@ -91,7 +81,6 @@ "arch": "x64", "platform" : "darwin", "versions": [ - "1.14.*", "1.15.*" ] }