From 5837d5a1e071e5a728c95e0f1fdf52db419020ef Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 23 Sep 2022 14:08:40 +0200 Subject: [PATCH] [tests] Update tests to cope with a different default platform than the latest version. (#16063) --- .../UnitTests/ApplePlatformExtensions.cs | 21 +++++++++++++++---- tools/common/Make.common | 6 ++++++ tools/common/SdkVersions.cs.in | 5 +++++ 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/tests/dotnet/UnitTests/ApplePlatformExtensions.cs b/tests/dotnet/UnitTests/ApplePlatformExtensions.cs index 6f9373f2a2..2c2e359e85 100644 --- a/tests/dotnet/UnitTests/ApplePlatformExtensions.cs +++ b/tests/dotnet/UnitTests/ApplePlatformExtensions.cs @@ -5,15 +5,28 @@ namespace Xamarin.Utils { public static string ToFrameworkWithDefaultVersion (this ApplePlatform @this) { var netVersion = Configuration.DotNetTfm; + var defaultTargetPlatformVersion = GetDefaultTargetPlatformVersion (@this); switch (@this) { case ApplePlatform.iOS: - return netVersion + "-ios" + SdkVersions.iOS; + return netVersion + "-ios" + defaultTargetPlatformVersion; case ApplePlatform.MacOSX: - return netVersion + "-macos" + SdkVersions.OSX; + return netVersion + "-macos" + defaultTargetPlatformVersion; case ApplePlatform.TVOS: - return netVersion + "-tvos" + SdkVersions.TVOS; + return netVersion + "-tvos" + defaultTargetPlatformVersion; case ApplePlatform.MacCatalyst: - return netVersion + "-maccatalyst" + SdkVersions.MacCatalyst; + return netVersion + "-maccatalyst" + defaultTargetPlatformVersion; + default: + return "Unknown"; + } + } + + public static string GetDefaultTargetPlatformVersion (this ApplePlatform @this) + { + switch (@this) { + case ApplePlatform.iOS: return SdkVersions.DefaultTargetPlatformVersioniOS; + case ApplePlatform.TVOS: return SdkVersions.DefaultTargetPlatformVersiontvOS; + case ApplePlatform.MacOSX: return SdkVersions.DefaultTargetPlatformVersionmacOS; + case ApplePlatform.MacCatalyst: return SdkVersions.DefaultTargetPlatformVersionMacCatalyst; default: return "Unknown"; } diff --git a/tools/common/Make.common b/tools/common/Make.common index 624c316f13..91b6cacf20 100644 --- a/tools/common/Make.common +++ b/tools/common/Make.common @@ -47,6 +47,12 @@ -e 's/@MACOS_REVISION@/$(MAC_COMMIT_DISTANCE) ($(CURRENT_BRANCH_SED_ESCAPED): $(CURRENT_HASH))/g' \ -e "s/@MACOS_NUGET_VERSION@/$(MACOS_NUGET_VERSION)/g" \ -e "s/@MACOS_NUGET_REVISION@/$(NUGET_PRERELEASE_IDENTIFIER)$(MACOS_NUGET_COMMIT_DISTANCE)+$(NUGET_BUILD_METADATA)/g" \ + \ + -e "s/@DEFAULT_TARGET_PLATFORM_VERSION_IOS@/$(DEFAULT_TARGET_PLATFORM_VERSION_IOS)/g" \ + -e "s/@DEFAULT_TARGET_PLATFORM_VERSION_TVOS@/$(DEFAULT_TARGET_PLATFORM_VERSION_TVOS)/g" \ + -e "s/@DEFAULT_TARGET_PLATFORM_VERSION_MACOS@/$(DEFAULT_TARGET_PLATFORM_VERSION_MACOS)/g" \ + -e "s/@DEFAULT_TARGET_PLATFORM_VERSION_MACCATALYST@/$(DEFAULT_TARGET_PLATFORM_VERSION_MACCATALYST)/g" \ + \ $< > $@ diff --git a/tools/common/SdkVersions.cs.in b/tools/common/SdkVersions.cs.in index d8fccc6279..8682d2bb4b 100644 --- a/tools/common/SdkVersions.cs.in +++ b/tools/common/SdkVersions.cs.in @@ -46,6 +46,11 @@ namespace Xamarin { public const string MaxWatchDeploymentTarget = "@MAX_WATCH_DEPLOYMENT_TARGET@"; public const string MaxTVOSDeploymentTarget = "@MAX_TVOS_DEPLOYMENT_TARGET@"; + public const string DefaultTargetPlatformVersioniOS = "@DEFAULT_TARGET_PLATFORM_VERSION_IOS@"; + public const string DefaultTargetPlatformVersiontvOS = "@DEFAULT_TARGET_PLATFORM_VERSION_TVOS@"; + public const string DefaultTargetPlatformVersionmacOS = "@DEFAULT_TARGET_PLATFORM_VERSION_MACOS@"; + public const string DefaultTargetPlatformVersionMacCatalyst = "@DEFAULT_TARGET_PLATFORM_VERSION_MACCATALYST@"; + public static Version OSXVersion { get { return new Version (OSX); }} public static Version iOSVersion { get { return new Version (iOS); }} public static Version WatchOSVersion { get { return new Version (WatchOS); }}