Commit 4cd2060
authored
[Mono.Android] Use Android platform api-versions.xml (#4186)
A "funny" thing happened when we bumped `$(XAPlatformToolsVersion)`
in PR #4012: ~all of the API compat checks started failing!
AfterBuild:
CheckApiCompatibility for ApiLevel: v10.0
CompatApi command: ../../packages/Microsoft.DotNet.ApiCompat.5.0.0-beta.19606.1/tools/net472/Microsoft.DotNet.ApiCompat.exe "../../tests/api-compatibility\reference\ApiCompatTemp" -i "F:\A\xamarin-v000006-1\_work\2\s\bin\Release\lib\xamarin.android\xbuild-frameworks\MonoAndroid\v10.0\ApiCompatTemp" --exclude-attributes ../../tests/api-compatibility\api-compat-exclude-attributes.txt
Compat issues with assembly Mono.Android:
CannotChangeAttribute : Attribute 'Android.Runtime.RegisterAttribute' on 'System.String Android.Manifest.Permission.AccessBackgroundLocation' changed from '[RegisterAttribute("ACCESS_BACKGROUND_LOCATION")]' in the contract to '[RegisterAttribute("ACCESS_BACKGROUND_LOCATION", ApiSince=29)]' in the implementation.
...
The API compat checks are failing because of the *introduction* of
`RegisterAttribute.ApiSince` property values for members added in
API-29, and these errors didn't "make sense" to use because we had
expected all these members to *already* have `ApiSince=29`!
What Went Wrong™?
For starters, our memory and expectations were...incomplete.
`RegisterAttribute.ApiSince` is set based on the contents of the
Android SDK file `platform-tools/api/api-versions.xml`, which is part
of the "platform-tools" package.
Turns Out™ that `api-versions.xml` was *not* updated by Google when
the platform-tools package was updated to r29. Specifically, the
`platform-tools/api/api-versions.xml` file within
`platform-tools_r29.0.1-darwin.zip` doesn't contain *any* members
from API-29, and `RegisterAttribute.ApiSince` is only emitted when
the member is found within `api-versions.xml`.
This explains why PR #4012 "caused" the API breakage: The
platform-tools r29.0.5 package *does* contain an `api-versions.xml`
which contains API-29 members; thus updating platform-tools "caused"
the emission of the `RegisterAttribute.ApiSince` property values.
Which is a long-winded way of saying that *we cannot trust* the
`api-versions.xml` file within the platform-tools package.
With that trust lost, what do we use instead? There is another set
of `api-version.xml` files: starting with API-26, there are
`platforms/android-*/data/api-versions.xml` files. Furthermore, the
`api-versions.xml` file included with API-Q -- the preview for API-29
-- *did* contain the members added in API-29, and *did* indicate that
those members were added in API-29. As such, we do consider this
source of data to be trustworthy (this week, anyway).
Update `Mono.Android.targets` to use
`$(AndroidSdkDirectory)\platforms\android-$(AndroidApiLevel)\data\api-versions.xml`
for `RegisterAttribute.ApiSince` information, if it exists. If it
doesn't exist, we fallback and use the previously used platform-tools
copy of `api-versions.xml`.
Finally, two related changes:
1. Update to use `Microsoft.DotNet.GenAPI` and
`Microsoft.DotNet.ApiCompat` package versions of
5.0.0-beta.20078.1, up from 5.0.0-beta.20078.1.
This was done as it supposedly contains performance improvements.
2. Improve the mono crash detection from 5b1422c. With 5b1422c,
sometimes there would be "odd behavior" when re-using the same
`Process` object after the crash was detected. The `Process`
usage recommendation is to use a new `Process` object for each
process invocation; implement this recommendation.1 parent e120647 commit 4cd2060
File tree
7 files changed
+1406
-51
lines changed- build-tools/Xamarin.Android.Tools.BootstrapTasks
- Xamarin.Android.Tools.BootstrapTasks
- src/Mono.Android
- tests/api-compatibility
7 files changed
+1406
-51
lines changedLines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
66 | | - | |
| 65 | + | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| |||
Lines changed: 36 additions & 36 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | | - | |
| 145 | + | |
| 146 | + | |
146 | 147 | | |
147 | | - | |
148 | | - | |
| 148 | + | |
| 149 | + | |
149 | 150 | | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
155 | 156 | | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
171 | 173 | | |
172 | 174 | | |
173 | | - | |
174 | 175 | | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
| 176 | + | |
| 177 | + | |
182 | 178 | | |
| 179 | + | |
183 | 180 | | |
184 | 181 | | |
185 | 182 | | |
| |||
198 | 195 | | |
199 | 196 | | |
200 | 197 | | |
201 | | - | |
| 198 | + | |
| 199 | + | |
202 | 200 | | |
203 | 201 | | |
204 | 202 | | |
| |||
328 | 326 | | |
329 | 327 | | |
330 | 328 | | |
331 | | - | |
| 329 | + | |
332 | 330 | | |
| 331 | + | |
333 | 332 | | |
334 | | - | |
335 | | - | |
336 | | - | |
| 333 | + | |
337 | 334 | | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
338 | 338 | | |
339 | 339 | | |
340 | 340 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
81 | 85 | | |
82 | 86 | | |
83 | 87 | | |
| |||
87 | 91 | | |
88 | 92 | | |
89 | 93 | | |
90 | | - | |
| 94 | + | |
91 | 95 | | |
92 | 96 | | |
93 | 97 | | |
| |||
173 | 177 | | |
174 | 178 | | |
175 | 179 | | |
176 | | - | |
| 180 | + | |
177 | 181 | | |
178 | 182 | | |
179 | 183 | | |
| |||
0 commit comments