unoplatform / uno.templates

Uno Platform project templates
https://platform.uno/
Other
16 stars 9 forks source link

Fix .vsconfig Android requirements #760

Open dansiegel opened 2 weeks ago

dansiegel commented 2 weeks ago

Description

https://github.com/unoplatform/uno.templates/blob/c1d4ca746554aa27a1e371b2c369f851cb23d38f/src/Uno.Templates/content/unoapp/.vsconfig#L41-L42

Currently the .vsconfig in the unoapp template has a requirement on Android for both SDK 33 & 34. We really should only need a single version of the SDK. We should figure out what version is actually required for net8.0 and require that single version of the Android SDK for net8.0 projects. Similarly we should determine what is actually required for net9.0 projects and ensure that when creating a net9.0 app with the template that the SDK requirement is properly set. My current assumption is that we only need version 34 as both net8.0 and net9.0 libraries seem to be publishing with 34 as the Android version on nuget.org.

We can do this more easily with a Template replacement value...

The lines shown above could simply become:

"$VSAndroidSdkComponent$",

The template.json could then be updated something like:

"vsAndroidSdkComponent": {
"type": "generated",
"generator": "switch",
"replaces": "$VSAndroidSdkComponent$",
"parameters": {
  "evaluator": "C++",
  "datatype": "string",
  "cases": [
    {
      "condition": "(tfm == 'net8.0')",
      "value": "Component.Android.SDK34"
    },
    {
      # This could become 35 when net9.0 launches
      "condition": "(tfm == 'net9.0')",
      "value": "Component.Android.SDK34"
    }
  ]
}
},