[macOS] Add VSForMac 2022 Preview (#5561)

This commit is contained in:
Aleksandr Chebotov
2022-05-18 16:49:37 +02:00
committed by GitHub
parent 536cfa24b0
commit 82d69fd301
5 changed files with 60 additions and 24 deletions

View File

@@ -2,28 +2,47 @@
source ~/utils/utils.sh
source ~/utils/xamarin-utils.sh
VSMAC_VERSION=$(get_toolset_value '.xamarin.vsmac')
if [ $VSMAC_VERSION == "latest" ]; then
VSMAC_VERSION=$(curl -L "http://aka.ms/manifest/stable" | jq -r ".items[] | select(.genericName==\"VisualStudioMac\").version")
install_vsmac() {
local VSMAC_VERSION=$1
if [ $VSMAC_VERSION == "latest" ]; then
VSMAC_DOWNLOAD_URL=$(curl -sL "https://aka.ms/manifest/stable" | 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
TMPMOUNT=`/usr/bin/mktemp -d /tmp/visualstudio.XXXX`
TMPMOUNT_DOWNLOADS="$TMPMOUNT/downloads"
mkdir $TMPMOUNT_DOWNLOADS
download_with_retries $VSMAC_DOWNLOAD_URL $TMPMOUNT_DOWNLOADS
echo "Mounting Visual Studio..."
VISUAL_STUDIO_NAME=${VSMAC_DOWNLOAD_URL##*/}
hdiutil attach "$TMPMOUNT_DOWNLOADS/$VISUAL_STUDIO_NAME" -mountpoint "$TMPMOUNT"
echo "Moving Visual Studio to /Applications/..."
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"
fi
popd
sudo hdiutil detach "$TMPMOUNT"
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_DOWNLOAD_URL=$(buildVSMacDownloadUrl $VSMAC_VERSION)
TMPMOUNT=`/usr/bin/mktemp -d /tmp/visualstudio.XXXX`
TMPMOUNT_DOWNLOADS="$TMPMOUNT/downloads"
mkdir $TMPMOUNT_DOWNLOADS
download_with_retries $VSMAC_DOWNLOAD_URL $TMPMOUNT_DOWNLOADS
echo "Mounting Visual studio..."
VISUAL_STUDIO_NAME=${VSMAC_DOWNLOAD_URL##*/}
hdiutil attach "$TMPMOUNT_DOWNLOADS/$VISUAL_STUDIO_NAME" -mountpoint "$TMPMOUNT"
echo "Moving Visual Studio to /Applications/..."
pushd $TMPMOUNT
tar cf - "./Visual Studio.app" | tar xf - -C /Applications/
popd
sudo hdiutil detach "$TMPMOUNT"
sudo rm -rf "$TMPMOUNT"
echo "Installing Visual Studio 2019 for Mac Stable"
VSMAC_VERSION_STABLE=$(get_toolset_value '.xamarin.vsmac')
install_vsmac $VSMAC_VERSION_STABLE
invoke_tests "Common" "VSMac"

View File

@@ -242,8 +242,12 @@ $markdown += Build-WebServersSection
# Xamarin section
$markdown += New-MDHeader "Xamarin" -Level 3
$markdown += New-MDHeader "Visual Studio for Mac" -Level 4
$markdown += New-MDList -Lines @(Get-VSMacVersion) -Style Unordered
$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 "Xamarin bundles" -Level 4
$markdown += Build-XamarinTable | New-MDTable

View File

@@ -1,10 +1,15 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
function Get-VSMacVersion {
function Get-VSMac2019Version {
$plistPath = "/Applications/Visual Studio.app/Contents/Info.plist"
return Run-Command "/usr/libexec/PlistBuddy -c 'Print CFBundleVersion' '$plistPath'"
}
function Get-VSMac2022Version {
$plistPath = "/Applications/Visual Studio Preview.app/Contents/Info.plist"
return Run-Command "/usr/libexec/PlistBuddy -c 'Print CFBundleVersion' '$plistPath'"
}
function Get-NUnitVersion {
$version = Run-Command "nunit3-console --version" | Select-Object -First 1 | Take-Part -Part 3
return "NUnit ${version}"

View File

@@ -85,6 +85,13 @@ Describe "VSMac" {
$vsPath | Should -Exist
$vstoolPath | Should -Exist
}
It "VS4Mac Preview is installed" -Skip:(-not $os.IsMonterey) {
$vsPath = "/Applications/Visual Studio Preview.app"
$vstoolPath = Join-Path $vsPath "Contents/MacOS/vstool"
$vsPath | Should -Exist
$vstoolPath | Should -Exist
}
}
Describe "Swig" {

View File

@@ -10,6 +10,7 @@
},
"xamarin": {
"vsmac": "latest",
"vsmac_preview": "preview",
"mono-versions": [
"6.12.0.174"
],