xamarin / AndroidX

AndroidX bindings for .NET for Android
MIT License
173 stars 42 forks source link

Use an updated `generator` for `@RestrictTo` support. #820

Closed jpobst closed 6 months ago

jpobst commented 7 months ago

We want to use an updated version of generator that has @RestrictTo support. This will allow consumers to be warned if they attempt to use API that Google has marked as internal using a @RestrictTo annotation.

Begin building net7.0-android with an updated version of generator. This is accomplished by downloading the generator that ships in the .NET Android 8.0 RTM NuGet package. (Microsoft.Android.Sdk.Windows 34.0.43) Note it is okay to use the "Windows" package on all platforms because we only use managed cross-platform binaries from the package. We then set $(_BindingsToolsLocation) to point to this package.

There are some transforms and additions changes that only affect this newer version of generator, so we also need a way to apply different transform files based on the framework that is building. The can now be done by naming the transform files with the target framework, ex: Metadata.MonoAndroid12.0.xml or Metadata.net6.0-android.xml.

api-diff reports that the changes we are looking for are present:

## Xamarin.AndroidX.Activity.dll
### Namespace AndroidX.Activity
#### Type Changed: AndroidX.Activity.FullyDrawnReporter

Obsoleted methods:
```diff
[Obsolete ("While this member is 'public', Google considers it internal API and reserves the right to modify or delete it in the future. Use at your own risk.")]
public void FullyDrawnReported ();
```