Skip to content

Commit

Permalink
EnableDefaultItems on Compatibility project (#1615)
Browse files Browse the repository at this point in the history
* EnableDefaultItems on Compatibility project

* - fix non net6 project

* - remove extra files

* - fix default items include

* - fix resource files

* - fix namespace

* - fix default items

* - fix WPF include and resource path

* - explicitly add styles

* - fix net6 project

* - properly exclude

* - exclude page/mauixaml

* - fix up removes on non net6 project

* EnableDefaultItems on Compatibility project

* - fix non net6 project

* - remove extra files

* - fix resource files

* - fix namespace

* - fix WPF include and resource path

* - explicitly add styles

* - fix net6 project

* - properly exclude

* - exclude page/mauixaml

* - fix up removes on non net6 project
  • Loading branch information
PureWeen committed Jul 15, 2021
1 parent 584ffac commit db18955
Show file tree
Hide file tree
Showing 200 changed files with 106 additions and 182 deletions.
71 changes: 0 additions & 71 deletions src/Compatibility/Core/src/Android/AppCompat/Resource.cs

This file was deleted.

4 changes: 2 additions & 2 deletions src/Compatibility/Core/src/AppHostBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ static IAppHostBuilder SetupDefaults(this IAppHostBuilder builder)
handlers.TryAddCompatibilityRenderer(typeof(ActivityIndicator), typeof(ActivityIndicatorRenderer));
handlers.TryAddCompatibilityRenderer(typeof(Frame), typeof(FrameRenderer));
handlers.TryAddCompatibilityRenderer(typeof(CheckBox), typeof(CheckBoxRenderer));
#if !WINDOWS
handlers.TryAddCompatibilityRenderer(typeof(TabbedPage), typeof(TabbedPageRenderer));
#if !WINDOWS
handlers.TryAddCompatibilityRenderer(typeof(Shell), typeof(ShellRenderer));
handlers.TryAddCompatibilityRenderer(typeof(OpenGLView), typeof(OpenGLViewRenderer));
#else
Expand Down Expand Up @@ -262,7 +262,7 @@ public void Configure(HostBuilderContext context, IServiceProvider services)
AddLibraryResources("MicrosoftMauiControlsIncluded", "ms-appx:///Microsoft.Maui.Controls/Platform/Windows/Styles/Resources.xbf");

// Microsoft.Maui.Controls.Compatibility
AddLibraryResources("MicrosoftMauiControlsCompatibilityIncluded", "ms-appx:///Microsoft.Maui.Controls.Compatibility/WinUI/Resources.xbf");
AddLibraryResources("MicrosoftMauiControlsCompatibilityIncluded", "ms-appx:///Microsoft.Maui.Controls.Compatibility/Windows/Resources.xbf");
}
#endif
}
Expand Down
80 changes: 32 additions & 48 deletions src/Compatibility/Core/src/Compatibility-net6.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;$(MauiPlatforms)</TargetFrameworks>
<RootNamespace>Microsoft.Maui.Controls.Compatibility</RootNamespace>
<AssemblyName>Microsoft.Maui.Controls.Compatibility</AssemblyName>
<Nullable>disable</Nullable>
<EnableDefaultItems>false</EnableDefaultItems>
<AndroidRoot>Android\</AndroidRoot>
<iOSRoot>iOS\</iOSRoot>
<WindowsRoot>WinUI\</WindowsRoot>
<WindowsRoot>Windows\</WindowsRoot>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand All @@ -24,67 +23,52 @@
<PackageReference Include="Microsoft.Graphics.Win2D" />
</ItemGroup>

<!--<Import Project="..\..\..\..\.nuspec\Microsoft.Maui.Controls.MultiTargeting.targets" />-->
<Import Project="..\..\..\..\.nuspec\Microsoft.Maui.Controls.MultiTargeting.targets" />

<ItemGroup>
<Compile Remove="GTK\**" />
<Compile Remove="MacOS\**" />
<Compile Remove="Tizen\**" />
<Compile Remove="WPF\**" />
<EmbeddedResource Remove="GTK\**" />
<EmbeddedResource Remove="MacOS\**" />
<EmbeddedResource Remove="Tizen\**" />
<EmbeddedResource Remove="WPF\**" />
<None Remove="GTK\**" />
<None Remove="MacOS\**" />
<None Remove="Tizen\**" />
<None Remove="WPF\**" />
<Page Remove="**\WPF\**\*.xaml" />
<MauiXaml Remove="**\WPF\**\*.xaml" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.Contains('-windows')) == true ">
<Compile Include="$(WindowsRoot)**\*.cs"></Compile>
<Page Include="$(WindowsRoot)**\*.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Remove="$(WindowsRoot)TabbedPageStyle.xaml" />
<ProjectReference Include="..\..\..\Controls\src\Xaml\Controls.Xaml-net6.csproj" />
<Compile Include="*.Windows.cs" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetPlatformIdentifier)' == 'android' ">
<Compile Include="$(AndroidRoot)**\*.cs"></Compile>
<AndroidResource Include="$(AndroidRoot)Resources\Layout\bottomtablayout.axml" Link="Android\Resources\Layout\bottomtablayout.axml" />
<AndroidResource Include="$(AndroidRoot)Resources\Layout\flyoutcontent.axml" Link="Android\Resources\Layout\flyoutcontent.axml" />
<AndroidResource Include="$(AndroidRoot)Resources\Layout\rootlayout.axml" Link="Android\Resources\Layout\rootlayout.axml" />
<AndroidResource Include="$(AndroidRoot)Resources\Layout\shellcontent.axml" Link="Android\Resources\Layout\shellcontent.axml" />
<AndroidResource Include="$(AndroidRoot)Resources\Layout\tabbar.axml" Link="Android\Resources\Layout\tabbar.axml" />
<AndroidResource Include="$(AndroidRoot)Resources\Layout\toolbar.axml" Link="Android\Resources\Layout\toolbar.axml" />
<AndroidResource Include="$(AndroidRoot)Resources\Layout\bottomtablayout.axml" />
<AndroidResource Include="$(AndroidRoot)Resources\Layout\flyoutcontent.axml" />
<AndroidResource Include="$(AndroidRoot)Resources\Layout\rootlayout.axml" />
<AndroidResource Include="$(AndroidRoot)Resources\Layout\shellcontent.axml" />
<AndroidResource Include="$(AndroidRoot)Resources\Layout\tabbar.axml" />
<AndroidResource Include="$(AndroidRoot)Resources\Layout\toolbar.axml" />


<AndroidResource Include="$(AndroidRoot)Resources\anim\enterfromleft.xml" Link="Android\Resources\anim\enterfromleft.xml" />
<AndroidResource Include="$(AndroidRoot)Resources\anim\enterfromright.xml" Link="Android\Resources\anim\enterfromright.xml" />
<AndroidResource Include="$(AndroidRoot)Resources\anim\exittoleft.xml" Link="Android\Resources\anim\exittoleft.xml" />
<AndroidResource Include="$(AndroidRoot)Resources\anim\exittoright.xml" Link="Android\Resources\anim\exittoright.xml" />
<AndroidResource Include="$(AndroidRoot)Resources\anim\enterfromleft.xml" />
<AndroidResource Include="$(AndroidRoot)Resources\anim\enterfromright.xml" />
<AndroidResource Include="$(AndroidRoot)Resources\anim\exittoleft.xml" />
<AndroidResource Include="$(AndroidRoot)Resources\anim\exittoright.xml" />


<AndroidResource Include="$(AndroidRoot)Resources\values\styles.xml" Link="Android\Resources\values\styles.xml" />
<AndroidResource Include="$(AndroidRoot)Resources\values\strings.xml" Link="Android\Resources\values\strings.xml" />
<AndroidResource Include="$(AndroidRoot)Resources\values\attrs.xml" Link="Android\Resources\values\attrs.xml" />
<AndroidResource Include="$(AndroidRoot)Resources\values\styles.xml" />
<AndroidResource Include="$(AndroidRoot)Resources\values\strings.xml" />
<AndroidResource Include="$(AndroidRoot)Resources\values\attrs.xml" />
<ProjectReference Include="..\..\Android.FormsViewGroup\src\Compatibility.Android.FormsViewGroup-net6.csproj" />

<Compile Remove="$(AndroidRoot)AppCompat\Resource.cs" />
<Compile Remove="$(AndroidRoot)bin\**\*.cs" />
<Compile Remove="$(AndroidRoot)obj\**\*.cs" />
<Compile Include="*.Android.cs" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetPlatformIdentifier)' == 'ios' OR '$(TargetPlatformIdentifier)' == 'maccatalyst' ">
<Compile Include="$(iOSRoot)**\*.cs"></Compile>
<EmbeddedResource Include="$(iOSRoot)Resources\*.resx" />
<Compile Remove="$(iOSRoot)bin\**\*.cs" />
<Compile Remove="$(iOSRoot)obj\**\*.cs" />
<Compile Include="*.iOS.cs" />
</ItemGroup>

<ItemGroup>
<Compile Include="RendererToHandlerShim.cs" />
<Compile Include="AppHostBuilderExtensions.cs" />
<Compile Include="MauiHandlersCollectionExtensions.cs" />
<Compile Include="ExportRendererAttribute.cs" />
<Compile Include="Forms.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\Controls\src\Core\Controls.Core-net6.csproj" />
<ProjectReference Include="..\..\..\Controls\src\Xaml\Controls.Xaml-net6.csproj" />
Expand Down
75 changes: 39 additions & 36 deletions src/Compatibility/Core/src/Compatibility.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,68 +4,63 @@
<RootNamespace>Microsoft.Maui.Controls.Compatibility</RootNamespace>
<AssemblyName>Microsoft.Maui.Controls.Compatibility</AssemblyName>
<Nullable>disable</Nullable>
<EnableDefaultItems>false</EnableDefaultItems>
<AndroidRoot>Android\</AndroidRoot>
<iOSRoot>iOS\</iOSRoot>
<WindowsRoot>WinUI\</WindowsRoot>
<WindowsRoot>Windows\</WindowsRoot>
</PropertyGroup>
<PropertyGroup>
<PackageId>Microsoft.Maui.Controls.Compatibility</PackageId>
</PropertyGroup>

<!--<Import Project="..\..\..\..\.nuspec\Microsoft.Maui.Controls.MultiTargeting.targets" />-->
<Import Project="..\..\..\..\.nuspec\Microsoft.Maui.Controls.MultiTargeting.targets" />

<ItemGroup>
<Compile Remove="GTK\**" />
<Compile Remove="MacOS\**" />
<Compile Remove="Tizen\**" />
<Compile Remove="WPF\**" />
<EmbeddedResource Remove="GTK\**" />
<EmbeddedResource Remove="MacOS\**" />
<EmbeddedResource Remove="Tizen\**" />
<EmbeddedResource Remove="WPF\**" />
<None Remove="GTK\**" />
<None Remove="MacOS\**" />
<None Remove="Tizen\**" />
<None Remove="WPF\**" />
<Page Remove="**\WPF\**\*.xaml" />
<MauiXaml Remove="**\WPF\**\*.xaml" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('MonoAndroid')) == true ">
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xml" />
<Reference Include="System.Net.Http" />
<Compile Include="$(AndroidRoot)**\*.cs"></Compile>
<AndroidResource Include="$(AndroidRoot)Resources\Layout\bottomtablayout.axml" Link="Android\Resources\Layout\bottomtablayout.axml" />
<AndroidResource Include="$(AndroidRoot)Resources\Layout\flyoutcontent.axml" Link="Android\Resources\Layout\flyoutcontent.axml" />
<AndroidResource Include="$(AndroidRoot)Resources\Layout\rootlayout.axml" Link="Android\Resources\Layout\rootlayout.axml" />
<AndroidResource Include="$(AndroidRoot)Resources\Layout\shellcontent.axml" Link="Android\Resources\Layout\shellcontent.axml" />
<AndroidResource Include="$(AndroidRoot)Resources\Layout\tabbar.axml" Link="Android\Resources\Layout\tabbar.axml" />
<AndroidResource Include="$(AndroidRoot)Resources\Layout\toolbar.axml" Link="Android\Resources\Layout\toolbar.axml" />
<AndroidResource Include="$(AndroidRoot)Resources\Layout\bottomtablayout.axml" />
<AndroidResource Include="$(AndroidRoot)Resources\Layout\flyoutcontent.axml" />
<AndroidResource Include="$(AndroidRoot)Resources\Layout\rootlayout.axml" />
<AndroidResource Include="$(AndroidRoot)Resources\Layout\shellcontent.axml" />
<AndroidResource Include="$(AndroidRoot)Resources\Layout\tabbar.axml" />
<AndroidResource Include="$(AndroidRoot)Resources\Layout\toolbar.axml" />


<AndroidResource Include="$(AndroidRoot)Resources\anim\enterfromleft.xml" Link="Android\Resources\anim\enterfromleft.xml" />
<AndroidResource Include="$(AndroidRoot)Resources\anim\enterfromright.xml" Link="Android\Resources\anim\enterfromright.xml" />
<AndroidResource Include="$(AndroidRoot)Resources\anim\exittoleft.xml" Link="Android\Resources\anim\exittoleft.xml" />
<AndroidResource Include="$(AndroidRoot)Resources\anim\exittoright.xml" Link="Android\Resources\anim\exittoright.xml" />
<AndroidResource Include="$(AndroidRoot)Resources\anim\enterfromleft.xml" />
<AndroidResource Include="$(AndroidRoot)Resources\anim\enterfromright.xml" />
<AndroidResource Include="$(AndroidRoot)Resources\anim\exittoleft.xml" />
<AndroidResource Include="$(AndroidRoot)Resources\anim\exittoright.xml" />


<AndroidResource Include="$(AndroidRoot)Resources\values\styles.xml" Link="Android\Resources\values\styles.xml" />
<AndroidResource Include="$(AndroidRoot)Resources\values\strings.xml" Link="Android\Resources\values\strings.xml" />
<AndroidResource Include="$(AndroidRoot)Resources\values\attrs.xml" Link="Android\Resources\values\attrs.xml" />
<AndroidResource Include="$(AndroidRoot)Resources\values\styles.xml" />
<AndroidResource Include="$(AndroidRoot)Resources\values\strings.xml" />
<AndroidResource Include="$(AndroidRoot)Resources\values\attrs.xml" />
<ProjectReference Include="..\..\Android.FormsViewGroup\src\Compatibility.Android.FormsViewGroup.csproj" />

<Compile Remove="$(AndroidRoot)AppCompat\Resource.cs" />
<Compile Remove="$(AndroidRoot)bin\**\*.cs" />
<Compile Remove="$(AndroidRoot)obj\**\*.cs" />
<Compile Include="*.Android.cs" />
</ItemGroup>
<ItemGroup Condition=" $(TargetFramework.StartsWith('Xamarin.iOS')) ">
<Compile Include="$(iOSRoot)**\*.cs"></Compile>
<EmbeddedResource Include="$(iOSRoot)Resources\*.resx" />
<Compile Remove="$(iOSRoot)bin\**\*.cs" />
<Compile Remove="$(iOSRoot)obj\**\*.cs" />
<Reference Include="System" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Net.Http" />
<Compile Include="*.iOS.cs" />
</ItemGroup>

<ItemGroup>
<Compile Include="AppHostBuilderExtensions.cs" />
<Compile Include="MauiHandlersCollectionExtensions.cs" />
<Compile Include="ExportRendererAttribute.cs" />
<Compile Include="Forms.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RendererToHandlerShim.cs" />
</ItemGroup>

<ItemGroup>
Expand All @@ -78,4 +73,12 @@
<ProjectReference Include="..\..\..\Controls\src\Core\Controls.Core.csproj" />
<ProjectReference Include="..\..\..\Controls\src\Xaml\Controls.Xaml.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="iOS\Resources\StringResources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>StringResources.resx</DependentUpon>
</None>
</ItemGroup>
</Project>
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*

using System.Threading.Tasks;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
Expand All @@ -9,7 +9,7 @@ namespace Microsoft.Maui.Controls.Compatibility.Platform.UWP
{
public class FormsPivot : Pivot, IToolbarProvider
{
public static readonly DependencyProperty TitleVisibilityProperty = DependencyProperty.Register(nameof(TitleVisibility), typeof(Visibility), typeof(FormsPivot), new PropertyMetadata(Visibility.Collapsed));
public static readonly DependencyProperty TitleVisibilityProperty = DependencyProperty.Register(nameof(TitleVisibility), typeof(UI.Xaml.Visibility), typeof(FormsPivot), new PropertyMetadata(UI.Xaml.Visibility.Collapsed));

public static readonly DependencyProperty ToolbarForegroundProperty = DependencyProperty.Register(nameof(ToolbarForeground), typeof(WBrush), typeof(FormsPivot), new PropertyMetadata(default(WBrush)));

Expand Down Expand Up @@ -41,9 +41,9 @@ public WBrush ToolbarForeground
set { SetValue(ToolbarForegroundProperty, value); }
}

public Visibility TitleVisibility
public UI.Xaml.Visibility TitleVisibility
{
get { return (Visibility)GetValue(TitleVisibilityProperty); }
get { return (UI.Xaml.Visibility)GetValue(TitleVisibilityProperty); }
set { SetValue(TitleVisibilityProperty, value); }
}

Expand Down Expand Up @@ -129,4 +129,3 @@ void UpdateToolbarDynamicOverflowEnabled()
}
}
}
*/
8 changes: 8 additions & 0 deletions src/Compatibility/Core/src/Windows/PlatformEffect.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Microsoft.UI.Xaml;

namespace Microsoft.Maui.Controls.Compatibility.Platform.UWP
{
public abstract class PlatformEffect : PlatformEffect<FrameworkElement, FrameworkElement>
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<ResourceDictionary Source="FormsAutoSuggestBoxStyle.xaml" />
<ResourceDictionary Source="MasterDetailControlStyle.xaml" />
<ResourceDictionary Source="FlyoutPageControlStyle.xaml" />
<!--<ResourceDictionary Source="TabbedPageStyle.xaml" />-->
<ResourceDictionary Source="TabbedPageStyle.xaml" />
<ResourceDictionary Source="SliderStyle.xaml" />
<ResourceDictionary Source="CollectionView/ItemsViewStyles.xaml" />
<ResourceDictionary Source="PickerStyle.xaml" />
Expand Down
Loading

0 comments on commit db18955

Please sign in to comment.