Commit 23c4fe0
[Xamarin.Android.Tools.AndroidSdk] Add support for cmdline-tools (#83)
Context: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1109288
Context: https://dl.google.com/android/repository/repository2-1.xml
Google has deprecated the `tools` Android SDK package, replacing it
with the `cmdline-tools` package, which introduces a version
directory component.
Old and busted:
$(AndroidSdkDirectory)/tools/bin/sdkmanager
New hotness:
$(AndroidSdkDirectory)/cmdline-tools/latest/bin/sdkmanager
Of particular interest is that `latest` is a *literal value*. There
is also a `cmdline-tools;1.0` package which creates a
`cmdline-tools/1.0` directory.
Add a new `AndroidSdkInfo.GetCommandLineToolsPaths()` method which
returns the "command-line tools paths", ordered by version and (non-)
obsolescence. For example, given the directory structure:
* `$(AndroidSdkDirectory)/tools/bin/sdkmanager`
* `$(AndroidSdkDirectory)/cmdline-tools/1.0/bin/sdkmanager`
* `$(AndroidSdkDirectory)/cmdline-tools/latest/bin/sdkmanager`
Then `AndroidSdkInfo.GetCommandLineToolsPaths()` will return,
in this order:
* `$(AndroidSdkDirectory)/cmdline-tools/latest`
* `$(AndroidSdkDirectory)/cmdline-tools/1.0`
* `$(AndroidSdkDirectory)/tools`
The `latest` version is always preferred, if present, followed by any
actually versioned cmdline-tools directories, followed by the `tools`
directory, if it exists.
Note that "prefixes" are returned. All utilities are within a nested
`bin` directory, so if you want e.g. the latest `sdkmanager` util,
you would want to do:
var info = new AndroidSdkInfo (path);
var latestSdkManager = Path.Combine (
info.GetCommandLineToolsPaths ().First (),
"bin",
"sdkmanager");
Finally, remove some unnecessary members from `AndroidSdkBase` which
were never used -- and thus are "noise" -- and don't make sense in
the new `cmdline-tools` world, as the cmdline-tools package doesn't
contain them…1 parent cf9d325 commit 23c4fe0
File tree
3 files changed
+141
-25
lines changed- src/Xamarin.Android.Tools.AndroidSdk
- Sdks
- tests/Xamarin.Android.Tools.AndroidSdk-Tests
3 files changed
+141
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
| 55 | + | |
60 | 56 | | |
61 | 57 | | |
62 | 58 | | |
| |||
66 | 62 | | |
67 | 63 | | |
68 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
69 | 74 | | |
70 | 75 | | |
71 | 76 | | |
| |||
185 | 190 | | |
186 | 191 | | |
187 | 192 | | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
188 | 228 | | |
189 | 229 | | |
Lines changed: 0 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | 40 | | |
42 | | - | |
43 | 41 | | |
44 | 42 | | |
45 | 43 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | 44 | | |
50 | 45 | | |
51 | 46 | | |
| |||
76 | 71 | | |
77 | 72 | | |
78 | 73 | | |
79 | | - | |
80 | | - | |
81 | 74 | | |
82 | 75 | | |
83 | 76 | | |
84 | | - | |
85 | | - | |
86 | 77 | | |
87 | 78 | | |
88 | 79 | | |
| |||
98 | 89 | | |
99 | 90 | | |
100 | 91 | | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | 92 | | |
105 | 93 | | |
106 | 94 | | |
| |||
Lines changed: 96 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
167 | 222 | | |
168 | 223 | | |
169 | | - | |
| 224 | + | |
170 | 225 | | |
171 | | - | |
| 226 | + | |
172 | 227 | | |
173 | 228 | | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
174 | 235 | | |
175 | 236 | | |
176 | 237 | | |
| |||
185 | 246 | | |
186 | 247 | | |
187 | 248 | | |
188 | | - | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
189 | 280 | | |
190 | | - | |
191 | | - | |
| 281 | + | |
| 282 | + | |
192 | 283 | | |
193 | 284 | | |
194 | 285 | | |
195 | 286 | | |
196 | 287 | | |
197 | | - | |
198 | | - | |
199 | 288 | | |
200 | 289 | | |
201 | 290 | | |
202 | 291 | | |
203 | 292 | | |
204 | 293 | | |
205 | 294 | | |
206 | | - | |
207 | 295 | | |
208 | 296 | | |
209 | 297 | | |
| |||
0 commit comments