-
Notifications
You must be signed in to change notification settings - Fork 385
detect ANDROID_SDK_ROOT #5502
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
detect ANDROID_SDK_ROOT #5502
Changes from 4 commits
c85f725
c392e45
7496678
5751bac
c208716
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ | |
| using System.Threading.Tasks; | ||
| using Microsoft.Diagnostics.NETCore.Client; | ||
| using Microsoft.Extensions.Logging; | ||
| using Xamarin.Android.Tools; | ||
|
|
||
| namespace Microsoft.Diagnostics.Tools.DiagnosticsServerRouter | ||
| { | ||
|
|
@@ -65,7 +66,27 @@ public static void AdbRemovePortReverse(int localPort, int remotePort, bool owns | |
|
|
||
| public static bool RunAdbCommandInternal(string command, string expectedOutput, int expectedExitCode, bool rethrow, ILogger logger) | ||
| { | ||
| string sdkRoot = Environment.GetEnvironmentVariable("ANDROID_SDK_ROOT"); | ||
| void sdklogger(TraceLevel level, string message) | ||
| { | ||
| switch (level) | ||
| { | ||
| case TraceLevel.Error: | ||
| logger?.LogError(message); | ||
| break; | ||
| case TraceLevel.Warning: | ||
| logger?.LogWarning(message); | ||
| break; | ||
| case TraceLevel.Info: | ||
| logger?.LogInformation(message); | ||
| break; | ||
| case TraceLevel.Verbose: | ||
| logger?.LogDebug(message); | ||
| break; | ||
| } | ||
| }; | ||
|
|
||
| //ANDROID_SDK_ROOT is deprecated | ||
| string sdkRoot = Environment.GetEnvironmentVariable("ANDROID_HOME") ?? Environment.GetEnvironmentVariable("ANDROID_SDK_ROOT") ?? new AndroidSdkInfo(logger: sdklogger).AndroidSdkPath; | ||
|
||
| string adbTool = "adb"; | ||
|
|
||
| if (!string.IsNullOrEmpty(sdkRoot)) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably always going to be "preview" branded and marked as a non-shipping/transport package.
We could track with a subscription, but you probably don't need to update this frequently.
I can manage updating it manually when it matters, such as:
> darc update-dependencies --id 276447