Skip to content

[build] Check in Mono.Android.Apis.projitems, remove generator#11608

Open
jonathanpeppers wants to merge 2 commits into
mainfrom
jonathanpeppers/checkin-mono-android-apis-projitems
Open

[build] Check in Mono.Android.Apis.projitems, remove generator#11608
jonathanpeppers wants to merge 2 commits into
mainfrom
jonathanpeppers/checkin-mono-android-apis-projitems

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

Description

Mono.Android.Apis.projitems was previously generated at prepare time by
GeneratedMonoAndroidProjitemsFile
(in xaprepare) from the
BuildAndroidPlatforms.AllPlatforms
list. Both had exactly one consumer — each other — so check in the projitems
as a source file and drop the generator plumbing.

Continues the xaprepare cleanup started in #11568 and #11580.

Changes

  • Add src/Mono.Android/Mono.Android.Apis.projitems — content matches the
    generator's output byte-for-byte (validated by re-running the generator's
    exact algorithm and diffing); only the header comment now points at
    Documentation/workflow/HowToAddNewApiLevel.md instead of declaring it a
    "GENERATED FILE".
  • Repoint the 4 importers (Mono.Android.targets <Import> + Inputs=,
    create-installers.targets, create-android-api.csproj,
    Xamarin.Android.Build.Tasks.targets Inputs=) at the new path and drop the
    Condition="Exists(...)" guards — the file is always present now.
  • Delete GeneratedMonoAndroidProjitemsFile.cs and AndroidPlatform.cs
    (whole files — AndroidPlatform class and AndroidPlatformExtensions both
    become unused).
  • Drop the new GeneratedMonoAndroidProjitemsFile() registration in
    Step_GenerateFiles.cs.
  • Remove BuildAndroidPlatforms.AllPlatforms and the now-unused
    using System.Collections.Generic;. Kept the NDK constants
    (AndroidNdkVersion, AndroidNdkPkgRevision, NdkMinimumAPI,
    NdkMinimumAPILegacy32) — they still have consumers.
  • Update Documentation/workflow/HowToAddNewApiLevel.md with the XML-based
    instructions for adding a new API level (replaces the old C# AndroidPlatform
    snippet).
  • Narrow the build-tools/xaprepare/README.md blurb for
    BuildAndroidPlatforms.cs to NDK metadata.
  • Fix stale doc comment in GenerateSupportedPlatforms.cs pointing at the old
    generated path.

Verification

  • dotnet build build-tools/xaprepare/xaprepare/xaprepare.csproj — 0 warnings,
    0 errors after deletions.
  • dotnet msbuild src/Mono.Android/Mono.Android.csproj -preprocess:pp.xml
    preprocessed XML shows all 34 <AndroidApiInfo> items resolving from the new
    path. Same for build-tools/create-android-api/create-android-api.csproj.
  • Byte-for-byte diff of a standalone re-run of the generator's exact code
    against the checked-in file: only the 2-line header comment block differs;
    body identical.

`Mono.Android.Apis.projitems` was previously generated at prepare time by
`GeneratedMonoAndroidProjitemsFile` (in xaprepare) from the
`BuildAndroidPlatforms.AllPlatforms` list. Both had exactly one consumer
(each other), so check in the projitems as a source file and drop the
generator plumbing.

Changes:

  * Add `src/Mono.Android/Mono.Android.Apis.projitems` — content matches
    the generator's output byte-for-byte; only the header comment now
    points at `Documentation/workflow/HowToAddNewApiLevel.md` instead of
    declaring "GENERATED FILE".
  * Repoint the 4 importers (`Mono.Android.targets` x2,
    `create-installers.targets`, `create-android-api.csproj`,
    `Xamarin.Android.Build.Tasks.targets`) at the new path and drop the
    `Condition="Exists(...)"` guards — the file is always present now.
  * Delete `GeneratedMonoAndroidProjitemsFile.cs` and `AndroidPlatform.cs`
    (whole files — `AndroidPlatform` class and `AndroidPlatformExtensions`
    both become unused).
  * Drop the `new GeneratedMonoAndroidProjitemsFile()` registration in
    `Step_GenerateFiles.cs`.
  * Remove `BuildAndroidPlatforms.AllPlatforms` and the now-unused
    `using System.Collections.Generic;`. Keep the NDK constants
    (`AndroidNdkVersion`, `AndroidNdkPkgRevision`, `NdkMinimumAPI`,
    `NdkMinimumAPILegacy32`) — they still have consumers.
  * Update `Documentation/workflow/HowToAddNewApiLevel.md` with the
    XML-based instructions for adding a new API level.
  * Narrow the `build-tools/xaprepare/README.md` blurb for
    `BuildAndroidPlatforms.cs` to NDK metadata.
  * Fix stale doc comment in `GenerateSupportedPlatforms.cs` pointing
    at the old generated path.

Continues the xaprepare cleanup started in PRs #11568 and #11580.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 8, 2026 14:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR continues the xaprepare cleanup by eliminating the prepare-time generator for Mono.Android.Apis.projitems, checking the file into source control instead, and updating all build/import points to reference the new location.

Changes:

  • Check in src/Mono.Android/Mono.Android.Apis.projitems and update build/importers to use it directly (removing Exists(...) guards).
  • Remove the generator plumbing and its now-unused data types from xaprepare.
  • Update workflow documentation to describe the XML-based process for adding API levels.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.targets Updates incremental Inputs to point at checked-in Mono.Android.Apis.projitems.
src/Mono.Android/Mono.Android.targets Imports checked-in projitems and updates _GenerateAndroidApiInfo inputs accordingly.
src/Mono.Android/Mono.Android.Apis.projitems New checked-in source of truth for @(AndroidApiInfo) items.
Documentation/workflow/HowToAddNewApiLevel.md Switches “add API level” instructions to editing the projitems XML directly.
build-tools/xaprepare/xaprepare/Steps/Step_GenerateFiles.cs Removes registration of the projitems generator step.
build-tools/xaprepare/xaprepare/ConfigAndData/BuildAndroidPlatforms.cs Removes the API-level list, leaving NDK metadata.
build-tools/xaprepare/xaprepare/Application/GeneratedMonoAndroidProjitemsFile.cs Deleted (generator no longer needed).
build-tools/xaprepare/xaprepare/Application/AndroidPlatform.cs Deleted (type became unused after generator removal).
build-tools/xaprepare/README.md Updates docs to reflect that API-level list moved to src/Mono.Android.
build-tools/Xamarin.Android.Tools.BootstrapTasks/.../GenerateSupportedPlatforms.cs Updates doc comment to reference new projitems location.
build-tools/installers/create-installers.targets Imports checked-in projitems file directly.
build-tools/create-android-api/create-android-api.csproj Imports checked-in projitems file directly.

Comment thread Documentation/workflow/HowToAddNewApiLevel.md Outdated
The added prose said Stable should be False for preview API levels, but the
example (CANARY) sets <Stable>True</Stable>, and every entry in
Mono.Android.Apis.projitems is True. Rewrite the prose to match the data and
briefly explain what setting Stable=False would actually do (excludes entry
from default stable framework selection).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jonathanpeppers

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@jonathanpeppers jonathanpeppers added the ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable). label Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants