-
Notifications
You must be signed in to change notification settings - Fork 31
Add EmulatorRunner for emulator CLI operations #284
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
Open
rmarinho
wants to merge
16
commits into
main
Choose a base branch
from
feature/emulator-runner
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,173
−24
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
9e408d8
Add EmulatorRunner for emulator CLI operations
rmarinho d0d188a
Fix EmulatorPath Windows lookup and test fake to use .bat
rmarinho 5fb7e6e
Address review findings: structured args, record types, pipe draining…
rmarinho 7e42eff
Fix env vars, timeout duplication, and process tree cleanup
rmarinho 97c05e0
Rename StartAvd→LaunchAvd and BootAndWaitAsync→BootAvdAsync
rmarinho b473917
Address review findings: validation, logging, tests
rmarinho 21f8b94
Fix Process handle leak on successful BootAvdAsync
rmarinho f19b014
Address bot review: exit code check, typed catch, shell doc
rmarinho d8ee2d5
Rename LaunchAvd→LaunchEmulator, BootAvdAsync→BootEmulatorAsync, add …
rmarinho b462f24
Add tests ported from dotnet/android BootAndroidEmulator
rmarinho 8cbb0ae
Fix AVD name detection for emulator 36+ with getprop fallback
rmarinho 63c0fcf
Address PR review: record type, List<string>, simplify code
rmarinho d12dde7
Apply NullLogger pattern across all runners
rmarinho 2bf8d67
Add EmulatorBootErrorKind enum to EmulatorBootResult
rmarinho e46f7de
Consolidate NullLogger and remove null-forgiving operator
rmarinho 92d5e25
Fix inaccurate comment about emulator console auth
rmarinho File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
src/Xamarin.Android.Tools.AndroidSdk/Models/EmulatorBootOptions.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
|
|
||
| namespace Xamarin.Android.Tools; | ||
|
|
||
| /// <summary> | ||
| /// Options for booting an Android emulator. | ||
| /// </summary> | ||
| public record EmulatorBootOptions | ||
| { | ||
| public TimeSpan BootTimeout { get; init; } = TimeSpan.FromSeconds (300); | ||
| public List<string>? AdditionalArgs { get; init; } | ||
| public bool ColdBoot { get; init; } | ||
| public TimeSpan PollInterval { get; init; } = TimeSpan.FromMilliseconds (500); | ||
| } |
41 changes: 41 additions & 0 deletions
41
src/Xamarin.Android.Tools.AndroidSdk/Models/EmulatorBootResult.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| namespace Xamarin.Android.Tools; | ||
|
|
||
| /// <summary> | ||
| /// Classifies the reason an emulator boot operation failed. | ||
| /// </summary> | ||
| public enum EmulatorBootErrorKind | ||
| { | ||
| /// <summary>No error — the boot succeeded.</summary> | ||
| None, | ||
|
|
||
| /// <summary>The emulator process could not be launched (e.g., binary not found, AVD missing).</summary> | ||
| LaunchFailed, | ||
|
|
||
| /// <summary>The emulator launched but did not finish booting within the allowed timeout.</summary> | ||
| Timeout, | ||
|
|
||
| /// <summary>The boot was cancelled via <see cref="System.Threading.CancellationToken"/>.</summary> | ||
| Cancelled, | ||
|
|
||
| /// <summary>An unexpected error occurred.</summary> | ||
| Unknown, | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Result of an emulator boot operation. | ||
| /// </summary> | ||
| public record EmulatorBootResult | ||
| { | ||
| public bool Success { get; init; } | ||
| public string? Serial { get; init; } | ||
| public string? ErrorMessage { get; init; } | ||
|
|
||
| /// <summary> | ||
| /// Structured error classification. Consumers should switch on this value | ||
| /// instead of parsing <see cref="ErrorMessage"/> strings. | ||
| /// </summary> | ||
| public EmulatorBootErrorKind ErrorKind { get; init; } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.