mirror of
https://github.com/actions/runner-images.git
synced 2025-12-14 22:05:17 +00:00
[macOS] Set Visual Studio 2022 for Mac by default (#5614)
* Set Visual Studio 2022 for Mac by default * add isDefault
This commit is contained in:
committed by
GitHub
parent
bf4c35eee5
commit
1d519b89d7
@@ -4,14 +4,18 @@ source ~/utils/xamarin-utils.sh
|
||||
|
||||
install_vsmac() {
|
||||
local VSMAC_VERSION=$1
|
||||
if [ $VSMAC_VERSION == "latest" ]; then
|
||||
local VSMAC_DEFAULT=$2
|
||||
if [ $VSMAC_VERSION == "2019" ]; then
|
||||
VSMAC_DOWNLOAD_URL=$(curl -sL "https://aka.ms/manifest/stable" | jq -r '.items[] | select(.genericName=="VisualStudioMac").url')
|
||||
elif [ $VSMAC_VERSION == "2022" ]; then
|
||||
VSMAC_DOWNLOAD_URL=$(curl -sL "https://aka.ms/manifest/stable-2022" | jq -r '.items[] | select(.genericName=="VisualStudioMac").url')
|
||||
elif [ $VSMAC_VERSION == "preview" ]; then
|
||||
VSMAC_DOWNLOAD_URL=$(curl -sL "https://aka.ms/manifest/preview" | jq -r '.items[] | select(.genericName=="VisualStudioMac").url')
|
||||
else
|
||||
VSMAC_DOWNLOAD_URL=$(buildVSMacDownloadUrl $VSMAC_VERSION)
|
||||
fi
|
||||
|
||||
echo "Installing Visual Studio ${VSMAC_VERSION} for Mac"
|
||||
TMPMOUNT=`/usr/bin/mktemp -d /tmp/visualstudio.XXXX`
|
||||
TMPMOUNT_DOWNLOADS="$TMPMOUNT/downloads"
|
||||
mkdir $TMPMOUNT_DOWNLOADS
|
||||
@@ -26,8 +30,8 @@ install_vsmac() {
|
||||
pushd $TMPMOUNT
|
||||
tar cf - "./Visual Studio.app" | tar xf - -C /Applications/
|
||||
|
||||
if [ $VSMAC_VERSION == "preview" ]; then
|
||||
mv "/Applications/Visual Studio.app" "/Applications/Visual Studio Preview.app"
|
||||
if [ $VSMAC_VERSION != $VSMAC_DEFAULT ]; then
|
||||
mv "/Applications/Visual Studio.app" "/Applications/Visual Studio ${VSMAC_VERSION}.app"
|
||||
fi
|
||||
|
||||
popd
|
||||
@@ -35,14 +39,11 @@ install_vsmac() {
|
||||
sudo rm -rf "$TMPMOUNT"
|
||||
}
|
||||
|
||||
VSMAC_VERSION_PREVIEW=$(get_toolset_value '.xamarin.vsmac_preview')
|
||||
if [ $VSMAC_VERSION_PREVIEW != "null" ];then
|
||||
echo "Installing Visual Studio 2022 for Mac Preview"
|
||||
install_vsmac $VSMAC_VERSION_PREVIEW
|
||||
fi
|
||||
VSMAC_VERSIONS=($(get_toolset_value '.xamarin.vsmac.versions[]'))
|
||||
DEFAULT_VSMAC_VERSION=$(get_toolset_value '.xamarin.vsmac.default')
|
||||
|
||||
echo "Installing Visual Studio 2019 for Mac Stable"
|
||||
VSMAC_VERSION_STABLE=$(get_toolset_value '.xamarin.vsmac')
|
||||
install_vsmac $VSMAC_VERSION_STABLE
|
||||
for VERSION in "${VSMAC_VERSIONS[@]}"; do
|
||||
install_vsmac $VERSION $DEFAULT_VSMAC_VERSION
|
||||
done
|
||||
|
||||
invoke_tests "Common" "VSMac"
|
||||
|
||||
@@ -247,12 +247,9 @@ $markdown += Build-WebServersSection
|
||||
|
||||
# Xamarin section
|
||||
$markdown += New-MDHeader "Xamarin" -Level 3
|
||||
$markdown += New-MDHeader "Visual Studio 2019 for Mac" -Level 4
|
||||
$markdown += New-MDList -Lines @(Get-VSMac2019Version) -Style Unordered
|
||||
if ($os.IsMonterey) {
|
||||
$markdown += New-MDHeader "Visual Studio 2022 for Mac" -Level 4
|
||||
$markdown += New-MDList -Lines @(Get-VSMac2022Version) -Style Unordered
|
||||
}
|
||||
$markdown += New-MDHeader "Visual Studio for Mac" -Level 4
|
||||
$markdown += Build-VSMacTable | New-MDTable
|
||||
$markdown += New-MDNewLine
|
||||
|
||||
$markdown += New-MDHeader "Xamarin bundles" -Level 4
|
||||
$markdown += Build-XamarinTable | New-MDTable
|
||||
|
||||
@@ -1,13 +1,26 @@
|
||||
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
|
||||
|
||||
function Get-VSMac2019Version {
|
||||
$plistPath = "/Applications/Visual Studio.app/Contents/Info.plist"
|
||||
return Run-Command "/usr/libexec/PlistBuddy -c 'Print CFBundleVersion' '$plistPath'"
|
||||
}
|
||||
function Build-VSMacTable {
|
||||
$vsMacVersions = Get-ToolsetValue "xamarin.vsmac.versions"
|
||||
$defaultVSMacVersion = Get-ToolsetValue "xamarin.vsmac.default"
|
||||
|
||||
function Get-VSMac2022Version {
|
||||
$plistPath = "/Applications/Visual Studio Preview.app/Contents/Info.plist"
|
||||
return Run-Command "/usr/libexec/PlistBuddy -c 'Print CFBundleVersion' '$plistPath'"
|
||||
$vsMacVersions | ForEach-Object {
|
||||
$isDefault = $_ -eq $defaultVSMacVersion
|
||||
$vsPath = "/Applications/Visual Studio $_.app"
|
||||
if ($isDefault) {
|
||||
$vsPath = "/Applications/Visual Studio.app"
|
||||
}
|
||||
|
||||
$plistPath = "$vsPath/Contents/Info.plist"
|
||||
$build = Run-Command "/usr/libexec/PlistBuddy -c 'Print CFBundleVersion' '$plistPath'"
|
||||
$defaultPostfix = $isDefault ? " (default)" : ""
|
||||
|
||||
[PSCustomObject] @{
|
||||
"Version" = $_ + $defaultPostfix
|
||||
"Build" = $build
|
||||
"Path" = $vsPath
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Get-NUnitVersion {
|
||||
@@ -33,4 +46,3 @@ function Build-XamarinTable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,15 +79,26 @@ Describe "CocoaPods" {
|
||||
}
|
||||
|
||||
Describe "VSMac" {
|
||||
It "VS4Mac is installed" {
|
||||
$vsPath = "/Applications/Visual Studio.app"
|
||||
$vsMacVersions = Get-ToolsetValue "xamarin.vsmac.versions"
|
||||
$defaultVSMacVersion = Get-ToolsetValue "xamarin.vsmac.default"
|
||||
|
||||
$testCases = $vsMacVersions | ForEach-Object {
|
||||
$vsPath = "/Applications/Visual Studio $_.app"
|
||||
if ($_ -eq $defaultVSMacVersion) {
|
||||
$vsPath = "/Applications/Visual Studio.app"
|
||||
}
|
||||
|
||||
@{ vsversion = $_ ; vspath = $vsPath }
|
||||
}
|
||||
|
||||
It "Visual Studio <vsversion> for Mac is installed" -TestCases $testCases {
|
||||
$vstoolPath = Join-Path $vsPath "Contents/MacOS/vstool"
|
||||
$vsPath | Should -Exist
|
||||
$vstoolPath | Should -Exist
|
||||
}
|
||||
|
||||
It "VS4Mac Preview is installed" -Skip:(-not $os.IsMonterey) {
|
||||
$vsPath = "/Applications/Visual Studio Preview.app"
|
||||
It "Visual Studio $defaultVSMacVersion for Mac is default" {
|
||||
$vsPath = "/Applications/Visual Studio.app"
|
||||
$vstoolPath = Join-Path $vsPath "Contents/MacOS/vstool"
|
||||
$vsPath | Should -Exist
|
||||
$vstoolPath | Should -Exist
|
||||
|
||||
@@ -18,7 +18,10 @@
|
||||
]
|
||||
},
|
||||
"xamarin": {
|
||||
"vsmac": "latest",
|
||||
"vsmac": {
|
||||
"default": "2019",
|
||||
"versions": [ "2019" ]
|
||||
},
|
||||
"mono-versions": [
|
||||
"6.12.0.162", "6.10.0.106", "6.8.0.123", "6.6.0.166", "6.4.0.208"
|
||||
],
|
||||
|
||||
@@ -12,7 +12,10 @@
|
||||
]
|
||||
},
|
||||
"xamarin": {
|
||||
"vsmac": "latest",
|
||||
"vsmac": {
|
||||
"default": "2022",
|
||||
"versions": [ "2019", "2022" ]
|
||||
},
|
||||
"mono-versions": [
|
||||
"6.12.0.174"
|
||||
],
|
||||
|
||||
@@ -9,8 +9,10 @@
|
||||
]
|
||||
},
|
||||
"xamarin": {
|
||||
"vsmac": "latest",
|
||||
"vsmac_preview": "preview",
|
||||
"vsmac": {
|
||||
"default": "2022",
|
||||
"versions": [ "2019", "2022" ]
|
||||
},
|
||||
"mono-versions": [
|
||||
"6.12.0.174"
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user