Skip to content

Commit

Permalink
Add MacCatalyst TFM to plugins (#4627)
Browse files Browse the repository at this point in the history
* Add properties to easily check Target Platform

* Add MacCatalyst plugins

I guess I was too smart for my own good

Move GenerateLibraryOutput down to relevant block

Add workaround for microsoft/WindowsAppSDK#3548

Does this work?

Ok now it will work
  • Loading branch information
Cheesebaron authored Jul 12, 2023
1 parent b474c54 commit 461d40d
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 38 deletions.
24 changes: 19 additions & 5 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,24 @@

<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">10.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tvos'">10.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">23</SupportedOSPlatformVersion>
<_MvxTargetPlatformIdentifier>$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))</_MvxTargetPlatformIdentifier>
<_MvxTargetPlatformIsAndroid>false</_MvxTargetPlatformIsAndroid>
<_MvxTargetPlatformIsAndroid Condition="'$(_MvxTargetPlatformIdentifier)' == 'android'">True</_MvxTargetPlatformIsAndroid>
<_MvxTargetPlatformIsiOS>false</_MvxTargetPlatformIsiOS>
<_MvxTargetPlatformIsiOS Condition="'$(_MvxTargetPlatformIdentifier)' == 'ios'">True</_MvxTargetPlatformIsiOS>
<_MvxTargetPlatformIsMacCatalyst>false</_MvxTargetPlatformIsMacCatalyst>
<_MvxTargetPlatformIsMacCatalyst Condition="'$(_MvxTargetPlatformIdentifier)' == 'maccatalyst'">True</_MvxTargetPlatformIsMacCatalyst>
<_MvxTargetPlatformIsmacOS>false</_MvxTargetPlatformIsmacOS>
<_MvxTargetPlatformIsmacOS Condition="'$(_MvxTargetPlatformIdentifier)' == 'macos'">True</_MvxTargetPlatformIsmacOS>
<_MvxTargetPlatformIstvOS>false</_MvxTargetPlatformIstvOS>
<_MvxTargetPlatformIstvOS Condition="'$(_MvxTargetPlatformIdentifier)' == 'tvos'">True</_MvxTargetPlatformIstvOS>
<_MvxTargetPlatformIsWindows>false</_MvxTargetPlatformIsWindows>
<_MvxTargetPlatformIsWindows Condition="$(_MvxTargetPlatformIdentifier.Contains('windows')) == 'True'">True</_MvxTargetPlatformIsWindows>

<SupportedOSPlatformVersion Condition=" '$(_MvxTargetPlatformIsiOS)' == 'True' ">10.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition=" '$(_MvxTargetPlatformIstvOS)' == 'True' ">10.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition=" '$(_MvxTargetPlatformIsMacCatalyst)' == 'True' ">13.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition=" '$(_MvxTargetPlatformIsAndroid)' == 'True' ">23</SupportedOSPlatformVersion>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
Expand Down Expand Up @@ -58,7 +72,7 @@
is not set. This is set here since the base MvvmCross assembly and plugins
will need this property set.
-->
<PropertyGroup Condition=" $(TargetFramework.StartsWith('net6.0-windows')) ">
<PropertyGroup Condition=" '$(_MvxTargetPlatformIsWindows)' == 'True' ">
<EnableMsixTooling>true</EnableMsixTooling>
</PropertyGroup>

Expand Down
4 changes: 2 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.755" />
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.2.221209.1" />
<PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.756" />
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.3.230602002" />
<PackageVersion Include="Moq" Version="4.18.4" />
<PackageVersion Include="Roslynator.Analyzers" Version="4.3.0">
<PrivateAssets>all</PrivateAssets>
Expand Down
12 changes: 6 additions & 6 deletions MvvmCross.Plugins/Color/MvvmCross.Plugin.Color.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net6.0-android;net6.0-ios</TargetFrameworks>
<TargetFrameworks>net6.0;net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net6.0-windows10.0.19041.0;$(TargetFrameworks)</TargetFrameworks>
</PropertyGroup>

Expand All @@ -20,30 +20,30 @@ This package contains the 'Color' plugin for MvvmCross</Description>
<Compile Remove="Resources\*.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net6.0-ios')) ">
<ItemGroup Condition=" '$(_MvxTargetPlatformIsiOS)' == 'True' Or '$(_MvxTargetPlatformIsMacCatalyst)' == 'True' ">
<Compile Include="Platforms\Apple\**\*.cs" />
<Compile Include="Platforms\Ios\**\*.cs" />
<Compile Include="Platforms\Xamarin\**\*.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net6.0-mac')) ">
<ItemGroup Condition=" '$(_MvxTargetPlatformIsmacOS)' == 'True' ">
<Compile Include="Platforms\Apple\**\*.cs" />
<Compile Include="Platforms\Mac\**\*.cs" />
<Compile Include="Platforms\Xamarin\**\*.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net6.0-tvos')) ">
<ItemGroup Condition=" '$(_MvxTargetPlatformIstvOS)' == 'True' ">
<Compile Include="Platforms\Apple\**\*.cs" />
<Compile Include="Platforms\Tvos\**\*.cs" />
<Compile Include="Platforms\Xamarin\**\*.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net6.0-android')) ">
<ItemGroup Condition=" '$(_MvxTargetPlatformIsAndroid)' == 'True' ">
<Compile Include="Platforms\Android\**\*.cs" />
<Compile Include="Platforms\Xamarin\**\*.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net6.0-windows')) ">
<ItemGroup Condition=" '$(_MvxTargetPlatformIsWindows)' == 'True' ">
<Compile Include="Platforms\WinUi\**\*.cs" />

<PackageReference Include="Microsoft.WindowsAppSDK" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net6.0-android;net6.0-ios</TargetFrameworks>
<TargetFrameworks>net6.0;net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net6.0-windows10.0.19041.0;$(TargetFrameworks)</TargetFrameworks>
</PropertyGroup>

Expand All @@ -20,29 +20,29 @@ This package contains the 'ResourceLoader' plugin for MvvmCross</Description>
<Compile Remove="Resources\*.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net6.0-windows')) ">
<ItemGroup Condition=" $(TargetFramework.Contains('-windows')) ">
<Compile Include="Platforms\WinUI\**\*.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net6.0-ios')) ">
<ItemGroup Condition=" '$(_MvxTargetPlatformIsiOS)' == 'True' Or '$(_MvxTargetPlatformIsMacCatalyst)' == 'True' ">
<Compile Include="Platforms\Apple\**\*.cs" />
<Compile Include="Platforms\Ios\**\*.cs" />
<Compile Include="Platforms\Xamarin\**\*.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net6.0-mac')) ">
<ItemGroup Condition=" '$(_MvxTargetPlatformIsmacOS)' == 'True' ">
<Compile Include="Platforms\Apple\**\*.cs" />
<Compile Include="Platforms\Mac\**\*.cs" />
<Compile Include="Platforms\Xamarin\**\*.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net6.0-tvos')) ">
<ItemGroup Condition=" '$(_MvxTargetPlatformIstvOS)' == 'True' ">
<Compile Include="Platforms\Apple\**\*.cs" />
<Compile Include="Platforms\Tvos\**\*.cs" />
<Compile Include="Platforms\Xamarin\**\*.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net6.0-android')) ">
<ItemGroup Condition=" '$(_MvxTargetPlatformIsAndroid)' == 'True' ">
<Compile Include="Platforms\Android\**\*.cs" />
<Compile Include="Platforms\Xamarin\**\*.cs" />
</ItemGroup>
Expand Down
12 changes: 6 additions & 6 deletions MvvmCross.Plugins/Visibility/MvvmCross.Plugin.Visibility.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net6.0-android;net6.0-ios</TargetFrameworks>
<TargetFrameworks>net6.0;net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net6.0-windows10.0.19041.0;$(TargetFrameworks)</TargetFrameworks>
</PropertyGroup>

Expand All @@ -20,30 +20,30 @@ This package contains the 'Visibility' plugin for MvvmCross</Description>
<Compile Remove="Resources\*.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net6.0-ios')) ">
<ItemGroup Condition=" '$(_MvxTargetPlatformIsiOS)' == 'True' Or '$(_MvxTargetPlatformIsMacCatalyst)' == 'True' ">
<Compile Include="Platforms\Apple\**\*.cs" />
<Compile Include="Platforms\Ios\**\*.cs" />
<Compile Include="Platforms\Xamarin\**\*.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net6.0-mac')) ">
<ItemGroup Condition=" '$(_MvxTargetPlatformIsmacOS)' == 'True' ">
<Compile Include="Platforms\Apple\**\*.cs" />
<Compile Include="Platforms\Mac\**\*.cs" />
<Compile Include="Platforms\Xamarin\**\*.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net6.0-tvos')) ">
<ItemGroup Condition=" '$(_MvxTargetPlatformIstvOS)' == 'True' ">
<Compile Include="Platforms\Apple\**\*.cs" />
<Compile Include="Platforms\Tvos\**\*.cs" />
<Compile Include="Platforms\Xamarin\**\*.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net6.0-android')) ">
<ItemGroup Condition=" '$(_MvxTargetPlatformIsAndroid)' == 'True' ">
<Compile Include="Platforms\Android\**\*.cs" />
<Compile Include="Platforms\Xamarin\**\*.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net6.0-windows')) ">
<ItemGroup Condition=" '$(_MvxTargetPlatformIsWindows)' == 'True' ">
<Compile Include="Platforms\WinUi\**\*.cs" />

<PackageReference Include="Microsoft.WindowsAppSDK" />
Expand Down
20 changes: 7 additions & 13 deletions MvvmCross/MvvmCross.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

This package contains the 'Core' libraries for MvvmCross</Description>
<PackageId>MvvmCross</PackageId>
<GenerateLibraryLayout Condition=" $(TargetFramework.StartsWith('net6.0-windows')) ">true</GenerateLibraryLayout>
</PropertyGroup>

<ItemGroup>
Expand All @@ -26,31 +25,25 @@ This package contains the 'Core' libraries for MvvmCross</Description>
<Compile Include="Platforms\Netstandard\**\*.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net6.0-ios')) ">
<ItemGroup Condition=" '$(_MvxTargetPlatformIsiOS)' == 'True' Or '$(_MvxTargetPlatformIsMacCatalyst)' == 'True' ">
<Compile Include="Platforms\Apple\**\*.cs" />
<Compile Include="Platforms\Ios\**\*.cs" />
<Compile Include="Platforms\Xamarin\**\*.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net6.0-maccatalyst')) ">
<Compile Include="Platforms\Apple\**\*.cs" />
<Compile Include="Platforms\Ios\**\*.cs" />
<Compile Include="Platforms\Xamarin\**\*.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.Equals('net6.0-macos')) ">
<ItemGroup Condition=" '$(_MvxTargetPlatformIsmacOS)' == 'True' ">
<Compile Include="Platforms\Apple\**\*.cs" />
<Compile Include="Platforms\Mac\**\*.cs" />
<Compile Include="Platforms\Xamarin\**\*.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net6.0-tvos')) ">
<ItemGroup Condition=" '$(_MvxTargetPlatformIstvOS)' == 'True' ">
<Compile Include="Platforms\Apple\**\*.cs" />
<Compile Include="Platforms\Tvos\**\*.cs" />
<Compile Include="Platforms\Xamarin\**\*.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net6.0-android')) ">
<ItemGroup Condition=" '$(_MvxTargetPlatformIsAndroid)' == 'True' ">
<Compile Include="Platforms\Android\**\*.cs" />
<Compile Include="Platforms\Xamarin\**\*.cs" />
<AndroidResource Include="Resources\**\*.xml" SubType="Designer" Generator="MSBuild:UpdateAndroidResources" />
Expand All @@ -62,14 +55,15 @@ This package contains the 'Core' libraries for MvvmCross</Description>
<PackageReference Include="Xamarin.Google.Android.Material" />
</ItemGroup>

<PropertyGroup Condition=" $(TargetFramework.StartsWith('net6.0-windows')) ">
<PropertyGroup Condition=" '$(_MvxTargetPlatformIsWindows)' == 'True' ">
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>MvvmCross</RootNamespace>
<RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
<UseWinUI>true</UseWinUI>
<GenerateLibraryLayout>true</GenerateLibraryLayout>
</PropertyGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net6.0-windows')) ">
<ItemGroup Condition="'$(_MvxTargetPlatformIsWindows)' == 'True' ">
<Compile Include="Platforms\Windows\**\*.cs" />
<Compile Include="Platforms\WinUi\**\*.cs" />
<Page Include="Platforms\WinUi\**\*.xaml" SubType="Designer" Generator="MSBuild:Compile" />
Expand Down

0 comments on commit 461d40d

Please sign in to comment.