Skip to content

[Build] Move aapt2 download from xaprepare to MSBuild target#11399

Draft
jonathanpeppers wants to merge 3 commits into
mainfrom
jonathanpeppers/move-aapt2-download-to-msbuild
Draft

[Build] Move aapt2 download from xaprepare to MSBuild target#11399
jonathanpeppers wants to merge 3 commits into
mainfrom
jonathanpeppers/move-aapt2-download-to-msbuild

Conversation

@jonathanpeppers
Copy link
Copy Markdown
Member

Summary

Remove Step_Get_Android_BuildTools from xaprepare and move the aapt2 download/extract logic into src/aapt2/aapt2.targets as a proper MSBuild target.

Changes

The new _DownloadBuildTools target in aapt2.targets:

  • Downloads Google's repository2-3.xml manifest
  • Dynamically reads SHA-1 checksums via XmlPeek (no hardcoded hashes — when the version is bumped, checksums are automatically resolved from the manifest)
  • Downloads the 3 platform build-tools zips (macOS, Windows, Linux)
  • Validates SHA-1 checksums and errors on mismatch (deletes corrupt files)
  • Uses Inputs/Outputs for incremental build skip

Also removes:

  • Step_Get_Android_BuildTools.cs from xaprepare
  • The step registration from Scenario_Standard.cs
  • The unused BuildToolsArchiveDownloaded property from Context.cs

Context

Part of the effort to eliminate xaprepare steps in favor of standard MSBuild targets. This makes the build logic easier to understand, debug, and maintain — no custom C# download infrastructure needed.

jonathanpeppers and others added 3 commits May 18, 2026 16:31
Remove Step_Get_Android_BuildTools from xaprepare and move the aapt2
download/extract logic into src/aapt2/aapt2.targets as a proper MSBuild
target.

The new _DownloadBuildTools target:
- Downloads Google's repository2-3.xml manifest
- Dynamically reads SHA-1 checksums via XmlPeek (no hardcoded hashes)
- Downloads the 3 platform build-tools zips
- Validates checksums and errors on mismatch
- Uses Inputs/Outputs for incremental build skip

This removes one more step from xaprepare, moving the logic to a
standard MSBuild target that is easier to understand and maintain.

Co-authored-by: Copilot <[email protected]>
Refactor _DownloadBuildTools to use target batching via
Outputs="...%(_BuildTools.Identity)" so the target body runs once per
item. This replaces repeated DownloadFile/GetFileHash/Delete/Error
calls with single instances that operate on the batched item.

Also separate manifest download into its own target with a Condition
to skip when all zips already exist.

Co-authored-by: Copilot <[email protected]>
These prefix properties were only used by Step_Get_Android_BuildTools
which has been deleted. The property was always empty and served no
purpose for current build-tools versions.

Removed from:
- KnownProperties.cs
- Properties.Defaults.cs.in
- xaprepare.targets
- Configuration.props
- AndroidToolchain.cs (inlined empty prefix away)

Co-authored-by: Copilot <[email protected]>
@jonathanpeppers jonathanpeppers force-pushed the jonathanpeppers/move-aapt2-download-to-msbuild branch from 2b8296c to 3a13b23 Compare May 18, 2026 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant