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