TheAlmightyBob / Calendars

Cross-platform calendar API plugin for Xamarin and Windows
MIT License
101 stars 23 forks source link

add MAUI support #85

Open chrfin opened 2 years ago

chrfin commented 2 years ago

Proposed fix for #78 

This is an "as is" port using the exact same files via links compiled against the new TFMs. I only had to make some minor changes to the original files which should not change anything in the original TFMs.

chrfin commented 2 years ago

I had some problems with my iOS test-system and did not test this build there yet - will do that ASAP and report back...

TheAlmightyBob commented 2 years ago

Well this "MAUI" project is new and interesting... you can have a single project that targets all the platforms now? (apologies for my ignorance, although I still skim the headlines I'm not as deep in the .NET world as I used to be)

Is that really a MAUI-specific thing though, or just a .NET 6 thing? I think it would be confusing if normal .NET 6 iOS/Android projects are dependent on a "MAUI" DLL.

chrfin commented 2 years ago

I will look into dropping the "MAUI" part and be "plain net6.0" as soon as I find some time to also check the iOS build on my test-phone.

TheAlmightyBob commented 2 years ago

Your mention of "iOS tests" raises another question... are the Xamarin Unit Test apps even compatible with .NET 6? https://github.com/xamarin/xamarin-android/issues/5647 seems to suggest the answer will be "no"... says there's a "new" Xamarin.Legacy.NUnitLite (which despite the name appears to be Android-only) to use, but it's currently 0.0.1-alpha so dunno if it's usable yet.... for iOS, https://github.com/spouliot/Touch.Unit has had some updates, but is very lacking in documentation so not sure what the status or migration path there would be...

maxkoshevoi commented 2 years ago

not sure what the status or migration path there would be

How about XHarness? https://github.com/TheAlmightyBob/Calendars/issues/78#issuecomment-899021375

maxkoshevoi commented 2 years ago

you can have a single project that targets all the platforms now Is that really a MAUI-specific thing though, or just a .NET 6 thing?

Yes! That's one of the features. It's not MAUI specific.

TheAlmightyBob commented 2 years ago

not sure what the status or migration path there would be

How about XHarness? #78 (comment)

Ah, I missed that previous comment. Interesting. It sounds potentially limiting in terms of development flow (e.g. being able to rerun/debug a single test?), but that could just be me misinterpreting the brief documentation. Worth looking into... but hopefully the existing tests can still work for now

Specifying multiple target frameworks ( tag) has been a think since .Net Core 2, I believe

Wow, how did I miss that. I just found https://montemagno.com/converting-xamarin-libraries-to-sdk-style-multi-targeted-projects/, which I see also talks about the nuspec thing that was confusing me...

starting from VS2022...

Hmmm.... that reminds me, the challenge of updating CI config will likely come up again for this. It might be wise for me to try to tackle that before this gets merged (though that shouldn't stop it from getting to a merge-ready state)... especially if it means needing to move off of AppCenter...

maxkoshevoi commented 2 years ago

the challenge of updating CI config will likely come up again for thi

Example of MAUI CI: https://github.com/maxkoshevoi/NureTimetable/blob/maui/.github/workflows/build.yml You'll just need to run dotnet workload install maui instead of dotnet workload install maui-android to build MAUI project

And here's CI for regular Xamarin app: https://github.com/maxkoshevoi/NureTimetable/blob/main/.github/workflows/build.yml (also just builds Android, but should also work for Windows, to build iOS, I believe mac agent needs to be used)

goatrodeosoftware commented 1 year ago

For what it's worth, I downloaded this branch and referenced it directly, and whereas I was getting the "This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation." error on iOS (I guess the NETSTANDARD1_0 check was getting activated?), everything works on maui android and iOS now. Thanks a ton!