Skip to content

Commit

Permalink
add SerialStream support for MacCatalyst (#96492)
Browse files Browse the repository at this point in the history
* add SerialStream support for MacCatalyst

* feedback from review

* Explicitly set SupportedOSPlatforms for maccatalyst

It'd default to the unsupported annotation from iOS otherwise.

---------

Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
  • Loading branch information
wfurt and akoeplinger authored Jan 8, 2024
1 parent 806c365 commit 17335f4
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/libraries/System.IO.Ports/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
<PropertyGroup>
<IncludePlatformAttributes>true</IncludePlatformAttributes>
<UnsupportedOSPlatforms>browser;ios;tvos</UnsupportedOSPlatforms>
<SupportedOSPlatforms>maccatalyst</SupportedOSPlatforms>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Project>
<Import Project="runtime.native.System.IO.Ports.props" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Project>
<Import Project="runtime.native.System.IO.Ports.props" />
</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
<Project>
<Import Project="runtime.native.System.IO.Ports.props" />
<PropertyGroup>
<!-- This is a native package, where package baseline validation doesn't really make much sense -->
<DisablePackageBaselineValidation>true</DisablePackageBaselineValidation>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ public static string[] GetPortNames()
return OperatingSystem.IsLinux() ? GetPortNames_Linux()
: OperatingSystem.IsAndroid() ? GetPortNames_Linux()
: OperatingSystem.IsMacOS() ? GetPortNames_OSX()
: OperatingSystem.IsMacCatalyst() ? GetPortNames_OSX()
: OperatingSystem.IsFreeBSD() ? GetPortNames_FreeBSD()
#else
return RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? GetPortNames_Linux()
: RuntimeInformation.IsOSPlatform(OSPlatform.Create("ANDROID")) ? GetPortNames_Linux()
: RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? GetPortNames_OSX()
: RuntimeInformation.IsOSPlatform(OSPlatform.Create("MACCATALYST") ? GetPortNames_OSX()
: RuntimeInformation.IsOSPlatform(OSPlatform.Create("FREEBSD")) ? GetPortNames_FreeBSD()
#endif
: throw new PlatformNotSupportedException(SR.PlatformNotSupported_SerialPort_GetPortNames);
Expand Down
2 changes: 1 addition & 1 deletion src/native/libs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ add_subdirectory(System.IO.Compression.Native)
if (CLR_CMAKE_TARGET_UNIX OR CLR_CMAKE_TARGET_BROWSER OR CLR_CMAKE_TARGET_WASI)
include(configure.cmake)

if (NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS)
if (NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS)
add_subdirectory(System.IO.Ports.Native)
endif ()

Expand Down

0 comments on commit 17335f4

Please sign in to comment.