Skip to content

Migrate debugging tasks off legacy Android tooling - #12916

Merged
jonathanpeppers merged 7 commits into
mainfrom
jonathanpeppers-migrate-debugging-tasks-android-sdk
Sep 30, 2026
Merged

jonathanpeppers merged 7 commits into
mainfrom
jonathanpeppers-migrate-debugging-tasks-android-sdk

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

Summary

  • Migrate debugging-task device selection, ABI lookup, FastDeploy and app-detection to in-tree Android SDK tooling; remove the debugging tasks' project references to Xamarin.AndroidTools and Mono.AndroidTools.
  • Remove GetGdbSymbols, ResolveXamarinAndroidTools, and obsolete GDB debugging targets; retain _ResolveXamarinAndroidTools as a compatibility target for existing MSBuild dependencies.
  • Leave installer-side consumers and the legacy projects unchanged. The parent PR (Unify Android run targets #12906) removes RunActivity.

Validation

  • Focused debugging-task project build: zero warnings and errors.
  • Focused AdbRunnerTests: 112 passed, 7 platform-specific skipped.

Full-build host/device tests require the local Android SDK build, unavailable in this worktree. An earlier unfiltered SDK tooling test run had an unrelated JDK-installer extraction access-denied failure under D:\temp.

Stacked on #12906.

Copilot AI lite review requested due to automatic review settings September 24, 2026 21:19
@jonathanpeppers
jonathanpeppers added this pull request to stack #12917 September 24, 2026 21:19

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.

Copilot review overview

🟡 Changes recommended

Unresolved critical SDK ADB path initialization and moderate ABI, user-profile, and performance issues remain.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity · 1 Medium severity · 1 Low severity

Open (3)
What changed in this PR

Migrates debugging tasks from legacy Android tooling to in-tree SDK tooling and removes obsolete GDB support.

Changes:

  • Adds SDK-based ADB execution, device metadata, ABI lookup, and app detection.
  • Updates device selection, FastDeploy, and debugging targets.
  • Removes legacy references and obsolete GDB tasks while retaining compatibility wiring.
File Summary
tests/​Xamarin.Android.Tools.AndroidSdk-Tests/​AdbRunnerTests.cs Tests ADB metadata parsing.
src/​Xamarin.Android.Tools.AndroidSdk/​Runners/​AdbRunner.cs Adds shell execution and metadata support.
src/​Xamarin.Android.Tools.AndroidSdk/​PublicAPI/​netstandard2.0/​PublicAPI.Unshipped.txt Records new APIs.
src/​Xamarin.Android.Tools.AndroidSdk/​PublicAPI/​net11.0/​PublicAPI.Unshipped.txt Records new APIs.
src/​Xamarin.Android.Tools.AndroidSdk/​PublicAPI/​net10.0/​PublicAPI.Unshipped.txt Records new APIs.
src/​Xamarin.Android.Tools.AndroidSdk/​Models/​AdbDeviceInfo.cs Adds cached device metadata.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.Android.Build.Tests/​DebuggingTasksTests.cs Tests device selection behavior.
src/​Xamarin.Android.Build.Debugging.Tasks/​Xamarin.Android.Common.Debugging.targets Updates debugging targets and removes GDB targets.
src/​Xamarin.Android.Build.Debugging.Tasks/​Xamarin.Android.Common.Debugging.props Removes obsolete GDB properties.
src/​Xamarin.Android.Build.Debugging.Tasks/​Xamarin.Android.Build.Debugging.Tasks.csproj Removes legacy project references.
src/​Xamarin.Android.Build.Debugging.Tasks/​Utilities/​AndroidHelper.cs Implements SDK-based device selection.
src/​Xamarin.Android.Build.Debugging.Tasks/​Tasks/​WaitForAppDetection.cs Updates asynchronous detection handling.
src/​Xamarin.Android.Build.Debugging.Tasks/​Tasks/​RunTests.cs Updates tooling namespaces.
src/​Xamarin.Android.Build.Debugging.Tasks/​Tasks/​ResolveXamarinAndroidTools.cs Removes obsolete resolver functionality.
src/​Xamarin.Android.Build.Debugging.Tasks/​Tasks/​GetPrimaryCpuAbi.cs Uses SDK ADB APIs for ABI detection.
src/​Xamarin.Android.Build.Debugging.Tasks/​Tasks/​GetGdbSymbols.cs Removes obsolete GDB symbol handling.
src/​Xamarin.Android.Build.Debugging.Tasks/​Tasks/​GenerateGdbEnvironment.cs Removes obsolete GDB environment handling.
src/​Xamarin.Android.Build.Debugging.Tasks/​Tasks/​FastDeploy.cs Uses SDK-based ADB resolution.
src/​Xamarin.Android.Build.Debugging.Tasks/​Tasks/​DetectIfAppWasUninstalled.cs Uses SDK-based package detection.

Comment thread src/Xamarin.Android.Build.Debugging.Tasks/Utilities/AndroidHelper.cs Outdated
Comment thread src/Xamarin.Android.Tools.AndroidSdk/Runners/AdbRunner.cs
Base automatically changed from jonathanpeppers-unify-android-run to main September 25, 2026 15:26
jonathanpeppers and others added 3 commits September 25, 2026 10:26
Use the Android SDK adb runner for device selection and package queries, preserve the resolver target for MSBuild callers, and remove Mono-specific tasks. Stack this change on the unified run-target branch.

Co-authored-by: Copilot App <[email protected]>
Remove the unused GDB setup chain, its environment generation task, and associated defaults now that GetGdbSymbols is gone.

Co-authored-by: Copilot App <[email protected]>
Resolve the SDK adb executable before early ABI detection, avoid unused emulator name probes during device selection, and exercise package-query success and failure with portable fake adb tests.

Co-authored-by: Copilot App <[email protected]>
jonathanpeppers and others added 3 commits September 28, 2026 09:25
Preserve Android SDK device selection alongside the newly added supported-ABI cache and runtime-identifier fallback, retaining the removal of obsolete GDB targets.

Co-authored-by: Copilot App <[email protected]>
MSBuild app builds complete, but an adb server can inherit redirected stdout and stderr. The test builder and adb helper previously waited for stream EOF forever after the parent exited, causing all Windows test lanes to hit their three-hour Azure task limit. Bound stream draining and kill timed-out child processes; cover inherited output handles with a Windows regression test.

Co-authored-by: Copilot App <[email protected]>
ADB may launch a long-lived server while MSBuild is building from a temporary test project. On Windows the server can retain the child's inherited working directory and prevent BuildBasicApplicationThenMoveIt and Check9PatchFilesAreProcessed from moving or deleting it. Start all AdbRunner and FastDeploy adb processes in the stable system temp directory; resolve relative tool paths before switching the working directory. Cover device listing and shell commands with a cross-platform working-directory regression test.

Co-authored-by: Copilot App <[email protected]>
@jonathanpeppers jonathanpeppers added the ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable). label Sep 29, 2026
@jonathanpeppers

Copy link
Copy Markdown
Member Author

/review

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

✅ Android PR Reviewer completed successfully!

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • azcliprod.blob.core.windows.net

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "azcliprod.blob.core.windows.net"

See Network Configuration for more information.

Generated by Android PR Reviewer for #12916

@github-actions github-actions Bot 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.

⚠️ Needs Changes

Findings: 1 ❌ error · 0 ⚠️ warnings · 0 💡 suggestions

The new working-directory regression test compares lexical and physical temp paths, which are commonly /var/... and /private/var/... on macOS. That makes the test fail even when AdbRunner uses the intended directory; the currently red Android Tools macOS check is consistent with this defect. The remaining Azure matrix was still running at review time.

The production migration otherwise preserves the legacy device-selection and ABI fallback behavior well, avoids unnecessary emulator-name queries, and centralizes the stable ADB working directory cleanly.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • azcliprod.blob.core.windows.net

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "azcliprod.blob.core.windows.net"

See Network Configuration for more information.

Generated by Android PR Reviewer for #12916 · copilot · gpt56 · 231.5 AIC · ⌖ 17.5 AIC · ⊞ 26K
Comment /review to run again

Comment thread tests/Xamarin.Android.Tools.AndroidSdk-Tests/AdbRunnerTests.cs Outdated
The macOS fake-adb test printed a physical /private/var path while Path.GetTempPath returned its /var alias. Use a unique relative marker created by each adb command and assert it appears under the temp directory, so the test checks directory identity without depending on spelling.

Co-authored-by: Copilot App <[email protected]>
@jonathanpeppers
jonathanpeppers merged commit 3f356b7 into main Sep 30, 2026
44 checks passed
@jonathanpeppers
jonathanpeppers deleted the jonathanpeppers-migrate-debugging-tasks-android-sdk branch September 30, 2026 20:12
jonathanpeppers added a commit that referenced this pull request Oct 1, 2026
## Summary

- Remove the `Mono.AndroidTools` and `Xamarin.AndroidTools` projects and their compiled assemblies from the workload SDK pack.
- Migrate installer SDK/JDK discovery and macOS directory-size process execution to `Xamarin.Android.Tools.AndroidSdk`, preserving first-time installation when the SDK or JDK is absent.
- Remove obsolete solution, build, packaging, and localization references; add installer discovery regression coverage.

**Breaking change:** Tools referencing `Mono.AndroidTools.dll` or `Xamarin.AndroidTools.dll` directly must migrate to the supported shared Android SDK tooling APIs. Generated non-English `.resx` files under `src/Xamarin.AndroidTools/Properties/` remain untouched per repository localization policy; they are not compiled or packaged.

Stacked on #12916 (which follows merged #12906).

Co-authored-by: Copilot App <[email protected]>
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