Skip to content

Commit

Permalink
[Mono.Android] Bind API-VanillaIceCream Beta 2 (#8948)
Browse files Browse the repository at this point in the history
Context: https://developer.android.com/about/versions/15
Context: https://android-developers.googleblog.com/2024/05/the-second-beta-of-android-15.html
Context: d5b608e

Android 15 Beta 2 was released on 2024-May-15:

  * [API-VanillaIceCream Beta 2 vs. API-34][1]
  * [API-VanillaIceCream Beta 2 vs. Beta 1][2] (d5b608e)

The Android 15 Developer Preview [Timeline and updates][0] section
suggests the following timeline:

  * Feb/Mar: Developer Previews
  * April/May: Unstable Betas
  * June/July: Stable Betas with a [Platform Stability milestone][3]
    (final API-35) expected in Beta 3
  * ???: Final

Beta 2 be usable in its preview form to .NET 9 Preview 5 users who
explicitly target `net9.0-android35`.

[0]: https://web.archive.org/web/20240514210701/https://developer.android.com/about/versions/15/overview#timeline
[1]: https://developer.android.com/sdk/api_diff/v-beta2/changes
[2]: https://developer.android.com/sdk/api_diff/v-beta2-incr/changes
[3]: https://web.archive.org/web/20240514210701/https://developer.android.com/about/versions/15/overview#platform_stability
  • Loading branch information
jpobst authored May 22, 2024
1 parent d7e2cc4 commit c993dee
Show file tree
Hide file tree
Showing 7 changed files with 3,273 additions and 260 deletions.
26 changes: 18 additions & 8 deletions Documentation/workflow/HowToAddNewApiLevel.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# HowTo: Add a new Android API Level

## Developer Preview
## Unstable Previews

The first developer preview generally ships in late February or early March. At this early
The first unstable preview generally ships in late February or early March. At this early
stage for the APIs, we simply add literal bindings for them. We do not spend resources on
the more manual parts like enumification that will likely change as the APIs mature.

Expand All @@ -13,22 +13,32 @@ the more manual parts like enumification that will likely change as the APIs mat
- Add new level to `/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/AndroidToolchain.cs`:
- `new AndroidPlatformComponent ("platform-S_r01", apiLevel: "S", pkgRevision: "1"),`

At this point, you can run `Xamarin.Android.sln /t:Prepare` using your usual mechanism, and
At this point, you can run `Xamarin.Android.sln -t:Prepare` using your usual mechanism, and
the new platform will be downloaded to your local Android SDK.

### Build Xamarin.Android

Build `Xamarin.Android.sln` using your usual mechanism. This will not use the new platform yet,
but will build the tools like `param-name-importer` and `class-parse` that will be needed
in the next steps.

### Generate `params.txt` File

- In `/external/Java.Interop/tools/param-name-importer`:
- Run: `dotnet run -source-stub-zip C:/Users/USERNAME/android-toolchain/platforms/android-35/android-stubs-src.jar -output-text api-35.params.txt -output-xml api-35.params.xml -verbose -framework-only`
- Copy the produced `api-X.params.txt` file to `/src/Mono.Android/Profiles/`
Build the `params.txt` file for the desired level:

- Unstable: `dotnet-local.cmd build build-tools/create-android-api -t:GenerateParamsFile -p:ParamApiLevel=VanillaIceCream`
- Stable: `dotnet-local.cmd build build-tools/create-android-api -t:GenerateParamsFile -p:ParamApiLevel=35`

This will create a `api-XX.params.txt` file in `/src/Mono.Android/Profiles/` that needs to be committed.

### Generate `api.xml` File

- Run `xaprepare android-sdk-platforms=all` to download all Android SDK platforms
- Add level to `/build-tools/api-merge/merge-configuration.xml` to create `api-S.xml.class-parse`
- Run the following command to create a merged `api.xml`:
- `dotnet-local.cmd build build-tools\create-android-api -t:GenerateApiDescription`
- Copy the `bin\BuildDebug\api\api-xx.xml` file to `src\Mono.Android\Profiles`
- `dotnet-local.cmd build build-tools/create-android-api -t:GenerateApiDescription`

This will create a `api-XX.xml` file in `/src/Mono.Android/Profiles/` that needs to be committed.

### Other Infrastructure Changes

Expand Down
22 changes: 22 additions & 0 deletions build-tools/create-android-api/create-android-api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

<ItemGroup>
<ProjectReference Include="..\..\external\Java.Interop\tools\class-parse\class-parse.csproj" ReferenceOutputAssembly="False" />
<ProjectReference Include="..\..\external\Java.Interop\tools\param-name-importer\param-name-importer.csproj" ReferenceOutputAssembly="False" />
<ProjectReference Include="..\api-xml-adjuster\api-xml-adjuster.csproj" ReferenceOutputAssembly="False" />
<ProjectReference Include="..\api-merge\api-merge.csproj" ReferenceOutputAssembly="False" />
<ProjectReference Include="..\jnienv-gen\jnienv-gen.csproj" ReferenceOutputAssembly="False" SkipGetTargetFrameworkProperties="True" />
Expand Down Expand Up @@ -111,6 +112,27 @@

<Exec
Command="&quot;$(DotNetPreviewTool)&quot; $(ApiMerge) -config=$(_ConfigurationFile) -config-input-dir=$(_ConfigurationInputBaseDirectory) -config-output-dir=$(_ConfigurationOutputBaseDirectory)" />

<ItemGroup>
<_GeneratedApiDescriptionFiles Include="$(_ConfigurationOutputBaseDirectory)*.xml" />
</ItemGroup>

<Copy SourceFiles="@(_GeneratedApiDescriptionFiles)" DestinationFolder="..\..\src\Mono.Android\Profiles\" />
</Target>

<!-- Creates 'api-XX.params.txt' file -->
<!-- Unstable: dotnet-local.cmd build build-tools/create-android-api -t:GenerateParamsFile -p:ParamApiLevel=VanillaIceCream -->
<!-- Stable: dotnet-local.cmd build build-tools/create-android-api -t:GenerateParamsFile -p:ParamApiLevel=35 -->
<Target Name="GenerateParamsFile">

<PropertyGroup>
<_ParamNameImporter>$(MicrosoftAndroidSdkOutDir)\param-name-importer.dll</_ParamNameImporter>
<_SourceStubZip>$(AndroidSdkDirectory)\platforms\android-$(ParamApiLevel)\android-stubs-src.jar</_SourceStubZip>
<_ParamOutputTextFile>..\..\src\Mono.Android\Profiles\api-$(ParamApiLevel).params.txt</_ParamOutputTextFile>
</PropertyGroup>

<Exec
Command="&quot;$(DotNetPreviewTool)&quot; $(_ParamNameImporter) -source-stub-zip=$(_SourceStubZip) -output-text $(_ParamOutputTextFile) -verbose -framework-only" />

</Target>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public AndroidToolchain ()
new AndroidPlatformComponent ("platform-32_r01", apiLevel: "32", pkgRevision: "1"),
new AndroidPlatformComponent ("platform-33-ext3_r03", apiLevel: "33", pkgRevision: "3"),
new AndroidPlatformComponent ("platform-34-ext7_r02", apiLevel: "34", pkgRevision: "2", isLatestStable: true),
new AndroidPlatformComponent ("platform-VanillaIceCream_r03", apiLevel: "VanillaIceCream", pkgRevision: "3", isLatestStable: true),
new AndroidPlatformComponent ("platform-VanillaIceCream_r04", apiLevel: "VanillaIceCream", pkgRevision: "4", isLatestStable: true),

new AndroidToolchainComponent ("sources-34_r01",
destDir: Path.Combine ("sources", "android-34"),
Expand Down
Loading

0 comments on commit c993dee

Please sign in to comment.