[Mono.Android] Use 'merge.SourceFile' to set 'ApiSince'. #4671
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.
Today we populate bound members with
ApiSince
info in their[Register]
attribute. This denotes which platform level the api was added in, allowing the IDE to provide correct cues of which apis are available based on which platform a project targets.This information is provided via some xml files that Google provides with each platform sdk. Unfortunately these files are not always provided, are not always updated, or not always correct. This leads to issues where we are missing information, or updating platform sdks causes "api breakage" because the info changes.
We generate equivalent data via our
api-merge
process that we will now use to populateApiSince
instead of the Google-provided files. This data is computed directly from the variousandroid.jar
files, so it should always be updated and correct.Notable differences
Our current method provides data for API levels that we do not use for
api-merge
, such as 2, 4, 11, 14. However we feel it is ok to lose this data, as it isn't really useful to our users. That is, if the minimum Xamarin.Android can target is API-21, it is not useful to know that an API was added in API-9, since there is no way to target an API level where the member is not available.As such, we are not collecting data for API levels 21 or below, and all members added in any of those levels are considered to "always" have been available. (No
ApiSince
.)ApiCompat
This change creates a significant amount of API "breakages" where
ApiSince
is either getting added or removed. Rather than add an additional 25K lines toacceptable-breakages
, we are updating the reference assembly.Attached is a file describing the
ApiSince
info that changed as a result of this for reference. There are no non-ApiSince
changes.~12.3K members previously had no
ApiSince
and now haveApiSince=22-29
.~12.1K members previously had
ApiSince=1-21
and now have noApiSince
.~200 related fields changed from
28
to29
, this seems to be correct from looking at the source files.api-compat-parsed.txt
Also ignored attribute
T:System.Diagnostics.DebuggerStepThroughAttribute
which seems to be generated in some versions of Roslyn when using anasync Task
method. My local compiler (VS2019 16.5) generates it but apparently the version on the Mac agents does not.