Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mono.Android] Bind API-35 Beta 2. #8948

Merged
merged 2 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading