Commit eefaef6
committed
Fix sort ordering for ndk-bundle, add macOS support
Context: https://build.azdo.io/xamarin/public/21545
An environment change on Azure DevOps seems to cause the test failure
on Windows:
Ndk_PathInSdk
AndroidNdkPath not found inside sdk!
Expected string length 71 but was 53. Strings differ at index 3.
Expected: "C:\Users\VssAdministrator\AppData\Local\Temp\tmpAE78.tmp\sdk\..."
But was: "C:\Program Files (x86)\Android\android-sdk\ndk-bundle"
It appears that `xamarin-android-tools` is preferring an `ndk-bundle
found on the system instead of the value passed in for
`AndroidSdkPath`.
To make matters worse, use of `Distinct()` returns an unordered
sequence, and so the sort ordering is unknown:
https://docs.microsoft.com/dotnet/api/system.linq.enumerable.distinct
To fix this, let's not use `ToList()` or add `AndroidSdkPath` to the
list at all. We can make an explicit check for it before the `foreach`
loop. Inside the loop we should skip `AndroidSdkPath`.
I also added the same code for the macOS/linux side in
`AndroidSdkUnix`.
I updated the `Ndk_PathInSdk` test so it will run on all platforms.1 parent 3974fc3 commit eefaef6
File tree
3 files changed
+33
-11
lines changed- src/Xamarin.Android.Tools.AndroidSdk/Sdks
- tests/Xamarin.Android.Tools.AndroidSdk-Tests
3 files changed
+33
-11
lines changedLines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
128 | 146 | | |
129 | 147 | | |
130 | 148 | | |
| |||
Lines changed: 13 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
242 | 246 | | |
| 247 | + | |
| 248 | + | |
243 | 249 | | |
244 | 250 | | |
245 | 251 | | |
| |||
Lines changed: 2 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | 70 | | |
74 | 71 | | |
75 | 72 | | |
| |||
79 | 76 | | |
80 | 77 | | |
81 | 78 | | |
| 79 | + | |
82 | 80 | | |
83 | 81 | | |
84 | 82 | | |
85 | | - | |
| 83 | + | |
86 | 84 | | |
87 | 85 | | |
88 | 86 | | |
| |||
0 commit comments