xamarin-macios/tools/common/SdkVersions.cs.in

177 строки
7.7 KiB
C#
Исходник Обычный вид История

2016-04-21 15:58:45 +03:00
using System;
#if MTOUCH || MMP || BUNDLER
2016-04-21 15:58:45 +03:00
using Xamarin.Bundler;
using Xamarin.Utils;
#endif
#if MTOUCH
using MonoTouch;
#endif
2016-04-21 15:58:45 +03:00
namespace Xamarin {
static class SdkVersions {
public const string Xcode = "@XCODE_VERSION@";
public const string OSX = "@MACOS_SDK_VERSION@";
2016-04-21 15:58:45 +03:00
public const string iOS = "@IOS_SDK_VERSION@";
public const string WatchOS = "@WATCHOS_SDK_VERSION@";
public const string TVOS = "@TVOS_SDK_VERSION@";
public const string MacCatalyst = "@MACCATALYST_SDK_VERSION@";
2016-04-21 15:58:45 +03:00
#if NET
public const string MinOSX = "@DOTNET_MIN_MACOS_SDK_VERSION@";
public const string MiniOS = "@DOTNET_MIN_IOS_SDK_VERSION@";
public const string MinWatchOS = "99.99"; // TODO not supported, many changes required to remove it
public const string MinTVOS = "@DOTNET_MIN_TVOS_SDK_VERSION@";
public const string MinMacCatalyst = "@DOTNET_MIN_MACCATALYST_SDK_VERSION@";
#else
public const string MinOSX = "@MIN_MACOS_SDK_VERSION@";
2016-04-21 15:58:45 +03:00
public const string MiniOS = "@MIN_IOS_SDK_VERSION@";
public const string MinWatchOS = "@MIN_WATCHOS_SDK_VERSION@";
public const string MinTVOS = "@MIN_TVOS_SDK_VERSION@";
public const string MinMacCatalyst = "@MIN_MACCATALYST_SDK_VERSION@";
#endif
2016-04-21 15:58:45 +03:00
public const string MiniOSSimulator = "@MIN_IOS_SIMULATOR_VERSION@";
public const string MinWatchOSSimulator = "@MIN_WATCHOS_SIMULATOR_VERSION@";
public const string MinWatchOSCompanionSimulator = "@MIN_WATCHOS_COMPANION_SIMULATOR_VERSION@";
public const string MinTVOSSimulator = "@MIN_TVOS_SIMULATOR_VERSION@";
public const string MaxiOSSimulator = "@MAX_IOS_SIMULATOR_VERSION@";
public const string MaxWatchOSSimulator = "@MAX_WATCH_SIMULATOR_VERSION@";
public const string MaxWatchOSCompanionSimulator = "@MAX_IOS_SIMULATOR_VERSION@";
public const string MaxTVOSSimulator = "@MAX_TVOS_SIMULATOR_VERSION@";
public const string MaxiOSDeploymentTarget = "@MAX_IOS_DEPLOYMENT_TARGET@";
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@";
2016-04-21 15:58:45 +03:00
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); }}
public static Version TVOSVersion { get { return new Version (TVOS); }}
public static Version MacCatalystVersion { get { return new Version (MacCatalyst); }}
2016-04-21 15:58:45 +03:00
public static Version iOSTargetVersion { get { return new Version (MaxiOSDeploymentTarget); }}
public static Version WatchOSTargetVersion { get { return new Version (MaxWatchDeploymentTarget); }}
public static Version TVOSTargetVersion { get { return new Version (MaxTVOSDeploymentTarget); }}
2016-04-21 15:58:45 +03:00
public static Version MinOSXVersion { get { return new Version (MinOSX); }}
public static Version MiniOSVersion { get { return new Version (MiniOS); }}
public static Version MinWatchOSVersion { get { return new Version (MinWatchOS); }}
public static Version MinTVOSVersion { get { return new Version (MinTVOS); }}
public static Version MinMacCatalystVersion { get { return new Version (MinMacCatalyst); }}
2016-04-21 15:58:45 +03:00
public static Version MiniOSSimulatorVersion { get { return new Version (MiniOSSimulator); }}
public static Version MinWatchOSSimulatorVersion { get { return new Version (MinWatchOSSimulator); }}
public static Version MinWatchOSCompanionSimulatorVersion { get { return new Version (MinWatchOSCompanionSimulator); }}
public static Version MinTVOSSimulatorVersion { get { return new Version (MinTVOSSimulator); }}
public static Version MaxiOSSimulatorVersion { get { return new Version (MaxiOSSimulator); }}
public static Version MaxWatchOSSimulatorVersion { get { return new Version (MaxWatchOSSimulator); }}
public static Version MaxWatchOSCompanionSimulatorVersion { get { return new Version (MaxWatchOSCompanionSimulator); }}
public static Version MaxTVOSSimulatorVersion { get { return new Version (MaxTVOSSimulator); }}
2016-04-21 15:58:45 +03:00
public static Version XcodeVersion { get { return new Version (Xcode); }}
#if MTOUCH || MMP || BUNDLER
public static Version GetVersion (Application app)
2016-04-21 15:58:45 +03:00
{
switch (app.Platform) {
2016-04-21 15:58:45 +03:00
case ApplePlatform.MacOSX: return OSXVersion;
case ApplePlatform.iOS: return iOSVersion;
case ApplePlatform.WatchOS: return WatchOSVersion;
case ApplePlatform.TVOS: return TVOSVersion;
case ApplePlatform.MacCatalyst: return MacCatalystVersion;
2016-04-21 15:58:45 +03:00
default:
throw ErrorHelper.CreateError (71, "Unknown platform: {0}. This usually indicates a bug in {1}; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.", app.Platform, app.ProductName);
}
}
public static Version GetTargetVersion (Application app)
{
switch (app.Platform) {
case ApplePlatform.MacOSX: return OSXVersion;
case ApplePlatform.iOS: return iOSTargetVersion;
case ApplePlatform.WatchOS: return WatchOSTargetVersion;
case ApplePlatform.TVOS: return TVOSTargetVersion;
default:
throw ErrorHelper.CreateError (71, "Unknown platform: {0}. This usually indicates a bug in {1}; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.", app.Platform, app.ProductName);
2016-04-21 15:58:45 +03:00
}
}
public static Version GetMinVersion (Application app)
2016-04-21 15:58:45 +03:00
{
switch (app.Platform) {
2016-04-21 15:58:45 +03:00
case ApplePlatform.MacOSX: return MinOSXVersion;
case ApplePlatform.iOS: return MiniOSVersion;
case ApplePlatform.WatchOS: return MinWatchOSVersion;
case ApplePlatform.TVOS: return MinTVOSVersion;
case ApplePlatform.MacCatalyst: return MinMacCatalystVersion;
2016-04-21 15:58:45 +03:00
default:
throw ErrorHelper.CreateError (71, "Unknown platform: {0}. This usually indicates a bug in {1}; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.", app.Platform, app.ProductName);
2016-04-21 15:58:45 +03:00
}
}
#endif
Store the minimum mono version for Xamarin.Mac in one place only (Make.config) and bump it to 5.14. Fixes #4120. (#4695) * Store the minimum mono version for Xamarin.Mac in one place only (Make.config) and bump it to 5.14. Fixes #4120. I've verified that we fail at launch of running on 5.12, while 5.14 works fine (to launch at least), so the minimum system mono version is _at least_ 5.14. Fixes https://github.com/xamarin/xamarin-macios/issues/4120. * [mmp] Load mono's version file instead of using pkg-config to get mono's version. pkg-config will only get three parts of the version, while the version file has all four parts. This is important, since we're now verifying the four parts of the version file, and without loading those four from the system, we'll fail builds like this: error MM0001: This version of Xamarin.Mac requires Mono 5.14.0.136 (the current Mono version is 5.14.0). because the three part version's fourth number is assumed to be 0. * Only verify mono runtime version when running with system/dynamic mono. There should be no need to verify the mono runtime version when embedding mono: * If it's a mono we're shipping, something very bad happened in our build/package for it to be an invalid mono. * If it's a system mono that's being embedded, then we verify in mmp at build time. In the first scenario (a mono we're shipping), the problem is that the mono we've built does not report back the full version number (with four parts) [1], which means we'll fail any check whose requirements are identical for the first three parts, and non-zero for the last. [1] The fourth part of the version number is created/calculated when packaging mono, and we're not packaging it.
2018-08-29 15:28:56 +03:00
}
sealed class ProductConstants {
public string Version;
public string Revision;
public const string Hash = "@PRODUCT_HASH@";
#if BUNDLER
public readonly static ProductConstants iOS = new ProductConstants {
Version = "@IOS_NUGET_VERSION@",
Revision = "@IOS_NUGET_REVISION@",
};
public readonly static ProductConstants tvOS = new ProductConstants {
Version = "@TVOS_NUGET_VERSION@",
Revision = "@TVOS_NUGET_REVISION@",
};
public readonly static ProductConstants watchOS = new ProductConstants {
Version = "@WATCHOS_NUGET_VERSION@",
Revision = "@WATCHOS_NUGET_REVISION@",
};
public readonly static ProductConstants macOS = new ProductConstants {
Version = "@MACOS_NUGET_VERSION@",
Revision = "@MACOS_NUGET_REVISION@",
};
#else
public readonly static ProductConstants iOS = new ProductConstants {
Version = "@IOS_VERSION@",
Revision = "@IOS_REVISION@",
};
public readonly static ProductConstants tvOS = new ProductConstants {
Version = "@TVOS_VERSION@",
Revision = "@TVOS_REVISION@",
};
public readonly static ProductConstants watchOS = new ProductConstants {
Version = "@WATCHOS_VERSION@",
Revision = "@WATCHOS_REVISION@",
};
public readonly static ProductConstants macOS = new ProductConstants {
Version = "@MACOS_VERSION@",
Revision = "@MACOS_REVISION@",
};
#endif
}
Store the minimum mono version for Xamarin.Mac in one place only (Make.config) and bump it to 5.14. Fixes #4120. (#4695) * Store the minimum mono version for Xamarin.Mac in one place only (Make.config) and bump it to 5.14. Fixes #4120. I've verified that we fail at launch of running on 5.12, while 5.14 works fine (to launch at least), so the minimum system mono version is _at least_ 5.14. Fixes https://github.com/xamarin/xamarin-macios/issues/4120. * [mmp] Load mono's version file instead of using pkg-config to get mono's version. pkg-config will only get three parts of the version, while the version file has all four parts. This is important, since we're now verifying the four parts of the version file, and without loading those four from the system, we'll fail builds like this: error MM0001: This version of Xamarin.Mac requires Mono 5.14.0.136 (the current Mono version is 5.14.0). because the three part version's fourth number is assumed to be 0. * Only verify mono runtime version when running with system/dynamic mono. There should be no need to verify the mono runtime version when embedding mono: * If it's a mono we're shipping, something very bad happened in our build/package for it to be an invalid mono. * If it's a system mono that's being embedded, then we verify in mmp at build time. In the first scenario (a mono we're shipping), the problem is that the mono we've built does not report back the full version number (with four parts) [1], which means we'll fail any check whose requirements are identical for the first three parts, and non-zero for the last. [1] The fourth part of the version number is created/calculated when packaging mono, and we're not packaging it.
2018-08-29 15:28:56 +03:00
#if MMP
static class MonoVersions {
public static string MinimumMono = "@MIN_XM_MONO_VERSION@";
public static Version MinimumMonoVersion { get { return new Version (MinimumMono); }}
2016-04-21 15:58:45 +03:00
}
Store the minimum mono version for Xamarin.Mac in one place only (Make.config) and bump it to 5.14. Fixes #4120. (#4695) * Store the minimum mono version for Xamarin.Mac in one place only (Make.config) and bump it to 5.14. Fixes #4120. I've verified that we fail at launch of running on 5.12, while 5.14 works fine (to launch at least), so the minimum system mono version is _at least_ 5.14. Fixes https://github.com/xamarin/xamarin-macios/issues/4120. * [mmp] Load mono's version file instead of using pkg-config to get mono's version. pkg-config will only get three parts of the version, while the version file has all four parts. This is important, since we're now verifying the four parts of the version file, and without loading those four from the system, we'll fail builds like this: error MM0001: This version of Xamarin.Mac requires Mono 5.14.0.136 (the current Mono version is 5.14.0). because the three part version's fourth number is assumed to be 0. * Only verify mono runtime version when running with system/dynamic mono. There should be no need to verify the mono runtime version when embedding mono: * If it's a mono we're shipping, something very bad happened in our build/package for it to be an invalid mono. * If it's a system mono that's being embedded, then we verify in mmp at build time. In the first scenario (a mono we're shipping), the problem is that the mono we've built does not report back the full version number (with four parts) [1], which means we'll fail any check whose requirements are identical for the first three parts, and non-zero for the last. [1] The fourth part of the version number is created/calculated when packaging mono, and we're not packaging it.
2018-08-29 15:28:56 +03:00
#endif
2016-04-21 15:58:45 +03:00
}