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

Shared slim renderers project preparation #210

Closed
wants to merge 7 commits into from

Conversation

PureWeen
Copy link
Member

@PureWeen PureWeen commented Aug 22, 2020

Description of Change

This takes a shared project approach for constructing the necessary binaries used for XF 5.0 and for Maui builds.

This doesn't use any multi targeting so it basically gathers up all the necessary files into a given binary to produce what's needed.

The advantages here are

  • We don't have any multi targeted projects which VS isn't very good at dealing with
  • We can produce a binary that already has the inversion of dependency setup
  • Xamarin.Forms.Core remains fairly untouched

Disadvantages

  • So many shared projects is a bit of mind bender

Project outline

System.Maui.Android.SLN

This contains the projects needed to work on Android .NET MAUI

Common.csproj

This contains types that are the basic classes used by everyone

  • Color
  • Rect
  • Any common enums
  • etc..

Common.Android.csproj

This contains the common implementations that are shared between XF 5.0 and Maui. As the behavior of each renderer is extracted out to common methods and types they get moved here. In this PR you can see some code that's been moved to FormsEditText. All

System.Maui.Interfaces

This contains the common view interfaces

  • IView
  • IViewRenderer
  • ILabel

These are used by the Maui.MVVM project and the renderers projects

System.Maui.SlimRenderers.Android

This contains the android implementation of the android slim renderers. This could probably be it's own dll but this is all the static mapper implementations for Androiod

System.Maui.SlimRenderers.Common

This contains the shared Slim Renderer classes that has all the mapper implementations etc...

Xamarin.Forms.Core.Shared

This is a shared project that contains every single file that's part of Xamarin.Forms.Core (the project files are even in the same directory) this is used to create a portable shared version of all our BO implementations that we can add into other projects

This works with System.Maui.MVVM to add interfaces to our BO classes that can be used by the slim renderers

System.Maui.MVVM

This includes a reference to System.Maui.Interfaces and has added partial classes that tie our things like Label and Button to those interfaces.

System.Maui.MVVM.Android

This is the concrete unification of all the shared projects. Currently this is using SDK Extras but it will be changed over to .net SDK 6

This project unites all the shared projects required to generate a System.Maui dll

At some point this will be a single shared project but until there is proper IDE support this is probably the best option.

 <Import Project="..\System.Maui.SlimRenderers.Android\System.Maui.SlimRenderers.Android.projitems" Label="Shared" />
  <Import Project="..\Common\Common.projitems" Label="Shared" />
  <Import Project="..\Common.Android\Common.Android.projitems" Label="Shared" />
  <Import Project="..\System.Maui.Interfaces\System.Maui.Interfaces.projitems" Label="Shared" />
  <Import Project="..\System.Maui.MVVM\System.Maui.MVVM.projitems" Label="Shared" />
  <Import Project="..\System.Maui.SlimRenderers.Common\System.Maui.SlimRenderers.Common.projitems" Label="Shared" />
  <Import Project="..\Xamarin.Forms.Core\Xamarin.Forms.Core.Shared.projitems" Label="Shared" />
  <Import Project="..\Xamarin.Flex\Xamarin.Flex.projitems" Label="Shared" />

This is basically what each implementation (comet and blazor) would use to implement there own "CometButton" or "RazorButton" etc....

Additional Thoughts and work

  • We should call slim renderers something else just for clarity When working with these files just having something called EntryHandler vs EntryRenderer or whatever would probably help

  • Currently a large part of the UI tests are part of a shared project so my hopeful goal is to share those into a Maui based testing project that we can use to run UI tests

  • We could probably add another layer of dlls here before they are unified into the MVVM project that's just the MAUI renderers

  • We need to add in the faster registrar we already built and add an actual platform head that runs and uses these renderers

@PureWeen PureWeen closed this Aug 27, 2020
@PureWeen PureWeen deleted the shared_slim_renderers branch August 27, 2020 19:53
@github-actions github-actions bot locked and limited conversation to collaborators Dec 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant