xamarin-android/build-tools/api-xml-adjuster
Jonathan Pobst dab495ff1e
[Mono.Android] Bind and enumify API-34 (#8116)
Context: https://developer.android.com/about/versions/14
Context: https://android-developers.googleblog.com/2023/06/android-14-beta-3-and-platform-stability.html

Android 14 Developer Beta 3 has been released.

  * [API diff vs. API-33][0]
  * [API diff vs. API-UpsideDownCake Beta 2][1] (3c1a9851)

The Android 14 Developer Preview Program Overview
[Timeline and updates][2] section suggests the following timeline:

  * Feb/Mar: Developer Previews
  * April/May: Unstable Betas
  * June: Beta 3 with "First [Platform Stability][3] milestone
    including final APIs and behaviors.  Play publishing also opens."
  * July: Near-final builds for final testing
  * ???: Final

~~ Acceptable Breakages ~~

Many methods in `Android.Content.PM.PackageManager` and the
`Dalvik.SystemInterop.DexFile` type were un-deprecated.

Interface method `Java.Lang.Reflect.IAnnotatedElement.IsAnnotationPresent`
was given a default implementation, which we enabled in 3c1a9851.

`RequiresPermission` was removed from `AlarmManager.setExact(…)`
in `annotations.zip`.

`RequiresPermission` for `WallpaperManager.*` was changed:

	<!-- API-33 -->
	<val name="value" val="&quot;android.permission.READ_EXTERNAL_STORAGE&quot;" />
	<!-- API-34 -->
	<val name="anyOf" val="{&quot;android.permission.MANAGE_EXTERNAL_STORAGE&quot;, &quot;android.permission.READ_WALLPAPER_INTERNAL&quot;}" />

We have [previously decided][4] that we do not use these values for
anything and are not updating this.

~~ Enumification? ~~

While reviewing, we discovered that the *past four years* of
enumification was incomplete: we did the work, but the enums weren't
applied.  See e.g. [`TextView.LineBreakWordStyle Property`][5],
which is of type `int`, but *should* have been of enum type
`Android.Graphics.Text.LineBreakWordStyle`, via df6c716e41:

	33,android/widget,TextView,setLineBreakWordStyle,lineBreakWordStyle,Android.Graphics.Text.LineBreakWordStyle

The reason for this is that `methodmap.csv` column 2 should be a
*Java* `.`d package name, but we used the JNI `/`d name.

We can't fix these (API and ABI breaks are bad), and we are still
exploring what we can do to address this.

This oversight was caught in time that API-34 members are correctly
enumified.

[0]: https://developer.android.com/sdk/api_diff/34/changes
[1]: https://developer.android.com/sdk/api_diff/34-incr/changes
[2]: https://web.archive.org/web/20230616200934/https://developer.android.com/about/versions/14/overview#timeline
[3]: https://web.archive.org/web/20230616200934/https://developer.android.com/about/versions/14/overview#platform_stability
[4]: https://github.com/xamarin/xamarin-android/issues/6775
[5]: https://learn.microsoft.com/dotnet/api/android.widget.textview.LineBreakWordStyle?view=xamarin-android-sdk-13
2023-06-26 19:54:45 -04:00
..
.gitignore
Makefile [Mono.Android] Bind and enumify API-34 (#8116) 2023-06-26 19:54:45 -04:00
Program.cs
README.md
api-xml-adjuster.csproj Convert `/tools` and `/build-tools` projects from `net472` to `$(DotNetStableTargetFramework)` (#7943) 2023-04-12 14:10:39 -05:00

README.md

Mono.Android API XML generator

What is this directory for?

It is a directory for api-xml-adjuster build-only tool, as well as a work directory to regenerate src/Mono.Android/Profiles/api-*.xml.in.

Why is this not part of the build?

Generating those api-*.xml.in takes too much time to download the docs archives (which are not always provided by Google, by the way), scrape all those DroidDoc HTMLs and then re-parsed to resolve inheritance hierarchy to generate correct (backward-compatible) API description XML.

It should happen only once in a while (every time Google publishes a new API Level with docs).

(Well, I'm not very honest above: it should be built every time with our latest class-parse and api-xml-adjuster so that those toolchains don't trigger regressions that can cause Mono.Android API breakage. But as I stated above, it takes too much time anyways...)

Why are those docs archives not stored under obj/* ?

Because you don't want to clean up and download them every time you run MSBuild /t:Clean.

Why is this based on Makefile?

It had existed as such, and it's not part of the build, no need to be built on Windows so far.

How do you get the docs archive for the preview APIs?

Google publishes the docs SDK component only against the stable API, which means that preview API types are not included. That makes our parameter names retrieval impossible for the preview API.

To workaround the issue, we create corresponding API docs zip archive from developer.android.com using the following tool: https://github.com/xamarin/components/tree/master/AndroidDocUtil