Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[everywhere] Remove a lot of watchOS code. #22319

Merged
merged 6 commits into from
Mar 11, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 0 additions & 2 deletions msbuild/Xamarin.Shared/Xamarin.Shared.props
Original file line number Diff line number Diff line change
Expand Up @@ -360,15 +360,13 @@ Copyright (C) 2020 Microsoft. All rights reserved.
<_IsMobileDefined>$([System.Text.RegularExpressions.Regex]::IsMatch('$(DefineConstants.Trim())', '(^|;)__MOBILE__($|;)'))</_IsMobileDefined>
<_IsIOSDefined>$([System.Text.RegularExpressions.Regex]::IsMatch('$(DefineConstants.Trim())', '(^|;)__IOS__($|;)'))</_IsIOSDefined>
<_IsTVOSDefined>$([System.Text.RegularExpressions.Regex]::IsMatch('$(DefineConstants.Trim())', '(^|;)__TVOS__($|;)'))</_IsTVOSDefined>
<_IsWatchOSDefined>$([System.Text.RegularExpressions.Regex]::IsMatch('$(DefineConstants.Trim())', '(^|;)__WATCHOS__($|;)'))</_IsWatchOSDefined>
<_IsMacOSDefined>$([System.Text.RegularExpressions.Regex]::IsMatch('$(DefineConstants.Trim())', '(^|;)__MACOS__($|;)'))</_IsMacOSDefined>
<_IsMacCatalystDefined>$([System.Text.RegularExpressions.Regex]::IsMatch('$(DefineConstants.Trim())', '(^|;)__MACCATALYST__($|;)'))</_IsMacCatalystDefined>

<DefineConstants Condition="!$(_IsUnifiedDefined)">__UNIFIED__;$(DefineConstants)</DefineConstants>
<DefineConstants Condition="!$(_IsMobileDefined) And '$(_PlatformName)' != 'macOS'">__MOBILE__;$(DefineConstants)</DefineConstants>
<DefineConstants Condition="!$(_IsIOSDefined) And '$(_PlatformName)' == 'iOS'">__IOS__;$(DefineConstants)</DefineConstants>
<DefineConstants Condition="!$(_IsTVOSDefined) And '$(_PlatformName)' == 'tvOS'">__TVOS__;$(DefineConstants)</DefineConstants>
<DefineConstants Condition="!$(_IsWatchOSDefined) And '$(_PlatformName)' == 'watchOS'">__WATCHOS__;$(DefineConstants)</DefineConstants>
<DefineConstants Condition="!$(_IsMacOSDefined) And '$(_PlatformName)' == 'macOS'">__MACOS__;$(DefineConstants)</DefineConstants>
<DefineConstants Condition="!$(_IsIOSDefined) And '$(_PlatformName)' == 'MacCatalyst'">__IOS__;$(DefineConstants)</DefineConstants> <!-- We define __IOS__ for MacCatalyst as well for now -->
<DefineConstants Condition="!$(_IsMacCatalystDefined) And '$(_PlatformName)' == 'MacCatalyst'">__MACCATALYST__;$(DefineConstants)</DefineConstants>
Expand Down
3 changes: 0 additions & 3 deletions src/ObjCRuntime/Registrar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1341,8 +1341,6 @@ internal string AssemblyName {
switch (App.Platform) {
case ApplePlatform.iOS:
return Driver.IsDotNet ? "Microsoft.iOS" : "Xamarin.iOS";
case ApplePlatform.WatchOS:
return Driver.IsDotNet ? "Microsoft.watchOS" : "Xamarin.WatchOS";
case ApplePlatform.TVOS:
return Driver.IsDotNet ? "Microsoft.tvOS" : "Xamarin.TVOS";
case ApplePlatform.MacOSX:
Expand Down Expand Up @@ -2694,7 +2692,6 @@ protected string ToSignature (TType type, ObjCMember member, ref bool success, b
#if MTOUCH || MMP || BUNDLER
switch (App.Platform) {
case ApplePlatform.iOS:
case ApplePlatform.WatchOS:
case ApplePlatform.TVOS:
return Is64Bits ? "B" : "c";
case ApplePlatform.MacOSX:
Expand Down
24 changes: 3 additions & 21 deletions src/ObjCRuntime/RuntimeOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,18 @@ static string ParseHttpMessageHandler (Application app, string? value)
#if NET && !LEGACY_TOOLS
return NSUrlSessionHandlerValue;
#else
return (app.Platform == Utils.ApplePlatform.WatchOS) ? NSUrlSessionHandlerValue : HttpClientHandlerValue;
return HttpClientHandlerValue;
#endif
case CFNetworkHandlerValue:
#if NET && !LEGACY_TOOLS
case SocketsHandlerValue:
#else
case HttpClientHandlerValue:
#endif
if (app.Platform == Utils.ApplePlatform.WatchOS) {
ErrorHelper.Warning (2015, Errors.MT2015, value);
return NSUrlSessionHandlerValue;
}
return value;
case NSUrlSessionHandlerValue:
return value;
default:
if (app.Platform == Utils.ApplePlatform.WatchOS) // This is value we don't know about at all, show as error instead of warning.
throw ErrorHelper.CreateError (2015, Errors.MT2015, value);
throw ErrorHelper.CreateError (2010, Errors.MT2010, value);
}
}
Expand Down Expand Up @@ -97,8 +91,6 @@ internal static TypeDefinition GetHttpMessageHandler (Application app, RuntimeOp

if (options is not null) {
handler = options.http_message_handler;
} else if (app.Platform == Utils.ApplePlatform.WatchOS) {
handler = NSUrlSessionHandlerValue;
} else {
#if NET && !LEGACY_TOOLS
handler = NSUrlSessionHandlerValue;
Expand All @@ -125,21 +117,11 @@ internal static TypeDefinition GetHttpMessageHandler (Application app, RuntimeOp
break;
#else
case HttpClientHandlerValue:
if (app.Platform == Utils.ApplePlatform.WatchOS) {
ErrorHelper.Warning (2015, Errors.MT2015, handler);
type = platformModule!.GetType ("System.Net.Http", "NSUrlSessionHandler");
} else {
type = httpModule.GetType ("System.Net.Http", "HttpClientHandler");
}
type = httpModule.GetType ("System.Net.Http", "HttpClientHandler");
break;
#endif
case CFNetworkHandlerValue:
if (app.Platform == Utils.ApplePlatform.WatchOS) {
ErrorHelper.Warning (2015, Errors.MT2015, handler);
type = platformModule!.GetType ("System.Net.Http", "NSUrlSessionHandler");
} else {
type = platformModule!.GetType ("System.Net.Http", "CFNetworkHandler");
}
type = platformModule!.GetType ("System.Net.Http", "CFNetworkHandler");
break;
case NSUrlSessionHandlerValue:
type = platformModule!.GetType ("System.Net.Http", "NSUrlSessionHandler");
Expand Down
2 changes: 0 additions & 2 deletions src/SharedWithYouCore/SWCollaborationMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
namespace SharedWithYouCore {

#if NET
[UnsupportedOSPlatform ("watchos")]
[UnsupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos13.0")]
[SupportedOSPlatform ("ios16.0")]
Expand All @@ -35,7 +34,6 @@ public SWCollaborationMetadata (string localIdentifier) : base (NSObjectFlag.Emp
InitializeHandle (_InitWithLocalIdentifier (localIdentifier), "initWithLocalIdentifier:");

#if NET
[UnsupportedOSPlatform ("watchos")]
[UnsupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos13.0")]
[SupportedOSPlatform ("ios16.1")]
Expand Down
Empty file removed src/Social/SLRequest.cs
Empty file.
1 change: 0 additions & 1 deletion src/VideoToolbox/VTPixelRotationSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ namespace VideoToolbox {
[SupportedOSPlatform ("macos13.0")]
[SupportedOSPlatform ("ios16.0")]
[SupportedOSPlatform ("maccatalyst16.0")]
[SupportedOSPlatform ("watchos9.0")]
[SupportedOSPlatform ("tvos16.0")]
#else
[Mac (13, 0), iOS (16, 0), MacCatalyst (16, 0), TV (16, 0)]
Expand Down
1 change: 0 additions & 1 deletion src/VideoToolbox/VTPixelTransferSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ namespace VideoToolbox {
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios16.0")]
[SupportedOSPlatform ("maccatalyst16.0")]
[SupportedOSPlatform ("watchos9.0")]
[SupportedOSPlatform ("tvos16.0")]
#else
[iOS (16, 0), MacCatalyst (16, 0), TV (16, 0)]
Expand Down
1 change: 0 additions & 1 deletion src/VideoToolbox/VTProfessionalVideoWorkflow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ namespace VideoToolbox {
[SupportedOSPlatform ("macos")]
[UnsupportedOSPlatform ("ios")]
[UnsupportedOSPlatform ("maccatalyst")]
[UnsupportedOSPlatform ("watchos")]
[UnsupportedOSPlatform ("tvos")]
#else
[NoiOS, NoMacCatalyst, NoTV]
Expand Down
2 changes: 0 additions & 2 deletions src/bgen/Extensions/PlatformNameExtensionsBgen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ public static ApplePlatform AsApplePlatform (this PlatformName platform)
return ApplePlatform.MacCatalyst;
case PlatformName.MacOSX:
return ApplePlatform.MacOSX;
case PlatformName.WatchOS:
return ApplePlatform.WatchOS;
case PlatformName.None:
return ApplePlatform.None;
default:
Expand Down
2 changes: 0 additions & 2 deletions src/bgen/Generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5607,8 +5607,6 @@ string GetAssemblyName ()
return BindingTouch.IsDotNet ? "Microsoft.macOS" : "Xamarin.Mac";
case ApplePlatform.TVOS:
return BindingTouch.IsDotNet ? "Microsoft.tvOS" : "Xamarin.TVOS";
case ApplePlatform.WatchOS:
return BindingTouch.IsDotNet ? "Microsoft.watchOS" : "Xamarin.WatchOS";
case ApplePlatform.MacCatalyst:
return "Microsoft.MacCatalyst";
default:
Expand Down
2 changes: 0 additions & 2 deletions src/bgen/LibraryManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ public static PlatformName DetermineCurrentPlatform (ApplePlatform applePlatform
return PlatformName.iOS;
case ApplePlatform.TVOS:
return PlatformName.TvOS;
case ApplePlatform.WatchOS:
return PlatformName.WatchOS;
case ApplePlatform.MacCatalyst:
return PlatformName.MacCatalyst;
case ApplePlatform.MacOSX:
Expand Down
7 changes: 0 additions & 7 deletions src/bgen/Models/LibraryInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ static bool DetermineOmitStdLibrary (bool? omitStandardLibary, ApplePlatform cur
switch (currentPlatform) {
case ApplePlatform.iOS:
case ApplePlatform.TVOS:
case ApplePlatform.WatchOS:
case ApplePlatform.MacCatalyst:
case ApplePlatform.MacOSX:
return true;
Expand Down Expand Up @@ -105,12 +104,6 @@ static void AddAndFixReferences (LibraryInfo libraryInfo, List<string> reference
ReferenceFixer.FixSDKReferences (currentPlatform, "lib/mono/Xamarin.TVOS", references);
}
break;
case ApplePlatform.WatchOS:
if (!libraryInfo.IsDotNet) {
references.Add ("Facades/System.Drawing.Common");
ReferenceFixer.FixSDKReferences (currentPlatform, "lib/mono/Xamarin.WatchOS", references);
}
break;
case ApplePlatform.MacCatalyst:
if (!libraryInfo.IsDotNet) {
ReferenceFixer.FixSDKReferences (currentPlatform, "lib/mono/Xamarin.MacCatalyst", references);
Expand Down
2 changes: 0 additions & 2 deletions src/generate-frameworks-constants/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ static ApplePlatform GetPlatform (string platform)
return ApplePlatform.iOS;
case "tvos":
return ApplePlatform.TVOS;
case "watchos":
return ApplePlatform.WatchOS;
case "macos":
return ApplePlatform.MacOSX;
case "maccatalyst":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ internal static InvocationExpressionSyntax StringFromHandle (ImmutableArray<Argu
IdentifierName ("FromHandle").WithTrailingTrivia (Space)))
.WithArgumentList (argumentList);
}

/// <summary>
/// Generates a call to the NSArray.ArrayFromHandleFunc with the given arguments.
/// </summary>
Expand All @@ -189,14 +189,14 @@ internal static InvocationExpressionSyntax NSArrayFromHandleFunc (string returnT
// generate <returnType>
var genericsList = TypeArgumentList (
SingletonSeparatedList<TypeSyntax> (IdentifierName (returnType)));

// generate NSArray.ArrayFromHandleFunc<returnType> (arg1, arg2, arg3)
return InvocationExpression (
MemberAccessExpression (
SyntaxKind.SimpleMemberAccessExpression,
IdentifierName ("NSArray"),
GenericName ("ArrayFromHandleFunc")
.WithTypeArgumentList(genericsList)
.WithTypeArgumentList (genericsList)
.WithTrailingTrivia (Space)))
.WithArgumentList (argumentList);
}
Expand Down
2 changes: 0 additions & 2 deletions tests/bindings-test/StructsAndEnums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ public static MatrixFloat4x3 GetMatrixFloat4x3 (NSObject obj, string selector)
r2c0, r2c1, r2c2, r2c3);
}

#if !__WATCHOS__
[DllImport ("__Internal")]
public static extern void x_mdltransformcomponent_get_local_transform (IntPtr self, double time, out float r0c0, out float r0c1, out float r0c2, out float r0c3, out float r1c0, out float r1c1, out float r1c2, out float r1c3, out float r2c0, out float r2c1, out float r2c2, out float r2c3, out float r3c0, out float r3c1, out float r3c2, out float r3c3);

Expand Down Expand Up @@ -138,7 +137,6 @@ public static MatrixFloat4x4 MDLTransform_GetRotationMatrix (INativeObject obj,
r2c0, r2c1, r2c2, r2c3,
r3c0, r3c1, r3c2, r3c3);
}
#endif

[DllImport ("__Internal")]
public static extern SCNMatrix4 x_SCNMatrix4MakeTranslation (pfloat tx, pfloat ty, pfloat tz);
Expand Down
4 changes: 0 additions & 4 deletions tests/bindings-test/libtest.linkwith.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
[assembly: LinkWith ("libtest.a", LinkTarget.Simulator | LinkTarget.ArmV6 | LinkTarget.ArmV7 | LinkTarget.ArmV7s | LinkTarget.Arm64 | LinkTarget.Simulator64, SmartLink = true, Frameworks = LinkWithConstants.Frameworks, LinkerFlags = "-lz")]

static class LinkWithConstants {
#if __WATCHOS__
public const string Frameworks = "Foundation CoreLocation";
#else
public const string Frameworks = "Foundation ModelIO CoreLocation";
#endif
}
#endif
2 changes: 0 additions & 2 deletions tests/common/AppDelegate.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#if !__WATCHOS__
using System;
using System.Collections.Generic;
using System.Reflection;
Expand Down Expand Up @@ -56,4 +55,3 @@ static void Main (string [] args)
#endif
}
}
#endif // !__WATCHOS__
31 changes: 0 additions & 31 deletions tests/common/ConditionalCompilation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
#error __TVOS__ should not be defined when __IOS__ is defined
#endif

#if __WATCHOS__
#error __WATCHOS__ should not be defined when __IOS__ is defined
#endif

#if __MACOS__
#error __MACOS__ should not be defined when __IOS__ is defined
#endif
Expand All @@ -23,35 +19,12 @@
#error __IOS__ should not be defined when __TVOS__ is defined
#endif

#if __WATCHOS__
#error __WATCHOS__ should not be defined when __TVOS__ is defined
#endif

#if __MACOS__
#error __MACOS__ should not be defined when __TVOS__ is defined
#endif

#endif // __TVOS__


// __WATCHOS__
#if __WATCHOS__

#if __IOS__
#error __IOS__ should not be defined when __WATCHOS__ is defined
#endif

#if __TVOS__
#error __TVOS__ should not be defined when __WATCHOS__ is defined
#endif

#if __MACOS__
#error __MACOS__ should not be defined when __WATCHOS__ is defined
#endif

#endif // __WATCHOS__


// __MACOS__
#if __MACOS__

Expand All @@ -63,8 +36,4 @@
#error __TVOS__ should not be defined when __MACOS__ is defined
#endif

#if __WATCHOS__
#error __WATCHOS__ should not be defined when __MACOS__ is defined
#endif

#endif // __MACOS__
3 changes: 0 additions & 3 deletions tests/common/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -685,9 +685,6 @@ public static string GetTestLibraryDirectory (ApplePlatform platform, bool? simu
case ApplePlatform.MacOSX:
dir = "macos";
break;
case ApplePlatform.WatchOS:
dir = simulator.Value ? "watchsimulator" : "watchos";
break;
case ApplePlatform.TVOS:
dir = simulator.Value ? "tvsimulator" : "tvos";
break;
Expand Down
4 changes: 0 additions & 4 deletions tests/common/Profile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ public static ApplePlatform AsPlatform (this Profile profile)
return ApplePlatform.iOS;
case Profile.tvOS:
return ApplePlatform.TVOS;
case Profile.watchOS:
return ApplePlatform.WatchOS;
case Profile.macOSClassic:
case Profile.macOSFull:
case Profile.macOSMobile:
Expand All @@ -50,8 +48,6 @@ public static Profile AsProfile (this ApplePlatform platform)
return Profile.None;
case ApplePlatform.TVOS:
return Profile.tvOS;
case ApplePlatform.WatchOS:
return Profile.watchOS;
default:
throw new NotImplementedException (platform.ToString ());
}
Expand Down
2 changes: 1 addition & 1 deletion tests/common/TestRuntime.RunAsync.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !__WATCHOS__ && !BINDINGS_TEST
#if !BINDINGS_TEST
#define CAN_SHOW_ASYNC_UI
#endif

Expand Down
Loading
Loading