diff --git a/images/macos/software-report/SoftwareReport.Generator.ps1 b/images/macos/software-report/SoftwareReport.Generator.ps1 index d7a9bacfc..48130392d 100644 --- a/images/macos/software-report/SoftwareReport.Generator.ps1 +++ b/images/macos/software-report/SoftwareReport.Generator.ps1 @@ -236,17 +236,9 @@ $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 "Mono" -Level 4 -$markdown += New-MDList -Lines (Build-MonoList) -Style Unordered - -$markdown += New-MDHeader "Xamarin.iOS" -Level 4 -$markdown += New-MDList -Lines (Build-XamarinIOSList) -Style Unordered - -$markdown += New-MDHeader "Xamarin.Mac" -Level 4 -$markdown += New-MDList -Lines (Build-XamarinMacList) -Style Unordered - -$markdown += New-MDHeader "Xamarin.Android" -Level 4 -$markdown += New-MDList -Lines (Build-XamarinAndroidList) -Style Unordered +$markdown += New-MDHeader "Xamarin bundles" -Level 4 +$markdown += Build-XamarinTable | New-MDTable +$markdown += New-MDNewLine $markdown += New-MDHeader "Unit Test Framework" -Level 4 $markdown += New-MDList -Lines @(Get-NUnitVersion) -Style Unordered diff --git a/images/macos/software-report/SoftwareReport.Xamarin.psm1 b/images/macos/software-report/SoftwareReport.Xamarin.psm1 index de1eca6cd..2bd1b5476 100644 --- a/images/macos/software-report/SoftwareReport.Xamarin.psm1 +++ b/images/macos/software-report/SoftwareReport.Xamarin.psm1 @@ -1,7 +1,4 @@ -$sortRulesByVersion = @{ - Expression = { [System.Version]::Parse($_) } - Descending = $true -} +Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" function Get-VSMacVersion { $plistPath = "/Applications/Visual Studio.app/Contents/Info.plist" @@ -13,66 +10,22 @@ function Get-NUnitVersion { return "NUnit ${version}" } -function Build-MonoList { - $monoVersionsPath = "/Library/Frameworks/Mono.framework/Versions" - $monoFolders = Get-ChildItemWithoutSymlinks $monoVersionsPath +function Build-XamarinTable { + $xamarinBundles = Get-ToolsetValue "xamarin.bundles" + $defaultSymlink = Get-ToolsetValue "xamarin.bundle-default" + if ($defaultSymlink -eq "latest") { + $defaultSymlink = $xamarinBundles[0].symlink + } - $monoVersionList = $monoFolders | ForEach-Object { - $versionFilePath = Join-Path $_.FullName "Version" - if (Test-Path $versionFilePath) { - return Get-Content -Raw $versionFilePath + return $xamarinBundles | ForEach-Object { + $defaultPostfix = ($_.symlink -eq $defaultSymlink ) ? " (default)" : "" + [PSCustomObject] @{ + "symlink" = $_.symlink + $defaultPostfix + "Xamarin.Mono" = $_.mono + "Xamarin.iOS" = $_.ios + "Xamarin.Mac" = $_.mac + "Xamarin.Android" = $_.android } - - return $_.Name - } | ForEach-Object { $_.Trim() } - - return $monoVersionList | Sort-Object -Property $sortRulesByVersion + } } -function Build-XamarinIOSList { - $sdkVersionsPath = "/Library/Frameworks/Xamarin.iOS.framework/Versions" - $sdkFolders = Get-ChildItemWithoutSymlinks $sdkVersionsPath - - $sdkVersionList = $sdkFolders | ForEach-Object { - $versionFilePath = Join-Path $_.FullName "Version" - if (Test-Path $versionFilePath) { - return Get-Content -Raw $versionFilePath - } - - return $_.Name - } | ForEach-Object { $_.Trim() } - - return $sdkVersionList | Sort-Object -Property $sortRulesByVersion -} - -function Build-XamarinMacList { - $sdkVersionsPath = "/Library/Frameworks/Xamarin.Mac.framework/Versions" - $sdkFolders = Get-ChildItemWithoutSymlinks $sdkVersionsPath - - $sdkVersionList = $sdkFolders | ForEach-Object { - $versionFilePath = Join-Path $_.FullName "Version" - if (Test-Path $versionFilePath) { - return Get-Content -Raw $versionFilePath - } - - return $_.Name - } | ForEach-Object { $_.Trim() } - - return $sdkVersionList | Sort-Object -Property $sortRulesByVersion -} - -function Build-XamarinAndroidList { - $sdkVersionsPath = "/Library/Frameworks/Xamarin.Android.framework/Versions" - $sdkFolders = Get-ChildItemWithoutSymlinks $sdkVersionsPath - - $sdkVersionList = $sdkFolders | ForEach-Object { - $versionFilePath = Join-Path $_.FullName "Version" - if (Test-Path $versionFilePath) { - return Get-Content -Raw $versionFilePath - } - - return $_.Name - } | ForEach-Object { $_.Trim() } - - return $sdkVersionList | Sort-Object -Property $sortRulesByVersion -} \ No newline at end of file