Skip to content

Commit c993dee

Browse files
authored
[Mono.Android] Bind API-VanillaIceCream Beta 2 (#8948)
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
1 parent d7e2cc4 commit c993dee

File tree

7 files changed

+3273
-260
lines changed

7 files changed

+3273
-260
lines changed

Documentation/workflow/HowToAddNewApiLevel.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# HowTo: Add a new Android API Level
22

3-
## Developer Preview
3+
## Unstable Previews
44

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

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

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

19+
### Build Xamarin.Android
20+
21+
Build `Xamarin.Android.sln` using your usual mechanism. This will not use the new platform yet,
22+
but will build the tools like `param-name-importer` and `class-parse` that will be needed
23+
in the next steps.
24+
1925
### Generate `params.txt` File
2026

21-
- In `/external/Java.Interop/tools/param-name-importer`:
22-
- 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`
23-
- Copy the produced `api-X.params.txt` file to `/src/Mono.Android/Profiles/`
27+
Build the `params.txt` file for the desired level:
28+
29+
- Unstable: `dotnet-local.cmd build build-tools/create-android-api -t:GenerateParamsFile -p:ParamApiLevel=VanillaIceCream`
30+
- Stable: `dotnet-local.cmd build build-tools/create-android-api -t:GenerateParamsFile -p:ParamApiLevel=35`
31+
32+
This will create a `api-XX.params.txt` file in `/src/Mono.Android/Profiles/` that needs to be committed.
2433

2534
### Generate `api.xml` File
2635

2736
- Run `xaprepare android-sdk-platforms=all` to download all Android SDK platforms
2837
- Add level to `/build-tools/api-merge/merge-configuration.xml` to create `api-S.xml.class-parse`
2938
- Run the following command to create a merged `api.xml`:
30-
- `dotnet-local.cmd build build-tools\create-android-api -t:GenerateApiDescription`
31-
- Copy the `bin\BuildDebug\api\api-xx.xml` file to `src\Mono.Android\Profiles`
39+
- `dotnet-local.cmd build build-tools/create-android-api -t:GenerateApiDescription`
40+
41+
This will create a `api-XX.xml` file in `/src/Mono.Android/Profiles/` that needs to be committed.
3242

3343
### Other Infrastructure Changes
3444

build-tools/create-android-api/create-android-api.csproj

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
<ItemGroup>
1212
<ProjectReference Include="..\..\external\Java.Interop\tools\class-parse\class-parse.csproj" ReferenceOutputAssembly="False" />
13+
<ProjectReference Include="..\..\external\Java.Interop\tools\param-name-importer\param-name-importer.csproj" ReferenceOutputAssembly="False" />
1314
<ProjectReference Include="..\api-xml-adjuster\api-xml-adjuster.csproj" ReferenceOutputAssembly="False" />
1415
<ProjectReference Include="..\api-merge\api-merge.csproj" ReferenceOutputAssembly="False" />
1516
<ProjectReference Include="..\jnienv-gen\jnienv-gen.csproj" ReferenceOutputAssembly="False" SkipGetTargetFrameworkProperties="True" />
@@ -111,6 +112,27 @@
111112

112113
<Exec
113114
Command="&quot;$(DotNetPreviewTool)&quot; $(ApiMerge) -config=$(_ConfigurationFile) -config-input-dir=$(_ConfigurationInputBaseDirectory) -config-output-dir=$(_ConfigurationOutputBaseDirectory)" />
115+
116+
<ItemGroup>
117+
<_GeneratedApiDescriptionFiles Include="$(_ConfigurationOutputBaseDirectory)*.xml" />
118+
</ItemGroup>
119+
120+
<Copy SourceFiles="@(_GeneratedApiDescriptionFiles)" DestinationFolder="..\..\src\Mono.Android\Profiles\" />
121+
</Target>
122+
123+
<!-- Creates 'api-XX.params.txt' file -->
124+
<!-- Unstable: dotnet-local.cmd build build-tools/create-android-api -t:GenerateParamsFile -p:ParamApiLevel=VanillaIceCream -->
125+
<!-- Stable: dotnet-local.cmd build build-tools/create-android-api -t:GenerateParamsFile -p:ParamApiLevel=35 -->
126+
<Target Name="GenerateParamsFile">
127+
128+
<PropertyGroup>
129+
<_ParamNameImporter>$(MicrosoftAndroidSdkOutDir)\param-name-importer.dll</_ParamNameImporter>
130+
<_SourceStubZip>$(AndroidSdkDirectory)\platforms\android-$(ParamApiLevel)\android-stubs-src.jar</_SourceStubZip>
131+
<_ParamOutputTextFile>..\..\src\Mono.Android\Profiles\api-$(ParamApiLevel).params.txt</_ParamOutputTextFile>
132+
</PropertyGroup>
133+
134+
<Exec
135+
Command="&quot;$(DotNetPreviewTool)&quot; $(_ParamNameImporter) -source-stub-zip=$(_SourceStubZip) -output-text $(_ParamOutputTextFile) -verbose -framework-only" />
114136

115137
</Target>
116138

build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/AndroidToolchain.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public AndroidToolchain ()
7171
new AndroidPlatformComponent ("platform-32_r01", apiLevel: "32", pkgRevision: "1"),
7272
new AndroidPlatformComponent ("platform-33-ext3_r03", apiLevel: "33", pkgRevision: "3"),
7373
new AndroidPlatformComponent ("platform-34-ext7_r02", apiLevel: "34", pkgRevision: "2", isLatestStable: true),
74-
new AndroidPlatformComponent ("platform-VanillaIceCream_r03", apiLevel: "VanillaIceCream", pkgRevision: "3", isLatestStable: true),
74+
new AndroidPlatformComponent ("platform-VanillaIceCream_r04", apiLevel: "VanillaIceCream", pkgRevision: "4", isLatestStable: true),
7575

7676
new AndroidToolchainComponent ("sources-34_r01",
7777
destDir: Path.Combine ("sources", "android-34"),

0 commit comments

Comments
 (0)