Skip to content

Commit

Permalink
Merge main into net8.0. (xamarin#17102)
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfbjarne authored Dec 22, 2022
2 parents aebab1c + cbf58c8 commit 7ccec76
Show file tree
Hide file tree
Showing 61 changed files with 14,299 additions and 13,989 deletions.
6 changes: 3 additions & 3 deletions Make.config
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ MACCATALYST_NUGET_VERSION_NO_METADATA=$(MACCATALYST_NUGET_VERSION)$(NUGET_PREREL
MACCATALYST_NUGET_VERSION_FULL=$(MACCATALYST_NUGET_VERSION_NO_METADATA)+$(NUGET_BUILD_METADATA)

# Xcode version should have both a major and a minor version (even if the minor version is 0)
XCODE_VERSION=14.1
XCODE_URL=https://dl.internalx.com/internal-files/xcodes/Xcode_14.1.xip
XCODE_DEVELOPER_ROOT=/Applications/Xcode_14.1.0.app/Contents/Developer
XCODE_VERSION=14.2
XCODE_URL=https://dl.internalx.com/internal-files/xcodes/Xcode_14.2.xip
XCODE_DEVELOPER_ROOT=/Applications/Xcode_14.2.0.app/Contents/Developer
XCODE_PRODUCT_BUILD_VERSION:=$(shell /usr/libexec/PlistBuddy -c 'Print :ProductBuildVersion' $(XCODE_DEVELOPER_ROOT)/../version.plist 2>/dev/null || echo " $(shell tput setaf 1 2>/dev/null)The required Xcode ($(XCODE_VERSION)) is not installed in $(basename $(basename $(XCODE_DEVELOPER_ROOT)))$(shell tput sgr0 2>/dev/null)" >&2)

# Tell both Xcode and our build logic which Xcode we're using.
Expand Down
10 changes: 5 additions & 5 deletions Make.versions
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
# line changed in git).
#

IOS_PACKAGE_VERSION=16.1.1.$(IOS_COMMIT_DISTANCE)
MAC_PACKAGE_VERSION=9.0.0.$(MAC_COMMIT_DISTANCE)
IOS_PACKAGE_VERSION=16.2.1.$(IOS_COMMIT_DISTANCE)
MAC_PACKAGE_VERSION=9.1.1.$(MAC_COMMIT_DISTANCE)

#
# ** NuGet package version numbers **
Expand All @@ -65,11 +65,11 @@ MAC_PACKAGE_VERSION=9.0.0.$(MAC_COMMIT_DISTANCE)

# WARNING: Do **not** use versions higher than the available Xcode SDK or else we will have issues with mtouch (See https://github.com/xamarin/xamarin-macios/issues/7705)

IOS_NUGET_OS_VERSION=16.1
IOS_NUGET_OS_VERSION=16.2
TVOS_NUGET_OS_VERSION=16.1
WATCHOS_NUGET_OS_VERSION=9.1
MACOS_NUGET_OS_VERSION=13.0
MACCATALYST_NUGET_OS_VERSION=16.1
MACOS_NUGET_OS_VERSION=13.1
MACCATALYST_NUGET_OS_VERSION=16.2


# Defines the default platform version if it's not specified in the TFM. The default should not change for a given .NET version:
Expand Down
4 changes: 4 additions & 0 deletions Versions-ios.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<string>15.4</string>
<string>16.0</string>
<string>16.1</string>
<string>16.2</string>
</array>
<key>tvOS</key>
<array>
Expand Down Expand Up @@ -130,6 +131,7 @@
<string>15.2</string>
<string>15.4</string>
<string>16.1</string>
<string>16.2</string>
</array>
</dict>
<key>MacCatalystVersionMap</key>
Expand Down Expand Up @@ -160,6 +162,8 @@
<string>12.3</string>
<key>16.1</key>
<string>13.0</string>
<key>16.2</key>
<string>13.1</string>
</dict>
<key>RecommendedXcodeVersion</key>
<string>@XCODE_VERSION@</string>
Expand Down
1 change: 1 addition & 0 deletions Versions-mac.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<string>12.1</string>
<string>12.3</string>
<string>13.0</string>
<string>13.1</string>
</array>
</dict>
<key>RecommendedXcodeVersion</key>
Expand Down
2 changes: 2 additions & 0 deletions src/AppKit/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -630,10 +630,12 @@ public enum NSKey : ulong {
CapsLock = 0x39,
Option = 0x3A,
Control = 0x3B,
RightCommand = 0x36,
RightShift = 0x3C,
RightOption = 0x3D,
RightControl = 0x3E,
Function = 0x3F,
F17 = 0x40,
VolumeUp = 0x48,
VolumeDown = 0x49,
Mute = 0x4A,
Expand Down
2 changes: 2 additions & 0 deletions src/BusinessChat/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public enum BCChatButtonStyle : long {
Dark,
}

[Deprecated (PlatformName.MacOSX, 13, 1)]
[Deprecated (PlatformName.iOS, 16, 2)]
[Mac (10, 13, 4), iOS (11, 3)]
public enum BCParameterName {

Expand Down
2 changes: 2 additions & 0 deletions src/Foundation/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Foundation {

#if !XAMCORE_5_0
// Utility enum, ObjC uses NSString
public enum NSDocumentType {
Unknown = -1,
Expand All @@ -23,6 +24,7 @@ public enum NSDocumentType {
[NoiOS, NoTV, NoWatch, NoMacCatalyst]
OpenDocument,
}
#endif // !XAMCORE_5_0

// Utility enum, ObjC uses NSString
public enum NSDocumentViewMode {
Expand Down
79 changes: 14 additions & 65 deletions src/Foundation/NSAttributedStringDocumentAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,78 +87,27 @@ public NSString? WeakDocumentType {
}
}

public NSDocumentType DocumentType {
#if XAMCORE_5_0
public NSAttributedStringDocumentType DocumentType {
get {
var s = WeakDocumentType;

if (s == NSAttributedStringDocumentType.NSPlainTextDocumentType)
return NSDocumentType.PlainText;
if (s == NSAttributedStringDocumentType.NSRtfdTextDocumentType)
return NSDocumentType.RTFD;
if (s == NSAttributedStringDocumentType.NSRtfTextDocumentType)
return NSDocumentType.RTF;
if (s == NSAttributedStringDocumentType.NSHtmlTextDocumentType)
return NSDocumentType.HTML;

#if __MACOS__
if (s == NSAttributedStringDocumentType.NSMacSimpleTextDocumentType)
return NSDocumentType.MacSimpleText;
if (s == NSAttributedStringDocumentType.NSDocFormatTextDocumentType)
return NSDocumentType.DocFormat;
if (s == NSAttributedStringDocumentType.NSWordMLTextDocumentType)
return NSDocumentType.WordML;
if (s == NSAttributedStringDocumentType.NSWebArchiveTextDocumentType)
return NSDocumentType.WebArchive;
if (s == NSAttributedStringDocumentType.NSOfficeOpenXMLTextDocumentType)
return NSDocumentType.OfficeOpenXml;
if (s == NSAttributedStringDocumentType.NSOpenDocumentTextDocumentType)
return NSDocumentType.OpenDocument;
#endif // __MACOS__

return NSDocumentType.Unknown;
return NSAttributedStringDocumentTypeExtensions.GetValue (WeakDocumentType);
}
set {
WeakDocumentType = value.GetConstant ();
}
}
#else
public NSDocumentType DocumentType {
get {

return (NSDocumentType) NSAttributedStringDocumentTypeExtensions.GetValue (WeakDocumentType);
}
set {
NSString? documentType = null;
switch (value) {
case NSDocumentType.PlainText:
documentType = NSAttributedStringDocumentType.NSPlainTextDocumentType;
break;
case NSDocumentType.RTFD:
documentType = NSAttributedStringDocumentType.NSRtfdTextDocumentType;
break;
case NSDocumentType.RTF:
documentType = NSAttributedStringDocumentType.NSRtfTextDocumentType;
break;
case NSDocumentType.HTML:
documentType = NSAttributedStringDocumentType.NSHtmlTextDocumentType;
break;
#if __MACOS__
case NSDocumentType.MacSimpleText:
documentType = NSAttributedStringDocumentType.NSMacSimpleTextDocumentType;
break;
case NSDocumentType.DocFormat:
documentType = NSAttributedStringDocumentType.NSDocFormatTextDocumentType;
break;
case NSDocumentType.WordML:
documentType = NSAttributedStringDocumentType.NSWordMLTextDocumentType;
break;
case NSDocumentType.WebArchive:
documentType = NSAttributedStringDocumentType.NSWebArchiveTextDocumentType;
break;
case NSDocumentType.OfficeOpenXml:
documentType = NSAttributedStringDocumentType.NSOfficeOpenXMLTextDocumentType;
break;
case NSDocumentType.OpenDocument:
documentType = NSAttributedStringDocumentType.NSOpenDocumentTextDocumentType;
break;
#endif // __MACOS__
}

if (documentType is not null)
WeakDocumentType = documentType;
WeakDocumentType = ((NSAttributedStringDocumentType) value).GetConstant ();
}
}
#endif // !XAMCORE_5_0

public NSDictionary? WeakDefaultAttributes {
get {
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1638,7 +1638,7 @@ endif

project-files: $(PROJECT_FILES)

$(TOP)/tools/common/SdkVersions.cs: $(TOP)/tools/common/SdkVersions.cs.in
$(TOP)/tools/common/SdkVersions.cs: $(TOP)/tools/common/SdkVersions.in.cs
@$(MAKE) -C $(TOP)/tools/mtouch ../common/SdkVersions.cs

COMMA=,
Expand Down
2 changes: 1 addition & 1 deletion src/Security/Items.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1411,7 +1411,7 @@ public bool PersistentReference {
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
[SupportedOSPlatform ("maccatalyst13.1")]
[SupportedOSPlatform ("maccatalyst")]
#else
[iOS (13, 0)]
[TV (13, 0)]
Expand Down
2 changes: 1 addition & 1 deletion src/Security/SslContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ public SslClientCertificateState ClientCertificateState {
[UnsupportedOSPlatform ("tvos13.0")]
[UnsupportedOSPlatform ("ios9.0")]
[ObsoletedOSPlatform ("macos10.11", "Export ciphers are not available anymore.")]
[ObsoletedOSPlatform ("tvos13.0", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Export ciphers are not available anymore.")]
[ObsoletedOSPlatform ("ios9.0", "Export ciphers are not available anymore.")]
#else
[Deprecated (PlatformName.iOS, 9, 0, message: "Export ciphers are not available anymore.")]
Expand Down
2 changes: 1 addition & 1 deletion src/UIKit/NSLayoutManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public unsafe void ShowCGGlyphs (
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst13.1")]
[SupportedOSPlatform ("maccatalyst")]
#else
[Watch (6, 0)]
[TV (13, 0)]
Expand Down
2 changes: 1 addition & 1 deletion src/XKit/Types.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace UIKit {
#if NET
[SupportedOSPlatform ("tvos11.0")]
[SupportedOSPlatform ("ios11.0")]
[SupportedOSPlatform ("maccatalyst13.1")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos10.15")]
#else
[Watch (4, 0)]
Expand Down
4 changes: 4 additions & 0 deletions src/businesschat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

namespace BusinessChat {

[Deprecated (PlatformName.MacOSX, 13, 1)]
[Deprecated (PlatformName.iOS, 16, 2)]
[Mac (10, 13, 4), iOS (11, 3)]
[BaseType (typeof (UIControl))]
[DisableDefaultCtor]
Expand All @@ -34,6 +36,8 @@ interface BCChatButton {
}


[Deprecated (PlatformName.MacOSX, 13, 1)]
[Deprecated (PlatformName.iOS, 16, 2)]
[Mac (10, 13, 4), iOS (11, 3)]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
Expand Down
8 changes: 8 additions & 0 deletions src/gamekit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1360,6 +1360,14 @@ interface GKMatchmaker {
[iOS (8, 0), Mac (10, 10)]
[Export ("startBrowsingForNearbyPlayersWithHandler:")]
void StartBrowsingForNearbyPlayers ([NullAllowed] Action<GKPlayer, bool> handler);

[Mac (13, 1), iOS (16, 2), NoTV]
[Export ("startGroupActivityWithPlayerHandler:")]
void StartGroupActivity (Action<GKPlayer> handler);

[Mac (13, 1), iOS (16, 2), NoTV]
[Export ("stopGroupActivity")]
void StopGroupActivity ();
}

[NoWatch]
Expand Down
7 changes: 7 additions & 0 deletions src/generator-attributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,13 @@ void GenerateDeprecated (StringBuilder builder)

void GenerateSupported (StringBuilder builder)
{
#if BGENERATOR
// If the version is less than or equal to the min version for the platform in question,
// the version is redundant, so just skip it.
if (Version is not null && Version <= Xamarin.SdkVersions.GetMinVersion (Generator.AsApplePlatform (Platform)))
Version = null;
#endif

builder.Append ("[SupportedOSPlatform (\"");
GeneratePlatformNameAndVersion (builder);
builder.AppendLine ("\")]");
Expand Down
6 changes: 4 additions & 2 deletions src/generator-enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ void GenerateEnum (Type type)
Tuple<FieldInfo, FieldAttribute> null_field = null;
Tuple<FieldInfo, FieldAttribute> default_symbol = null;
var underlying_type = GetCSharpTypeName (TypeManager.GetUnderlyingEnumType (type));
print ("{0} enum {1} : {2} {{", AttributeManager.HasAttribute<InternalAttribute> (type) ? "internal" : "public", type.Name, underlying_type);
var is_internal = AttributeManager.HasAttribute<InternalAttribute> (type);
var visibility = is_internal ? "internal" : "public";
print ("{0} enum {1} : {2} {{", visibility, type.Name, underlying_type);
indent++;
foreach (var f in type.GetFields ()) {
// skip value__ field
Expand Down Expand Up @@ -126,7 +128,7 @@ void GenerateEnum (Type type)
// the *Extensions has the same version requirement as the enum itself
PrintPlatformAttributes (type);
print_generated_code ();
print ("static public partial class {0}Extensions {{", type.Name);
print ("static {1} partial class {0}Extensions {{", type.Name, visibility);
indent++;

var field = fields.FirstOrDefault ();
Expand Down
38 changes: 31 additions & 7 deletions src/generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3397,6 +3397,26 @@ bool FilterMinimumVersion (AvailabilityBaseAttribute aa)
#endif
}

public static ApplePlatform AsApplePlatform (PlatformName platform)
{
switch (platform) {
case PlatformName.iOS:
return ApplePlatform.iOS;
case PlatformName.TvOS:
return ApplePlatform.TVOS;
case PlatformName.MacCatalyst:
return ApplePlatform.MacCatalyst;
case PlatformName.MacOSX:
return ApplePlatform.MacOSX;
case PlatformName.WatchOS:
return ApplePlatform.WatchOS;
case PlatformName.None:
return ApplePlatform.None;
default:
throw new ArgumentOutOfRangeException (nameof (platform), platform, $"Unknown platform: {platform}");
}
}

static AvailabilityBaseAttribute CloneFromOtherPlatform (AvailabilityBaseAttribute attr, PlatformName platform)
{
if (attr.Version is null) {
Expand All @@ -3416,14 +3436,18 @@ static AvailabilityBaseAttribute CloneFromOtherPlatform (AvailabilityBaseAttribu
// Due to the absurd API of Version, you can not pass a -1 to the revision constructor
// nor can you coerse to 0, as that will fail with "16.0.0 <= 16.0" => false in the registrar
// So determine if the revision is -1, and use the 2 or 3 param ctor...
if (attr.Version.Revision == -1) {
var version = attr.Version;
var minimum = Xamarin.SdkVersions.GetMinVersion (AsApplePlatform (platform));
if (version < minimum)
version = minimum;
if (version.Revision == -1) {
switch (attr.AvailabilityKind) {
case AvailabilityKind.Introduced:
return new IntroducedAttribute (platform, attr.Version.Major, attr.Version.Minor, message: attr.Message);
return new IntroducedAttribute (platform, version.Major, version.Minor, message: attr.Message);
case AvailabilityKind.Deprecated:
return new DeprecatedAttribute (platform, attr.Version.Major, attr.Version.Minor, message: attr.Message);
return new DeprecatedAttribute (platform, version.Major, version.Minor, message: attr.Message);
case AvailabilityKind.Obsoleted:
return new ObsoletedAttribute (platform, attr.Version.Major, attr.Version.Minor, message: attr.Message);
return new ObsoletedAttribute (platform, version.Major, version.Minor, message: attr.Message);
case AvailabilityKind.Unavailable:
return new UnavailableAttribute (platform, message: attr.Message);
default:
Expand All @@ -3432,11 +3456,11 @@ static AvailabilityBaseAttribute CloneFromOtherPlatform (AvailabilityBaseAttribu
} else {
switch (attr.AvailabilityKind) {
case AvailabilityKind.Introduced:
return new IntroducedAttribute (platform, attr.Version.Major, attr.Version.Minor, attr.Version.Revision, message: attr.Message);
return new IntroducedAttribute (platform, version.Major, version.Minor, version.Revision, message: attr.Message);
case AvailabilityKind.Deprecated:
return new DeprecatedAttribute (platform, attr.Version.Major, attr.Version.Minor, attr.Version.Revision, message: attr.Message);
return new DeprecatedAttribute (platform, version.Major, version.Minor, version.Revision, message: attr.Message);
case AvailabilityKind.Obsoleted:
return new ObsoletedAttribute (platform, attr.Version.Major, attr.Version.Minor, attr.Version.Revision, message: attr.Message);
return new ObsoletedAttribute (platform, version.Major, version.Minor, version.Revision, message: attr.Message);
case AvailabilityKind.Unavailable:
return new UnavailableAttribute (platform, message: attr.Message);
default:
Expand Down
Loading

0 comments on commit 7ccec76

Please sign in to comment.