Skip to content

[release/11.0.1xx] [Xamarin.Android.Build.Tasks] Skip RID-inner device checks - #13731

Merged
jonathanpeppers merged 1 commit into
release/11.0.1xxfrom
jonathanpeppers-backport-rid-inner-device-checks
Nov 23, 2026
Merged

jonathanpeppers merged 1 commit into
release/11.0.1xxfrom
jonathanpeppers-backport-rid-inner-device-checks

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

Backport of #13304.

Pull Request
title and
description
should follow the
commit-messages.md workflow documentation, and in particular should include:

  • Useful description of why the change is necessary.
  • Links to issues fixed
  • Unit tests

Why

dotnet run with a selected $(Device) repeated <BootAndroidEmulator/> in publish-only RID inner builds. <GetPrimaryCpuAbi/> already skips its device query there. This change adds and '$(_ComputeFilesToPublishForRuntimeIdentifiers)' != 'true' to the _EnsureDeviceBooted target condition in Microsoft.Android.Sdk.Application.targets, with a comment. The outer-build hook and the explicit deployment/run-argument dependencies do not change.

Changes

  • Microsoft.Android.Sdk.Application.targets: new _EnsureDeviceBooted condition and comment (applied cleanly).
  • BuildOrderTests.cs: new test DeviceBootIsLimitedToOuterBuilds (3 cases: inner build, outer build with Device, empty Device).

Conflict resolution

git cherry-pick -x dc2dd5208f26e1bf46a599293f851b70eb1d0aeb had one conflict, in BuildOrderTests.cs. On main, that file contains other tests that are not on this branch (for example RunWithLoggingEnablesManagedTimingLogger). I kept only the new DeviceBootIsLimitedToOuterBuilds test and the using lines that it needs (System.IO, System.Linq, System.Xml.Linq, Microsoft.Build.Construction, Microsoft.Build.Evaluation, Microsoft.Build.Execution). No other tests or -mt code were brought over.

Validation

  • git merge-base HEAD origin/release/11.0.1xx → 8e578c48bf, the same as the origin/release/11.0.1xx tip. Passed.
  • Isolated MSBuild check: I copied the _EnsureDeviceBooted condition from the changed targets file into a small .proj and ran dotnet msbuild t.proj -t:_GetPrimaryCpuAbi -nologo -v:m -p:Device=<d> -p:_ComputeFilesToPublishForRuntimeIdentifiers=<i>:
    • Device=selected, inner=true → exit 0, boot target skipped. Passed.
    • Device=selected, inner=`` → exit 0, boot target ran. Passed.
    • Device=, inner=`` → exit 0, boot target skipped. Passed.
  • I did not compile or run Xamarin.Android.Build.Tests locally, because that needs a full repository build. The full validation runs in CI.

…uilds (#13304)

Backport of #13304.

Skip the `_EnsureDeviceBooted` target when
`$(_ComputeFilesToPublishForRuntimeIdentifiers)` is `true`, so
publish-only RID inner builds do not repeat the outer build's device
boot check. Add the `DeviceBootIsLimitedToOuterBuilds` regression test.

Conflict resolution: `BuildOrderTests.cs` on main contains other tests
that are not on this branch. Only the new test and its `using` lines
were kept.

(cherry picked from commit dc2dd52)

Co-authored-by: Copilot App <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 23, 2026 16:24

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.

🟢 Approval recommended

No active review issues were identified for the change to avoid redundant device boot checks in publish-only inner builds.

No open issues 🎉

What changed in this PR

Backports #13304 to release/11.0.1xx, avoiding repeated device boot checks in publish-only runtime-identifier inner builds while preserving outer-build and deployment behavior.

Changes:

  • Skip _EnsureDeviceBooted when _ComputeFilesToPublishForRuntimeIdentifiers is true, with an explanatory comment.
  • Add three regression cases covering inner builds, outer builds with a selected device, and empty device selection.
File Description
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.Android.Build.Tests/​BuildOrderTests.cs Tests the boot condition, execution order, and single execution.
src/​Xamarin.Android.Build.Tasks/​Microsoft.Android.Sdk/​targets/​Microsoft.Android.Sdk.Application.targets Guards device boot checks in publish-only inner builds.

Review effort: Balanced

@jonathanpeppers

Copy link
Copy Markdown
Member Author

@dalexsoto review

@jonathanpeppers
jonathanpeppers enabled auto-merge (squash) November 23, 2026 21:22
@jonathanpeppers jonathanpeppers added the ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable). label Nov 23, 2026
@jonathanpeppers
jonathanpeppers merged commit 7414c55 into release/11.0.1xx Nov 23, 2026
45 checks passed
@jonathanpeppers
jonathanpeppers deleted the jonathanpeppers-backport-rid-inner-device-checks branch November 23, 2026 22:41
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.

3 participants