Skip to content

Commit 944d306

Browse files
authored
[api-merge] Add removed-since info (#8897)
Our process of building `Mono.Android.dll`'s `api.xml` using `api-merge` does not take into consideration that API could be *removed* from `android.jar`. Track API removals by adding a `removed-since="API-LEVEL"` attribute to API members that no longer exists. Note this information is not currently consumed anywhere, but having this data will allow us to determine if we want to make modifications to handle it in future PRs. Potentially [`[UnsupportedOSPlatformAttribute]`][0] is a good solution for this. [0]: https://learn.microsoft.com/dotnet/api/system.runtime.versioning.unsupportedosplatformattribute?view=net-8.0
1 parent 24fb6ab commit 944d306

2 files changed

Lines changed: 663 additions & 646 deletions

File tree

‎build-tools/api-merge/ApiDescription.cs‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,13 @@ public void Merge (XDocument n, string apiLocation)
121121
}
122122
}
123123
#endif
124+
foreach(varsmemberinstype.Elements()){
125+
varnmember=GetMember(ntype,smember);
126+
127+
if(nmemberisnull)
128+
SetRemovedSince(smember,platform);
129+
}
130+
124131
foreach(varnmemberinntype.Elements()){
125132
varsmember=GetMember(stype,nmember);
126133
if(smember==null){
@@ -308,6 +315,16 @@ void SetDeprecatedSince (XElement element, string platform)
308315
deprecatedSince.SetValue(platform);
309316
}
310317

318+
voidSetRemovedSince(XElementelement,stringplatform)
319+
{
320+
if(elementisnull)
321+
return;
322+
323+
// Don't replace an earlier removal, as we want to keep the earliest one.
324+
if(!element.Attributes("removed-since").Any())
325+
element.Add(newXAttribute("removed-since",platform));
326+
}
327+
311328
XElementAddWithLocation(XElementold,XElementchild,stringlocation)
312329
{
313330
child.Add(newXAttribute("merge.SourceFile",location));

0 commit comments

Comments
 (0)